Note Submitter: bret
----
i have a problem with my set cookie code it just isnt
working.. please help me if u can:
}
if ($_POST[login]) {
// the form has been submitted. We continue...
$username=$_POST['username'];
$password = md5($_POST[password]);
// the above lines set variables with the submitted
information.
$info = mysql_query("SELECT * FROM users WHERE
username = '$username'") or die(mysql_error());
$data = mysql_fetch_array($info);
if($data[password] != $password) {
// the password was not the user's password!
echo "Incorrect username or password!";
}else{
// the password was right!
$query = mysql_query("SELECT * FROM users WHERE
username = '$username'") or die(mysql_error());
$user = mysql_fetch_array($query);
// gets the user's information
setcookie("id", $user[id], time()+3600); /*
expire in 1 hour */
setcookie("pass", $user[password], time()+3600,
"/~rasmus/",
".bretx-designs.x1topsites.com", 1);
// the above lines set 2 cookies. 1 with the user's id and
another with his/her password.
echo ("Thank You! You will be
redirected");
// modify the above line...add in your site url instead of
yoursite.com
}
}
}
else
{
// we now display the user controls.
echo ("
Welcome $logged[username]
- <a href=\"editprofile.php\">Edit
Profile
- <a href=\"members.php\">Member List
- <a href=\"logout.php\">Logout");
}
?>
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|