Hvad er der galt med min kode ?
Side1:
<?
$login = $_GET['login'];
if($login == "login_done")
{
$username = $_POST['username'];
$password = $_POST['password'];
include "connect.php";
$con = mysql_connect ("$host","$user","$pass");
if(!isset($con))
{
die('Could not connect to the server');
}
else
{
mysql_select_db("$db" , $con);
}
$sql = sprintf("SELECT * FROM $members WHERE username='$username' and password='$password' LIMIT 1");
$result = mysql_query($sql,$con);
$count = mysql_num_rows($result);
if ($count == '1')
{
setcookie("user_data", '$username', time()+3600);
header("location:../mainpage.php?login=login_succes");
}
else
{
header("location:?login=failed");
}
}
?>
Den vil ikke sætte nogen value i cookien
setcookie("user_data", '$username', time()+3600);
Side2:
<?
print_r($_COOKIE);
?>
Det eneste den printer er Array()
Indlæg senest redigeret d. 02.10.2009 05:25 af Bruger #14641