Fix #6 - compatibility issues

This commit is contained in:
Vojtěch Sajdl 2018-01-13 16:51:17 +01:00
parent 195d91c28e
commit ffd2b58f0c
No known key found for this signature in database
GPG Key ID: 5D4EB1361A272390
3 changed files with 7 additions and 6 deletions

View File

@ -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);

View File

@ -251,7 +251,7 @@ class User
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, "/");
}
@ -283,7 +283,7 @@ class User
$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
@ -482,7 +482,7 @@ class User
$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;
@ -507,7 +507,7 @@ class User
$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";

View File

@ -83,7 +83,8 @@ if(isset($_POST['server']) && empty($message))
$array = explode(";", $sql);
foreach ($array as $value) {
if (empty(trim($value)))
$val = trim($value);
if (empty($val))
{
continue;
}