· 9 years ago · Aug 30, 2016, 08:16 PM
1$secret_key = "key";
2
3function isAuth ($username, $hash) {
4 global $secret_key;
5
6 $date = date("Y-m-d");
7
8 $ver_string = hmac('md5', $date . $username, $secret_key);
9
10 return $ver_string == $hash;
11}
12
13function getHash ($username) {
14 global $secret_key;
15
16 $date = date("Y-m-d");
17
18 return hmac('md5', $date . $username, $secret_key);
19}