note 33602 rejected from function.setcookie by alindeman

From: Date: Tue, 01 Jul 2003 18:32:32 +0000
Subject: note 33602 rejected from function.setcookie by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-51303@lists.php.net to get a copy of this message
Note Submitter: mars@marsweb.ru ---- I note that using cookies together with sessions (session_start(), $_SESSION) is unavailable. I tryed to make this (it was nessary for one project): <code> function auth() { global $_POST,$cl_login,$cl_password; session_start(); if($_POST['submit'] == 1) { if(($cl_login == $_POST['login']) && ($cl_password == $_POST['password'])) { $_SESSION['valid_user'] = $cl_login; setcookie ("login_client", md5($cl_login.$cl_password),time()+2678400); } else { session_destroy(); header("Location: /clients/?login_error"); exit; } } else { if($_COOKIE['login_client'] != md5($cl_login.$cl_password)) { setcookie ("login_client", "",time()-3600); header("Location: /clients/?login_error"); exit; } elseif($_SESSION['valid_user'] != $cl_login) { session_destroy(); header("Location: /clients/?login_error"); exit; } } } </code> It doesn't work (Server send header: BAD REQUEST). Why? (Sorry for bad English. Marsel)

« previous php.notes (#51303) next »