RE: [PHP-DB] Cookies etc.
| From: | Matt Williams | Date: | Wed, 26 Jul 2000 13:21:26 +0000 |
| Subject: | RE: [PHP-DB] Cookies etc. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1512@lists.php.net to get a copy of this message | ||
Hi
It's generally a bad idea to store a username and password inside a cookie.
People getting access to the cookie would be able to find their details
easily.
How I do it is when the user logs in, set a cookie with the username and a
sessionid. These are also stored in a table for sessions in the db.
Now each page checks for the cookie and makes sure the username and session
id match those in the db. If anyone tampers with the cookie it would no
longer be valid as it is different from that in the db.
M@
-----Original Message-----
From: Vojtech Dvorak [mailto:vojtech_dvorak@servind.cz]
Sent: Wednesday, July 26, 2000 02:03
To: php-db@lists.php.net
Subject: [PHP-DB] Cookies etc.
Hi,
I am doing easy user/password check for my www pages/database. And as I was
thinking how could I protect every page of my "secured area" I came to good
idea... set a cookie like this:
setcookie("monstrum_login","$username
$password",time()+3600,"/","127.0.0.1",0)
But it easily doesn't set the cookie.
No error message, nothing.
What I am doing wrong?
Or better, has someone from you working user/password protection connected
to ODBC database for validating of login/password.
Thanks a lot
Vojtech
PS: Just checked PHP manual and found quite lot of weird things around
SETCOOKIE.... :-(
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net