Added login function

This commit is contained in:
2017-09-05 13:36:19 +07:00
parent 47d455063f
commit f8f4398007
5 changed files with 102 additions and 7 deletions

30
Core/Hash.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
namespace Core;
class Hash
{
public static function make($string, $salt = '')
{
// return hash('sha256', $string . $salt);
// return password_hash($string, PASSWORD_BCRYPT);
return crypt($string, $salt);
}
public static function salt()
{
// return mcrypt_create_iv($length);
return uniqid(mt_rand());
}
public static function unique()
{
return self::make(uniqid());
}
public static function compare($string, $salt, $hash)
{
// return (Hash::make($string, $salt) === $hash) ? true : false;
// return password_verify($string, $hash);
return hash_equals($hash, Hash::make($string, $salt));
}
}

View File

@@ -8,9 +8,6 @@ class Redirect
if($url)
{
$url = htmlspecialchars($url);
$url = rtrim($url, '/');
$url = substr_replace($url, '', 0, 1);
var_dump($url);
header("Location:$url");
return true;