-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathusercheck.php
More file actions
63 lines (51 loc) · 1.81 KB
/
Copy pathusercheck.php
File metadata and controls
63 lines (51 loc) · 1.81 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
60
61
62
63
<?php
session_start();
$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();
$id = 0;
while( $row = $stmt->Fetch(PDO::FETCH_ASSOC))
{
$id = $row['id'];
$fullname = $row['name'];
$major = $row['major'];
$minor = $row['minor'];
$datee = $row['graduation'];
$A = $row['Acred'];
$B = $row['Bcred'];
$C = $row['Ccred'];
$G = $row['general'];
$S = $row['Scred'];
}
if($id){
$_SESSION['fullname'] = $fullname;
$_SESSION['email'] = $email;
$_SESSION['major'] = $major;
$_SESSION['minor'] = $minor;
$_SESSION['datee'] = $datee;
$_SESSION['A'] = $A;
$_SESSION['B'] = $B;
$_SESSION['C'] = $C;
$_SESSION['G'] = $G;
$_SESSION['S'] = $S;
header("Location: main.php");
}
else {
header("Location: register.php");
}
}
catch(PDOException $e)
{
echo "Error: " . $e->getMessage();
}
// end the DB connection.
$conn = null;
?>