Jump to content
php.lv forumi

cookies problemiņa :)


dAivEd

Recommended Posts

Tatad rekur mans kods:

if(isset($_COOKIE['id']) and (isset($_COOKIE['password']))) {

$check_id = $_COOKIE['id'];
$check_pw = $_COOKIE['password'];

$query = "SELECT * FROM users WHERE id = '$check_id' and password = '$check_pw'
";
$result = mysql_query("$query") or die(mysql_error());

while($row = mysql_fetch_array($result)){
$check_real_pw = $row["password"];
$check_real_id = $row["id"];
}

if($check_id == "$check_real_id" AND $check_pw == "$check_real_pw"){
$check_id == $_SESSION['id'];
}
}

Jad taisu:

 

echo "
if($check_id == $check_real_id AND $check_pw == $check_real_pw){";

Raada: if(2 == 2 AND fff000d90420ea6417cf33995aefaa135 == fff000d90420ea6417cf33995aefaa135){

Bet cookies nestrada t.b. $_SESSION['id'] ir tukš

Kur vaina ?

Link to comment
Share on other sites

Tāpēc, ka šeit tu salīdzini - $check_id == $_SESSION['id'];

Un ja arī piešķirtu, tad piešķirtu vērtību $check_id, nevis $_SESSION

bljin pareiz !!! Un man vajag arī piešķirt vertību $check_id, tagad noņemu vienu "=", un viss strāda, ak tā neuzmanība ;(

Edited by dAivEd
Link to comment
Share on other sites

×
×
  • Create New...