-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
153 lines (126 loc) · 3.02 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
session_start();
include ("dbconfig.php");
include ("functions.php");
if($_SERVER['REQUEST_METHOD']=="POST"){
//something was posted
$email= $_POST['email'];
$password = $_POST['password'];
if(!empty($email) && !empty($password) && !is_numeric($email)){
//read from db
$query = "select * from users where email = '$email' limit 1;";
$result = mysqli_query($con, $query);
if($result){
if($result && mysqli_num_rows($result) > 0){
$user_data = mysqli_fetch_assoc($result);
if($user_data['password'] === $password){
$_SESSION['email'] = $user_data['email'];
//redir to index
header("Location: personalpage.php");
die;
}
}
}else{
echo "Wrong username or password";
}
}
}
?>
<html>
<head>
</head>
<body
bgcolor = "#0e0e0e">
<!-- LOGO BANNER -->
<center>
<div>
<table
width = "500"
cellpadding = "0"
cellspacing = "0"
border = "0">
<tr>
<td>
<a href = "homepage.php">
<img
src = https://magic-spells-and-potions.com/images/magic-images/pentacles//purple-pentagram-circle.gif>
</a>
</td>
<td
align = "TOP"
valign = "CENTER">
<a href = "homepage.php">
<img
src = "/astrosite/astrobanner.png"
width = "400">
</a>
</td>
</tr>
</table>
<div>
</center>
<!-- Form for login-->
<center>
<div>
<table>
<form action="" method="post">
<tr>
<td
align = "CENTER"
valign = "BOTTOM">
<!-- email input-->
<tr>
<td>
<label for = "email">
<font color = "#FFFFFF">
Email:
</font>
</label>
</td>
</tr>
<tr>
<td>
<input type = "email" id = "email" name = "email">
</td>
</tr>
</td>
</tr>
<tr>
<td
align = "CENTER"
valign = "BOTTOM">
<!-- password input-->
<tr>
<td>
<label for = "password">
<font color = "#FFFFFF">
Password:
</font>
</label>
</td>
</tr>
<tr>
<td>
<input type = "password" id = "password" name = "password">
</td>
</tr>
</td>
</tr>
<!-- login -->
<tr>
<td
align = "CENTER"
valign = "BOTTOM">
<button type="submit" value="Login">Login</button>
<!-- end of form-->
</form>
<button>
<a href = "register.php">click to Register</a>
</button>
</td>
</tr>
</table>
</div>
</center>
</body>
</html>