passwort ok

This commit is contained in:
2023-02-10 01:15:55 +01:00
parent e3e99e67f9
commit 26a4dc11c7
6 changed files with 116 additions and 15 deletions

View File

@ -25,6 +25,8 @@ if($_SERVER["REQUEST_METHOD"] != "POST")
return;
}
//var_dump($data);
// CHECKING EMPTY FIELDS
if(
!isset($data->pwtoken)
@ -48,6 +50,36 @@ try
if($stmt->rowCount())
{
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$expire = new DateTime($row['pwt_time']);
$expire->add(new DateInterval('PT' . $G_pwtoken_time_expire . 'M'));
// var_dump($expire);
$now = new DateTime();
// var_dump($now);
if($now > $expire)
{
$null_var = null;
$sql = "UPDATE dogs SET pwtoken=?, pwt_time=? WHERE id=?";
$conn->prepare($sql)->execute([$null_var, $null_var, $row['id']]);
$returnData = new CMsg(
0,
200,
'Passwordtoken: '. $pwtoken . ' time expired!',
null,
$row
);
}
else
{
$returnData = new CMsg(
1,
200,
'Passwordtoken: '. $pwtoken . ' valid!',
null,
$row
);
}
}
else
{