No Unix timestamp update after reset
Closed this issue · 2 comments
AbgehobenSB commented
Describe the bug
after the HWID had a reset. the current timestamp should inserted into the last_reset row. but it just doesn't insert the current timestamp.
To Reproduce
Steps to reproduce the behavior:
- Go to the HWID Reset page
- Click on Reset HWID
- Look in your Database
- you will see the timestamp is still 0 but it should be 1644681443
Expected behavior
after the HWID reset you shouldn't be able to reset it once again.
it is just setting the hwid to NULL again.
AbgehobenSB commented
Fix down below
if (isset($_POST['reset_hwid'])) {
$time = time();
$sql = "SELECT * FROM users WHERE uid = '$uid'";
$result = mysqli_query($mysqli, $sql);
$row = mysqli_fetch_assoc($result);
$last_reset = $row['last_reset'];
if ($time - $last_reset < 172800) {
echo '<div class="alert alert-danger" role="alert">
<strong>Error!</strong>';
$time = 172800 - ($time - $last_reset);
$days = floor($time / 86400);
$hours = floor(($time % 86400) / 3600);
$minutes = floor(($time % 3600) / 60);
$seconds = floor($time % 60);
echo ' You can only reset your hwid once every 48 hours.
You have ' . $days . ' days, ' . $hours . ' hours, ' . $minutes . ' minutes, and ' . $seconds . ' seconds left.';
echo '</div>';
} else {
$time = time();
$sql = "UPDATE users SET hwid = NULL WHERE uid = '$uid'";
$sql2 = "UPDATE users SET last_reset = '$time' WHERE uid = '$uid'";
$result = mysqli_query($mysqli, $sql);
$result = mysqli_query($mysqli, $sql2);
Util::redirect('/');
mysqli_query($mysqli, $sql);
echo '<div class="alert alert-success" role="alert">
<strong>Success!</strong> Your HWID has been reset.
</div>';
}
}
NotClynt commented
Done