Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / web / public_php / ams / inc / reset_password.php
blobbfaed57aa7adee7dadc60ee705d95fabf06c5032
1 <?php
3 function reset_password(){
4 $email = filter_var($_GET["email"], FILTER_SANITIZE_EMAIL);
5 $user = filter_var($_GET["user"], FILTER_SANITIZE_STRING);
6 $key = filter_var($_GET["key"], FILTER_SANITIZE_STRING);
8 $target_id = WebUsers::getId($user);
9 $webUser = new WebUsers($target_id);
11 if( (WebUsers::getIdFromEmail($email) == $target_id) && (hash('sha512',$webUser->getHashedPass()) == $key) ){
12 //you are allowed on the page!
14 $GETString = "";
15 foreach($_GET as $key => $value){
16 $GETString = $GETString . $key . '=' . $value . "&";
18 if($GETString != ""){
19 $GETString = '?'.$GETString;
21 $pageElements['getstring'] = $GETString;
23 return $pageElements;
25 }else{
26 global $WEBPATH;
27 $_SESSION['error_code'] = "403";
28 header("Cache-Control: max-age=1");
29 header("Location: ".$WEBPATH."?page=error");
30 throw new SystemExit();