-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
executable file
·40 lines (39 loc) · 985 Bytes
/
login.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require('lib/misc.inc.php');
require('lib/classes.class.php');
if($_POST['username'] == '' || $_POST['password'] == '') {
die("Sorry, it seems that you forgot to fill out all the fields.");
} else {
$user = new User();
$status = $user->login($_POST['username'], $_POST['password']);
switch($status) {
case -1:
die("Wrong password!");
case -2:
die("Username not found");
break;
case -3:
die("Database error, please try again");
break;
case 0:
if($_POST['remember'] == 'on') {
setcookie('remember', $_SESSION['uid'].'.'.md5("s3cr3t".$_SESSION['uid']), time()*60*60*24*30);
}
break;
default:
die("There was some error, please try again");
break;
}
}
if(!isset($_GET['back'])) {
header('Location: ./');
die();
} else {
?>
<html>
<body onload="history.go(-1)">
</body>
</html>
<?php
}
?>