Jump to content

[SOLVED] cookies not saving


daveoffy

Recommended Posts

The cookies wont save. In FF3 they did and in FF3.5 they are not.

 

<?php
require_once('../include/config.php');
$username = $_POST['username'];
$password = $_POST['password'];
$qry = "SELECT * FROM u_info WHERE username='$username' AND password='".md5($password)."'";
$result=mysql_query($qry);
if($result) {
	if(mysql_num_rows($result) == 1) {
	 if (isset($_POST['rememberme'])) {
	setcookie('username', $_POST['username'], time()+60*60*24*14, '/', 'www.site.com', NULL, TRUE);
	setcookie('password', md5($_POST['password']), time()+60*60*24*14, '/', 'www.site.com', NULL, TRUE);
	} else {
	setcookie('username', $_POST['username'], false, '/', 'www.site.com', NULL, TRUE);
	setcookie('password', md5($_POST['password']), false, '/', 'www.site.com', NULL, TRUE);
	}
	header("location: ../index.php");
	exit();
	}else {
		header("location: ../login-failed.php");
		exit();
	}
}else {
	die("Query failed");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/167445-solved-cookies-not-saving/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.