forked from cfuchs981/truhack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusercheck.php
More file actions
31 lines (25 loc) · 935 Bytes
/
Copy pathusercheck.php
File metadata and controls
31 lines (25 loc) · 935 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
<?php
$email = $_POST['email'];
$password = $_POST['password'];
try {
$conn = new PDO("mysql:host=mysql.truman.edu;dbname=cef6418CS315", "cef6418", "ohbiethe");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT *
FROM studentHack
WHERE email = :email AND password = :password");
$stmt->bindParam(':email', $email);
$stmt->bindParam(':password', $password);
$stmt->execute();
$count = mysql_num_rows($stmt);
if($count > 1){
header("Location: main.php");
}
}
catch(PDOException $e)
{
echo "Error: " . $e->getMessage();
}
// end the DB connection.
$conn = null;
header("Location: register.php");
?>