This repository has been archived by the owner on Dec 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
68 lines (56 loc) · 1.65 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
$error = NULL;
if(isset($_POST['submit'])){
//Connect to database
$mysqli = NEW MySQLI('localhost','thahewherewt','','thewherewhat2021');
//Get from data
$u = $mysqli->real_escape_string($_POST['u']);
$p = $mysqli->real_escape_string($_POST['p']);
$p = md5($p);
//Querry database
$resultSet = $mysqli->query("SELECT * FROM acounts WHERE username = '$u' AND pasword = '$p' LIMIT 1");
if($resultSet->num_rows !=0){
//Process Login
$row = $resultSet->fetch_assoc();
$verified = $row['verified'];
$email = $row['email'];
$date = $row['created'];
$date = strtotime($date);
$date = date('M d Y',$date);
if($verified == 1){
//Comtinue processing
echo "Your account is verified and you have been logged in";
}else{
$error = "Please verify your acount to preceed. An email was sent to $email on $date";
}
}else{
//Invalid credentials
$error = "The username or password you entered is incorrect";
}
//hi
}
?>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form metho="POST" action="">
<table border="0" align="center" cellpadding="5">
<tr>
<td align="right">Username:</td>
<td><input type="TEXT" name="u" required/></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input type="PASSWORD" name="p" required/></td>
</tr>
<td colspan="2" align="center"><input type="SUBMIT" name="submit" value="Login" required/></td>
</tr>
</table>
</form>
<center>
<?php echo $error; ?>
</center>
</body>
</html>