roper22 Posted September 24, 2007 Share Posted September 24, 2007 Hi everyone. I'm kinda new to PHP, but I feel as though I am learning quite quickly. I was attempting to make a login, but I hit a roadblock in this... -------------------------------------------------------------- <?php setcookie("cookie", "Hello.", time()+3200); ?> -------------------------------------------------------------- That code works. --------------------------------------------------------- <?php include 'connect.php'; $password = $_POST['password']; $username = $_POST['username']; $sql = "SELECT * FROM users WHERE username = '".$username."' AND password = '".md5($password)."'"; $result = mysql_query($sql); $num = mysql_num_rows($result); if ($num > 0) { //USER AND PASS ARE CORRECT $id = mysql_fetch_array($result); echo "s"; setcookie("cookie", "Hello.", time()+3200); } else { echo "f"; } ?> --------------------------------------------------------- But after taking that EXACT line, and putting it in my login script, it doesn't work. Help appreciated! Thanks tons guys. The first code can be seen active on www.trportfolio.net/cookie_test.php The second can be seen if you register at www.trportfolio.net/register.php and then login at www.trportfolio.net/login.php Quote Link to comment https://forums.phpfreaks.com/topic/70536-cookies-a-simple-problem-gone-wacky/ Share on other sites More sharing options...
roper22 Posted September 24, 2007 Author Share Posted September 24, 2007 Just realized this is in the wrong section Sorry, i'll post it in the correct one and leave this here for deletion. Quote Link to comment https://forums.phpfreaks.com/topic/70536-cookies-a-simple-problem-gone-wacky/#findComment-354396 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.