{"action":"closed","issue":{"url":"https://api.github.com/repos/PHPAuth/PHPAuth/issues/166","labels_url":"https://api.github.com/repos/PHPAuth/PHPAuth/issues/166/labels{/name}","comments_url":"https://api.github.com/repos/PHPAuth/PHPAuth/issues/166/comments","events_url":"https://api.github.com/repos/PHPAuth/PHPAuth/issues/166/events","html_url":"https://github.com/PHPAuth/PHPAuth/issues/166","id":123261912,"number":166,"title":"User sessions always last one month","user":{"login":"adamcbuckley","id":6066058,"avatar_url":"https://avatars.githubusercontent.com/u/6066058?v=3","gravatar_id":"","url":"https://api.github.com/users/adamcbuckley","html_url":"https://github.com/adamcbuckley","followers_url":"https://api.github.com/users/adamcbuckley/followers","following_url":"https://api.github.com/users/adamcbuckley/following{/other_user}","gists_url":"https://api.github.com/users/adamcbuckley/gists{/gist_id}","starred_url":"https://api.github.com/users/adamcbuckley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamcbuckley/subscriptions","organizations_url":"https://api.github.com/users/adamcbuckley/orgs","repos_url":"https://api.github.com/users/adamcbuckley/repos","events_url":"https://api.github.com/users/adamcbuckley/events{/privacy}","received_events_url":"https://api.github.com/users/adamcbuckley/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PHPAuth/PHPAuth/labels/pending","name":"pending","color":"009800"}],"state":"closed","locked":false,"assignee":{"login":"cuonic","id":821228,"avatar_url":"https://avatars.githubusercontent.com/u/821228?v=3","gravatar_id":"","url":"https://api.github.com/users/cuonic","html_url":"https://github.com/cuonic","followers_url":"https://api.github.com/users/cuonic/followers","following_url":"https://api.github.com/users/cuonic/following{/other_user}","gists_url":"https://api.github.com/users/cuonic/gists{/gist_id}","starred_url":"https://api.github.com/users/cuonic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuonic/subscriptions","organizations_url":"https://api.github.com/users/cuonic/orgs","repos_url":"https://api.github.com/users/cuonic/repos","events_url":"https://api.github.com/users/cuonic/events{/privacy}","received_events_url":"https://api.github.com/users/cuonic/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-12-21T11:41:33Z","updated_at":"2015-12-22T16:55:23Z","closed_at":"2015-12-22T16:55:23Z","body":"The `addSession` function of `auth.class.php` is as follows:\r\n\r\n```php\r\nif($remember == true) {\r\n\t$data['expire'] = date(\"Y-m-d H:i:s\", strtotime($this->config->cookie_remember));\r\n\t$data['expiretime'] = strtotime($data['expire']);\r\n} else {\r\n\t$data['expire'] = date(\"Y-m-d H:i:s\", strtotime($this->config->cookie_remember));\r\n\t$data['expiretime'] = 0;\r\n}\r\n```\r\n\r\nI think this code is wrong.  `cookie_remember` is set to `+1 month` by default.  The code above would cause a user session to to last for 1 month regardless of whether 'remember me' is checked or not.  I think the code should be as follows:\r\n\r\n```php\r\nif($remember == true) {\r\n\t$data['expire'] = date(\"Y-m-d H:i:s\", strtotime($this->config->cookie_remember));\r\n\t$data['expiretime'] = strtotime($data['expire']);\r\n} else {\r\n\t$data['expire'] = date(\"Y-m-d H:i:s\", strtotime($this->config->cookie_forget));\r\n\t$data['expiretime'] = 0;\r\n}\r\n```\r\n\r\nNote that in the else block we're setting the expire date to now + `cookie_forget` (which defaults to `+30 minutes`)."}}