RE: [PHP] Member's Area Script
| From: | Stephen Craton | Date: | Tue, 01 Oct 2002 22:27:20 +0000 |
| Subject: | RE: [PHP] Member's Area Script | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-118453@lists.php.net to get a copy of this message | ||
Hello,
Can you please send me the files again? I just formatted and installed
Windows XP Pro and I thought exporting my email would also export the
attachments but I guess not. Thanks!
Thanks,
Stephen
-----Original Message-----
From: Debbie Dyer [mailto:debbie.dyer@c-u-online.co.uk]
Sent: None
To: Stephen Craton
Subject: Re: [PHP] Member's Area Script
Stephen
I didn't have time to go through all the code so I have sent you an
example of a logn/logout/test page.
Notice that when logging in the password is checked using the PASSWORD
function - you must insert passwords using PASSWORD or MD5 or some kind
of encryption - storing unencrypted passwords is bad.
It will easy to insert your pics/text around this skeleton.
Any questions let me know.
Debbie
----- Original Message -----
From: Stephen Craton
To: 'debbie_dyer'
Sent: Monday, September 30, 2002 12:53 PM
Subject: RE: [PHP] Member's Area Script
Here are the files. The 278 B file is the connections file and needs to
go into a folder called Connections.
Thanks,
Stephen
http://www.melchior.us
http://php.melchior.us
:: -----Original Message-----
:: From: debbie_dyer [mailto:debbie_dyer@surfanytime.co.uk]
:: Sent: Monday, September 30, 2002 1:55 AM
:: To: Stephen Craton
:: Subject: Re: [PHP] Member's Area Script
::
::
:: Stephen
::
:: Send me back the script/s as an attachment and I will see if
:: I can see what the problem is.
::
:: Debbie
::
:: ----- Original Message -----
:: From: "Stephen Craton" <webmaster@melchior.us>
:: To: "'debbie_dyer'" <debbie_dyer@surfanytime.co.uk>;
:: <php-general@lists.php.net>
:: Sent: Monday, September 30, 2002 2:22 AM
:: Subject: RE: [PHP] Member's Area Script
::
::
:: > I'm having the error again this time on my webserver. I
:: have it set as
:: > a global variable but it's not working. It can be found at
:: > http://mom.melchior.us. Type in test for the username
and
:: password.
:: > Why???
:: >
:: > Thanks,
:: > Stephen
:: > http://www.melchior.us
:: > http://php.melchior.us
:: >
:: > :: -----Original Message-----
:: > :: From: debbie_dyer [mailto:debbie_dyer@surfanytime.co.uk]
:: > :: Sent: Saturday, September 28, 2002 6:03 PM
:: > :: To: php-general@lists.php.net
:: > :: Subject: Re: [PHP] Member's Area Script
:: > ::
:: > ::
:: > ::
:: > :: $conn = $main; <- that line is the problem - you cant use
:: > :: global vars inside functions without declaring them as global
:: > ::
:: > :: ----- Original Message -----
:: > :: From: "Stephen Craton" <webmaster@melchior.us>
:: > :: To: <php-general@lists.php.net>
:: > :: Sent: Saturday, September 28, 2002 11:49 PM
:: > :: Subject: [PHP] Member's Area Script
:: > ::
:: > ::
:: > :: > Hello again,
:: > :: >
:: > :: > I'm trying to write a script that has a member's area in
:: > :: it. So far
:: > :: > I've been able to successfully validate only one username
:: > :: and only one
:: > :: > password but now I'm going big and trying to compare it
:: > :: with a table
:: > :: > in my MySQL database. Everything goes nice and smooth
:: > :: until I actually
:: > :: > try and enter in my username and password. I type it
:: in, copy and
:: > :: > paste, whaetever and it tells me the error I wanted it to say
:: > "The
:: > :: > username and password is not a good combo." I've copied
:: > :: and pasted the
:: > :: > username and password from the database directly yet it
:: > :: still gives me
:: > :: > this error. Here's my code for the login() function that
:: > :: logs the user
:: > :: > in:
:: > :: >
:: > :: > function login($username, $password)
:: > :: > {
:: > :: > $conn = $main;
:: > :: > if (!$conn)
:: > :: > return 0;
:: > :: >
:: > :: > $result = mysql_query("select * from user
:: > :: > where username='$username'
:: > :: > and passwd = '$password'");
:: > :: > if (!$result)
:: > :: > return 0;
:: > :: >
:: > :: > if (mysql_num_rows($result)>0)
:: > :: > return 1;
:: > :: > else
:: > :: > return 0;
:: > :: > }
:: > :: >
:: > :: > Here's the code for the part that calls the login() function:
:: > :: >
:: > :: > if(login($user, $pass))
:: > :: > {
:: > :: > $valid_user = $user;
:: > :: > session_register("valid_user");
:: > :: > }
:: > :: > else
:: > :: > {
:: > :: > echo "<font face='Arial, Helvetica, sans-serif'
:: > :: > size='3'><center><b>You supplied an invalid username
:: and password
:: > :: > combo. Try again please.</b></center>"; exit;
:: > :: > }
:: > :: >
:: > :: > And here's the part that connects to the database:
:: > :: >
:: > :: > <?php
:: > :: > # FileName="Connection_php_mysql.htm"
:: > :: > # Type="MYSQL"
:: > :: > # HTTP="true"
:: > :: > $hostname_main = "localhost";
:: > :: > $database_main = "mom";
:: > :: > $username_main = "root";
:: > :: > $password_main = "";
:: > :: > $main = mysql_pconnect($hostname_main, $username_main,
:: > :: $password_main)
:: > :: > or die(mysql_error()); ?>
:: > :: >
:: > :: > Does anyone see why it's doing this to me? Please help!!
:: > :: >
:: > :: > Thanks,
:: > :: > Stephen
:: > :: > http://www.melchior.us
:: > :: > http://php.melchior.us
:: > :: >
:: > :: >
:: > :: >
:: > :: > --
:: > :: > PHP General Mailing List (http://www.php.net/)
:: > :: > To unsubscribe, visit: http://www.php.net/unsub.php
:: > :: >
:: > ::
:: > ::
:: > :: --
:: > :: PHP General Mailing List (http://www.php.net/)
:: > :: To unsubscribe, visit: http://www.php.net/unsub.php
:: > ::
:: > ::
:: >
:: >
:: >
:: > --
:: > PHP General Mailing List (http://www.php.net/)
:: > To unsubscribe, visit: http://www.php.net/unsub.php
:: >
::
::
::