Add last_login

This commit is contained in:
Jay Trees 2022-01-18 12:14:37 +01:00
parent 24f223d928
commit 6c32ce3415

View file

@ -11,10 +11,18 @@ use wishthis\Page;
$page = new page(__FILE__, 'Login'); $page = new page(__FILE__, 'Login');
if (isset($_POST['email'], $_POST['password'])) { if (isset($_POST['email'], $_POST['password'])) {
$email = $_POST['email'];
$password = sha1($_POST['password']);
$database->query('UPDATE `users`
SET `last_login` = NOW()
WHERE `email` = "' . $email . '"
AND `password` = "' . $password . '"
;');
$user = $database->query( $user = $database->query(
'SELECT * FROM `users` 'SELECT * FROM `users`
WHERE `email` = "' . $_POST['email'] . '" WHERE `email` = "' . $email . '"
AND `password` = "' . sha1($_POST['password']) . '";' AND `password` = "' . $password . '";'
)->fetch(); )->fetch();
if (false === $user) { if (false === $user) {