Add last_login
This commit is contained in:
parent
24f223d928
commit
6c32ce3415
1 changed files with 10 additions and 2 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue