Added login function
This commit is contained in:
30
Core/Hash.php
Normal file
30
Core/Hash.php
Normal 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));
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user