.01 .02 .03 .04 | <?php setcookie('nom_cookie', $pseudo . '#' . $password, ( time() + 86400 * 90 )); ?> |
.01 .02 .03 .04 .05 .06 .07 .08 .09 .10 .11 .12 .13 .14 .15 .16 .17 | <?php session_start(); function autolog() { if(!isset($_SESSION['cle_client']) && isset($_COOKIE['nom_cookie'])) { // on stoke la page en cours $page = $_SERVER['PHP_SELF']; // on fait la redirection vers le fichier de log header('location: log.php?redirect=' . $page); exit; } } ?> |
.01 .02 .03 .04 .05 .06 .07 .08 .09 .10 .11 .12 .13 .14 .15 .16 .17 .18 .19 .20 .21 .22 .23 .24 .25 .26 .27 .28 .29 .30 .31 .32 .33 .34 .35 .36 .37 .38 .39 | <?php session_start(); // on va aller chercher le speudo dans le cookie if(isset($_COOKIE['nom_cookie'])) { $tc = explode('#', $_COOKIE['nom_cookie']); $pseudo=isset($tc[0]) ? ( get_magic_quotes_gpc() ? $tc[0] : $tc[0]) : ''; $password = isset($tc[1]) ? $tc[1] : ''; $cookie = 1; } // on va cherche le speudo dans la table et les autres champs $result = mysql_query("SELECT id, pseudo, password FROM table WHERE pseudo = '$pseudo' AND password = '$password'"); $row = mysql_fetch_array ($result); if(mysql_num_rows($result) == 1) { // on remet le speudo dans la session $_SESSION['pseudo'] = get_magic_quotes_gpc() ? $pseudo : stripslashes($pseudo); $_SESSION['cle_client'] = $row['id']; } // et on fait la redirection if($cookie) { if(isset($_GET['redirect']) && !empty($_GET['redirect'])) header('location: ' . $_GET['redirect']); else header('location: index.php'); } else header('location: autre_url.php'); } } ?> |