Update security.php
This commit is contained in:
parent
5f98357b49
commit
081bac3ea8
|
|
@ -18,3 +18,30 @@ if(!function_exists("check_token_abuse")) {
|
||||||
return $abuse;
|
return $abuse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!function_exists("make_random_id")) {
|
||||||
|
function make_random_id($length = 10) {
|
||||||
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
$charactersLength = strlen($characters);
|
||||||
|
$randomString = '';
|
||||||
|
for ($i = 0; $i < $length; $i++) {
|
||||||
|
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||||
|
}
|
||||||
|
return $randomString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists("set_session_token")) {
|
||||||
|
function set_session_token() {
|
||||||
|
$random_id = make_random_id(10);
|
||||||
|
$_SESSION['random_id'] = $random_id;
|
||||||
|
|
||||||
|
return $random_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists("get_session_token")) {
|
||||||
|
function get_session_token() {
|
||||||
|
return $_SESSION['random_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user