Hallo, ich hab irgendwie Probleme mein Cookie auszulesen, ich bekomme einfach keine Daten (das Cookie existiert aber):
function checkCookie()
{
# echo "muh: " . $HTTP_COOKIE_VARS["muh"]
# -> PROBLEM: DATEN SIND LEER
$cookie_var = split("-", $HTTP_COOKIE_VARS["muh"]);
$username = $cookie_var[0];
$password = $cookie_var[1];
if($username == "" || $userpass == "")
return;
$query = "SELECT UserID FROM users WHERE UserName='".addslashes($username)."' AND UserPass='".addslashes($password)."'";
$result = mysql_query($query);
if(mysql_num_rows ($result) == 0)
return;
else
{
$UserName = stripslashes($row['UserName']);
$UserPass = stripslashes($row['UserPass']);
}
$this->userid = $this->check_user($UserName, $UserPass);
if ($this->userid != false)
$this->doLogin();
else
return false;
}
function generateCookie()
{
$this->connect();
if($this->userid == 0)
return;
$query="SELECT UserName,UserPass FROM users WHERE UserId=$this->userid LIMIT 1";
$result = mysql_query ($query);
if(mysql_num_rows ($result) == 0)
return;
$row = mysql_fetch_assoc ($result);
$UserName = stripslashes($row['UserName']);
$UserPass = stripslashes($row['UserPass']);
$cookie_val = $UserName . "-" . $UserPass;
setcookie("muh", $cookie_val, time()+(30*24*60*60));
}
function checkCookie()
{
# echo "muh: " . $HTTP_COOKIE_VARS["muh"]
# -> PROBLEM: DATEN SIND LEER
$cookie_var = split("-", $HTTP_COOKIE_VARS["muh"]);
$username = $cookie_var[0];
$password = $cookie_var[1];
if($username == "" || $userpass == "")
return;
$query = "SELECT UserID FROM users WHERE UserName='".addslashes($username)."' AND UserPass='".addslashes($password)."'";
$result = mysql_query($query);
if(mysql_num_rows ($result) == 0)
return;
else
{
$UserName = stripslashes($row['UserName']);
$UserPass = stripslashes($row['UserPass']);
}
$this->userid = $this->check_user($UserName, $UserPass);
if ($this->userid != false)
$this->doLogin();
else
return false;
}
function generateCookie()
{
$this->connect();
if($this->userid == 0)
return;
$query="SELECT UserName,UserPass FROM users WHERE UserId=$this->userid LIMIT 1";
$result = mysql_query ($query);
if(mysql_num_rows ($result) == 0)
return;
$row = mysql_fetch_assoc ($result);
$UserName = stripslashes($row['UserName']);
$UserPass = stripslashes($row['UserPass']);
$cookie_val = $UserName . "-" . $UserPass;
setcookie("muh", $cookie_val, time()+(30*24*60*60));
}
Kommentar