George Botley Posted November 6, 2010 Share Posted November 6, 2010 Hello, It's as subject says. Here is the code: <? //Config include_once "../../config/config.php"; //Variables $username = $_POST["username"]; $username = mysql_real_escape_string($username); $password = $_POST["password"]; $password = md5($password); //Check for User $query = "SELECT * FROM users WHERE username='$username' AND password='$password'"; $query = mysql_query($query); //If user not found if(mysql_num_rows($query)!="1") { echo "No User Found"; } //If User Found else { while($row=mysql_fetch_array($query)) { $fname = $row["fname"]; $lname = $row["lname"]; $userid = $row["id"]; $admin = $row["admin"]; } setcookie("fname", "$fname"); setcookie("lname", "$lname"); setcookie("userid", "$userid"); setcookie("admin", "$admin"); header('Location: ../../../portal/index.php'); } ?> On the page it forwards to, I write print_r($_COOKIE); Yet it doesn't show my newly set cookies, yet the above snipped does on the script code above. George Quote Link to comment Share on other sites More sharing options...
Rifts Posted November 6, 2010 Share Posted November 6, 2010 Hey you tried echoing out all your vars to make sure they are working? Quote Link to comment Share on other sites More sharing options...
George Botley Posted November 6, 2010 Author Share Posted November 6, 2010 Yes. I used print_var($_Cookie) after the cookies were set and the acceptable values were echoed. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.