Hej har et underligt problem.
mit logud script fejler i firefox..
har testet i chrome og safari og der virker det fint..
- class user {
-
- private $login_username = null;
- private $login_password = null;
- private $singedIn = false;
- private $useCookie = true;
- private $cookie_name = "";
- private $cookie_time = '2592000'; //30 days in sec
- private $browser = null;
- public $data = null;
-
- public function __construct() {
- $this->browser = new browser();
- $this->data["user_id"] = 0; // Anonymous
- $this->cookie_name = "auto_signin";
- $this->checkUserState();
- }
-
- private function readCookie() {
- if (isset($_COOKIE[$this->cookie_name])) {
- $exp = "";
- $username = "";
- $password = "";
- parse_str($_COOKIE[$this->cookie_name]);
- if (strlen($username . $password) > 0) {
- $this->login($username, $password, true);
- }
- }
- }
-
- private function writeCookie() {
- setcookie($this->cookie_name, 'username=' . $this->login_username . '&password=' . $this->login_password, time() + $this->cookie_time);
- }
-
- private function deleteCookie() {
- //FIXME: firefox fail?
- setcookie($this->cookie_name, "exp=true", time() - 3600);
- unset($_COOKIE[$this->cookie_name]);
- }
-
- public function isSingedIn() {
- return $this->singedIn;
- }
-
- private function checkUserState() {
- if (!isset($_SESSION["login"]["user_id"])) {
- $this->readCookie();
- } else {
- $this->data = $_SESSION["login"];
- $this->singedIn = true;
- }
- }
-
- public function logout() {
- $_SESSION["login"] = null;
- unset($_SESSION["login"]);
-
- $this->deleteCookie();
- $this->data = null;
- $this->singedIn = false;
- }
-
- //resten af klassen klippet væk
- }
nogen bud?
Indlæg senest redigeret d. 03.08.2011 16:13 af Bruger #3427