-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
116 lines (90 loc) · 2.89 KB
/
index.php
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>User Login</title>
<link rel="stylesheet" type="text/css" href="stylesheet/userlogin.css"/>
<script type="text/javascript" src="scripts/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="scripts/effects.js"></script>
</head>
<body>
<header>
<div class="HeaderTitle">
<img src="images/logo.png">
</div>
<nav>
A System to Prescribe the Doctors for Given Symptoms
</nav>
</header>
<hr>
<div class="notify">
<div class="notifytext"></div>
<div class="cross">X</div>
</div>
<?php
require 'scripts/connect.inc.php';
require 'scripts/core.inc.php';
if(isset($_POST['username']) && isset($_POST['password'])){
if(!empty($_POST['username']) && !empty($_POST['username'])){
$username = $_POST['username'];
$password = $_POST['password'];
$password_hash = md5($password);
$query = "SELECT `id` FROM `signup` WHERE `username`='".mysql_real_escape_string($username)."' AND `password`='".mysql_real_escape_string($password_hash)."'";
if($query_run = mysql_query($query)){
$query_num_rows = mysql_num_rows($query_run);
if($query_num_rows == 0)
{
echo'<script type="text/javascript">
$(".notify").slideDown(1000);
$(".cross").click(function(e) {
$(".notify").slideUp(1000);
});
$(".notify > .notifytext").html("Invalid Username/Password Combination.");
</script>';
}
else if($query_num_rows == 1) {
$user_id = mysql_result($query_run,0,'id');
$_SESSION['user_id'] = $user_id;
header('Location: home.php');
}
}
}
else {
echo'<script type="text/javascript">
$(".notify").slideDown(1000);
$(".cross").click(function(e) {
$(".notify").slideUp(1000);
});
$(".notify > .notifytext").html(" Please Fill all the fields.");
</script>';
}
}
?>
<form action="<?php echo $current_file; ?>" method="POST">
<table border="0">
<tr>
<td>Username</td>
<td><input type="text" name="username" class="FormElement" maxlength="45" required></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" class="FormElement" maxlength="45" required></td>
</tr>
<tr>
<td>
</td>
<td>
<input type="submit" value="Log IN" class="button">
</td>
</tr>
</table>
</form>
<div class="WantSignUp"><a href="forgot.php">forgot password</a> ?
<br><br>
Click to <a href="signup.php">Sign Up</a>
<br>
<br>
Go to <a href="adminlogin.php">Admin Panel</a>
</div>
</body>
</html>