Skip to content

Commit

Permalink
Fix #6 - compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Pryx committed Jan 13, 2018
1 parent 195d91c commit ffd2b58
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion classes/token.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Token
* @param timestamp $expire expiration time
* @return String token
*/
public static function new($id, $data, $expire)
public static function add($id, $data, $expire)
{
global $mysqli;
$salt = uniqid(mt_rand(), true);
Expand Down
8 changes: 4 additions & 4 deletions classes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public static function login()
if (isset($_POST['remember'])&&$_POST['remember'])
{
$year = strtotime('+356 days', time());
$token = Token::new($id, 'remember', $year);
$token = Token::add($id, 'remember', $year);
setcookie('token', $token, $year, "/");
setcookie('user', $id, $year, "/");
}
Expand Down Expand Up @@ -283,7 +283,7 @@ public static function restore_session()
$year = strtotime('+356 days', time());
unset($_COOKIE['token']);
$_SESSION['user'] = $id;
$token = Token::new($id, 'remember', $year);
$token = Token::add($id, 'remember', $year);
setcookie('token', $token, $year);
}
else
Expand Down Expand Up @@ -482,7 +482,7 @@ public static function password_link()
$id = $query->fetch_assoc()['id'];
$time = strtotime('+1 day', time());

$token = Token::new($id, 'passwd', $time);
$token = Token::add($id, 'passwd', $time);

$link = WEB_URL."/admin/?do=lost-password&id=$id&token=$token";
$to = $email;
Expand All @@ -507,7 +507,7 @@ public function email_link(){
$time = strtotime('+1 day', time());
$id = $this->id;

$token = Token::new($id, 'email;$email', $time);
$token = Token::add($id, 'email;$email', $time);


$link = WEB_URL."/admin/?do=change-email&id=$id&token=$token";
Expand Down
3 changes: 2 additions & 1 deletion install.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
$array = explode(";", $sql);

foreach ($array as $value) {
if (empty(trim($value)))
$val = trim($value);
if (empty($val))
{
continue;
}
Expand Down

0 comments on commit ffd2b58

Please sign in to comment.