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 Link to comment https://forums.phpfreaks.com/topic/217965-cookies-not-setting-not-leading-to-next-page/ 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? Link to comment https://forums.phpfreaks.com/topic/217965-cookies-not-setting-not-leading-to-next-page/#findComment-1131171 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. Link to comment https://forums.phpfreaks.com/topic/217965-cookies-not-setting-not-leading-to-next-page/#findComment-1131172 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.