-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
59 lines (44 loc) · 1.23 KB
/
Copy pathindex.php
File metadata and controls
59 lines (44 loc) · 1.23 KB
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
<?php
session_start();
if (isset ($_POST['username']) && isset ($_POST['password']) ) {
require 'databaseConnection.php';
$sql = "SELECT * FROM userAccounts
WHERE username = :username
AND password = :password";
$stmt = $conn -> prepare($sql);
$stmt -> execute(array(":username" => $_POST['username'], ":password" => hash("sha1", $_POST['password'])));
$record = $stmt -> fetch();
if (empty($record)){
echo "Wrong username/password!";
}
else {
$_SESSION['username'] = $record['username'];
$_SESSION['name'] = $record['firstname'] . " " . $record['lastname'];
header("Location: movieSearch.php");
}
}
include 'topLayout.php';
?>
<div class="center">
<table id="login"><form method="post">
<tr><td colspan="2">Welcome!</td></tr>
<tr>
<td>Username</td>
<td><input size="20" type="text" name="username" value=""></td>
</tr>
<tr>
<td>Password</td>
<td><input size="20" type="password" name="password" value=""></td>
</tr>
<tr>
<td colspan="2"><a href="">Register</a></td>
</tr>
<tr>
<td><input type="submit" value="Enter"></td>
<td><input type="reset" value="Clear"></td>
</tr>
</form></table>
</div>
<?php
include 'bottomLayout.php';
?>