-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.php
More file actions
37 lines (28 loc) · 683 Bytes
/
auth.php
File metadata and controls
37 lines (28 loc) · 683 Bytes
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
<?php
require 'PDOMySQL.php';
$PDOMySQL = new PDOMySQL();
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
if($username && $password)
{
$auth = FALSE;
$rows = $PDOMySQL->queryList('SELECT * FROM eprojese2018db.users ORDER BY userid');
foreach ($rows as $row) {
if($username == $row[1] && $password == $row[2]) {
$auth = TRUE;
}
}
if($auth == TRUE)
{
$_SESSION['username'] = $_POST['username'];
header("Location: account.php");
die();
}
else
{
echo "<p>OOPS! Your username and password combination doews not exist!</p>";
echo "<a href='login.php'>Back to Login</a>";
}
}
?>