cookies
| From: | (Edward Peloke) | Date: | Fri, 20 Dec 2002 21:53:32 +0000 |
| Subject: | cookies | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-129026@lists.php.net to get a copy of this message | ||
I am setting a cookie with this code:
<?
require("connection.php");
?>
<?
if (isset($submit_login)) {
# setup SQL statement
$pword=md5($pword);
$SQL2 = "select * from clients where uname='$uname' and
pword='$pword'";
$result2 = mysql_db_query($db,"$SQL2",$connection);
$affected_rows = mysql_num_rows($result2);
if($affected_rows>0){
$myrow2 = mysql_fetch_array($result2);
$clientid=$myrow2["id"];
$fname=$myrow2["fname"];
$cookievalue=md5($uname.$password);
setcookie("aircharteruser",$cookievalue,time()+1800,"/");
}
}
?>
and then checking in my other pages to see if it is set here..
<?
if (!isset($HTTP_COOKIE_VARS['aircharteruser']))
{ header("location: login_clients.php");}
?>
The only problem is once the cookie is set, it never seems to go away. This
one should have expired in 30 minutes right? I can still go in and get to
the other pages without it telling me to log in. What did I do wrong?
Thanks!
Eddie