-
Notifications
You must be signed in to change notification settings - Fork 0
/
logon.php
54 lines (50 loc) · 1.71 KB
/
logon.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
<?php
require_once ("Includes/session.php");
require_once ("Includes/simplecms-config.php");
require_once ("Includes/connectDB.php");
include ("Includes/header.php");
if (isset($_POST['submit']))
{
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT id, username FROM users WHERE username = ? AND password = SHA(?) LIMIT 1";
$statement = $databaseConnection->prepare($query);
$statement->bind_param('ss', $username, $password);
$statement->execute();
$statement->store_result();
if ($statement->num_rows == 1)
{
$statement->bind_result($_SESSION['userid'], $_SESSION['username']);
$statement->fetch();
header ("Location: index.php");
}
else
{
echo "Username/password combination is incorrect.";
}
}
?>
<div id="main">
<h2>Log on</h2>
<form action="logon.php" method="post">
<fieldset>
<legend>Log on</legend>
<ol>
<li>
<label for="username">Username:</label>
<input type="text" name="username" value="" id="username" />
</li>
<li>
<label for="password">Password:</label>
<input type="password" name="password" value="" id="password" />
</li>
</ol>
<input type="submit" name="submit" value="Submit" />
<p>
<a href="index.php">Cancel</a>
</p>
</fieldset>
</form>
</div>
</div> <!-- End of outer-wrapper which opens in header.php -->
<?php include ("Includes/footer.php"); ?>