ARGGGGGGGGGGG bad day for coding & reading
Replace
if ( mysql_num_rows($db) ) {
with
if ( mysql_num_rows($db)==1 ) {
now I am going home before I cause any more damage :)
---------------------------------------------------------
Chris Kay
Techex Communications
Website: www.techex.com.au Email: [EMAIL PROTECTED]
Telephone: 1300 88 111 2 - Fax: 1300 882 221
---------------------------------------------------------
-----Original Message-----
From: Chris Kay
Sent: Thursday, 26 June 2003 5:27 PM
To: Chris Kay; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] passwd protected page
Sorry I didn't read the first post about not wanting to use sessions,
what about cookies?
What about making a hash of the username and password and place it in
the url
EG: /main.php?u=chris&p=AJKHSA765JAFG443320
Something like that
Check the hash against the database each page
$db = mysql_query("select * from users where username = '". $_GET['u']
."'");
if ( mysql_num_rows($db) ) {
$database = mysql_fetch_array($db);
If ( $_GET['p'] == md5($database[password]) ) {
// Let them go
} else {
header("Location: error.php?error=invalid");
}
} else {
header("Location: error.php?error=noset");
}
Try this it will work
---------------------------------------------------------
Chris Kay
Techex Communications
Website: www.techex.com.au Email: [EMAIL PROTECTED]
Telephone: 1300 88 111 2 - Fax: 1300 882 221
---------------------------------------------------------
-----Original Message-----
From: Chris Kay
Sent: Thursday, 26 June 2003 5:19 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] passwd protected page
Why not use sessions, store a $loggedin value in a session or cookie
And check that at the top of each page.. no session = no access
Hope this helps
---------------------------------------------------------
Chris Kay
Techex Communications
Website: www.techex.com.au Email: [EMAIL PROTECTED]
Telephone: 1300 88 111 2 - Fax: 1300 882 221
---------------------------------------------------------
-----Original Message-----
From: Bibhas Kumar Samanta [mailto:[EMAIL PROTECTED]
Sent: Thursday, 26 June 2003 5:14 PM
To: Sichta Daniel
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] passwd protected page
how should I pass the logged in user to other pages ?
In the database at the same time there might be several user
logged in ?
Thanks,
Bibhas
Sichta Daniel wrote:
>
> Hi,
>
> You can validate user on login page and sets the flag in database
table.
> Then on each page you have to check that flag again ....
>
> DS
>
> -----Original Message-----
> From: Bibhas Kumar Samanta [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 26, 2003 8:52 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] passwd protected page
>
> Hi,
>
> Without using sessions , how can I create
> passwd protected pages in mysql/php.
>
> I need to remember the user from login page and
> validate this user in other pages.
>
> Thanks,
> Bibhas
>
> --
> 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
--
Message protected by MailGuard: e-mail anti-virus, anti-spam and content
filtering.
http://www.mailguard.com.au/mg
--
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