2014-08-18 23:57:20 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function reset_password(){
|
|
|
|
$email = filter_var($_GET["email"], FILTER_SANITIZE_EMAIL);
|
|
|
|
$user = filter_var($_GET["user"], FILTER_SANITIZE_STRING);
|
|
|
|
$key = filter_var($_GET["key"], FILTER_SANITIZE_STRING);
|
2014-09-03 18:27:01 +00:00
|
|
|
|
2014-08-18 23:57:20 +00:00
|
|
|
$target_id = WebUsers::getId($user);
|
|
|
|
$webUser = new WebUsers($target_id);
|
2014-09-03 18:27:01 +00:00
|
|
|
|
2014-08-18 23:57:20 +00:00
|
|
|
if( (WebUsers::getIdFromEmail($email) == $target_id) && (hash('sha512',$webUser->getHashedPass()) == $key) ){
|
|
|
|
//you are allowed on the page!
|
2014-09-03 18:27:01 +00:00
|
|
|
|
2014-08-18 23:57:20 +00:00
|
|
|
$GETString = "";
|
|
|
|
foreach($_GET as $key => $value){
|
|
|
|
$GETString = $GETString . $key . '=' . $value . "&";
|
2014-09-03 18:27:01 +00:00
|
|
|
}
|
2014-08-18 23:57:20 +00:00
|
|
|
if($GETString != ""){
|
|
|
|
$GETString = '?'.$GETString;
|
|
|
|
}
|
|
|
|
$pageElements['getstring'] = $GETString;
|
2014-09-03 18:27:01 +00:00
|
|
|
|
2014-08-18 23:57:20 +00:00
|
|
|
return $pageElements;
|
2014-09-03 18:27:01 +00:00
|
|
|
|
2014-08-18 23:57:20 +00:00
|
|
|
}else{
|
|
|
|
global $WEBPATH;
|
|
|
|
$_SESSION['error_code'] = "403";
|
2014-09-03 18:27:01 +00:00
|
|
|
header("Cache-Control: max-age=1");
|
2014-08-18 23:57:20 +00:00
|
|
|
header("Location: ".$WEBPATH."?page=error");
|
2014-09-03 18:27:01 +00:00
|
|
|
throw new SystemExit();
|
2014-08-18 23:57:20 +00:00
|
|
|
}
|
2014-09-03 18:27:01 +00:00
|
|
|
}
|