/** * Change the Framework Language. */ public function change($language) { // Only set language if it's in the Languages array if (preg_match('/[a-z]/', $language) && in_array($language, CoreLanguage::$codes)) { Session::set('language', ucfirst($language)); // Store the current Language into Cookie. Cookie::set(PREFIX . 'language', $language); } Url::redirect(); }
public function navigationReload() { Cookie::set('navigation', $_POST['status']); }
/** * Creates a new cookie for the provided username and sets cookie * @param string $username */ private function newCookie($username, $rememberme) { $hash = md5(microtime()); // unique cookie hash // Fetch User ID : $queryUid = $this->db->select("SELECT userID FROM " . PREFIX . "users WHERE username=:username", array(':username' => $username)); $uid = $queryUid[0]->userID; // Delete all previous cookies : $this->db->delete(PREFIX . 'sessions', array('username' => $username)); $ip = $_SERVER['REMOTE_ADDR']; if ($rememberme == "true") { // User wants to be remembered for a while $expiredate = date("Y-m-d H:i:s", strtotime(SESSION_DURATION_RM)); } else { $expiredate = date("Y-m-d H:i:s", strtotime(SESSION_DURATION)); } $expiretime = strtotime($expiredate); $this->db->insert(PREFIX . 'sessions', array('uid' => $uid, 'username' => $username, 'hash' => $hash, 'expiredate' => $expiredate, 'ip' => $ip)); // Check to see if user checked the remember me box Cookie::set('auth_cookie', $hash, $expiretime, "/", FALSE); }
/** * Creates a new session for the provided username and sets cookie * @param string $username */ private function newSession($username) { $hash = md5(microtime()); // unique session hash // Fetch User ID : $queryUid = $this->db->select("SELECT id FROM users WHERE username=:username", array(':username' => $username)); $uid = $queryUid[0]->id; // Delete all previous sessions : $this->db->delete('sessions', array('username' => $username)); $ip = $_SERVER['REMOTE_ADDR']; $expiredate = date("Y-m-d H:i:s", strtotime(SESSION_DURATION)); $expiretime = strtotime($expiredate); $this->db->insert('sessions', array('uid' => $uid, 'username' => $username, 'hash' => $hash, 'expiredate' => $expiredate, 'ip' => $ip)); Cookie::set('auth_session', $hash, $expiretime, "/", FALSE); }