...
Luodaan käyttäjälle istunto, jonka perusteella hänet voidaan myöhemmin yksilöidä. $_
Code Block |
---|
// create session cookie session_start(); if (!isset($_SESSION['session']) || !isset($_SESSION['token'])) { // this variable is to make sure we get post from correct form // we will add it to every form as a hidden field $_SESSION['token'] = uniqid(md5(microtime()), true); // this is for making it harder to hijack one's session cookie // save ip and user agent which created the session $_SESSION['session'] = md5($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']); } |
...