-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththisphpscript.php
More file actions
66 lines (44 loc) · 1.61 KB
/
thisphpscript.php
File metadata and controls
66 lines (44 loc) · 1.61 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
64
65
66
<?php
// $hostname = "sql2.njit.edu";
// $username = "am484";
// $password = "vd0HngQMx";
// $project = "am484";
// $db_connect = mysql_connect($hostname,$username,$password);
// if (!$db_connect) {
// die ("Unable to connect to database." . mysql_error());
// } else {
// print "Successfully connected to db." . "<br>";
// }
// $db_select = mysql_select_db($project);
// $username = $_POST['username'];
// $username = mysql_real_escape_string($username);
// $password = $_POST['password'];
// $password = mysql_real_escape_string($password);
// $sql = "select [chat_content] from registered_student where username = '$username' and password = '$password'";
// $result = mysql_query($sql);
$hostname = "localhost";
$username = "wordpressuser";
$password = "adrian11";
$project = "am484";
$db_connect = mysql_connect($hostname,$username,$password);
$db_select = mysql_select_db($project);
if (!$db_connect) {
die ("Unable to connect to database." . mysql_error());
} else {
print "Successfully connected to db." . "<br>";
}
$db_select = mysql_select_db($project);
$email = $_POST['email'];
$email = mysql_real_escape_string($email);
$password = $_POST['password'];
$password = mysql_real_escape_string($password);
// $newpass = md5($password);
$sql = "select * from cafeteria where employeeEmail = '$email' and employeeLocation ='LA' ";
$result = mysql_query($sql);
if (mysql_num_rows($result) != 0) {
header('Location: weekly-menu');
} else {
header('Location: login');
echo "Please try again! Invalid login.";
}
?>