creacookie.php
Código PHP:
<?php
session_start();
setcookie("prueba", "hola" , time()+(60*60*24));
?>
Código PHP:
<?php
session_start();
setcookie("prueba","",time()-3600);
session_destroy();
?>
index.php
Código PHP:
<?php
session_start();
error_reporting(0);
(...)
if ($_POST["remember"]=="1"){
//making a random number for cookie
mt_srand (time());
$random_number = mt_rand(1000000,999999999);
$ssql = "update users set cookie=" . $random_number . " where id_user=" . $user_found->id_user;
mysql_query($ssql);
//Putting cookies at user PC (cookies valid for one year)
setcookie("id_user", $user_found->id_user , time()+(60*60*24*365));
setcookie("random_marc_cookie", $random_number, time()+(60*60*24*365));
}
echo "Wellcome <b>" . $user_found->user . "</b><br>";
echo "<a href=\"includes/logout.php\">logout</a>";
(...)
Código PHP:
<?php
session_start();
setcookie("id_user","",time()-3600);
setcookie("random_marc_cookie","",time()-3600);
session_destroy();
header ("Location: http://www.rocaynieve.com/privado/jason/");
?>
Muchas gracias.