-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.php
81 lines (72 loc) · 1.7 KB
/
log.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
<?php
session_start();
?>
<html>
<head>
<title>LOGIN FORM</title>
</head>
<script>
function Validate(){
var email=document.getElementById("email").value;
var pwd=document.getElementById("pwd").value;
if(email==""){
alert("Can't leave E-mail field empty");
return false;
}
/* else{
var filter=/^([a-zA-Z0-9\.\-])+@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]){2,4}+$/;
if(!filter.test(email)){
alert("Enter a valid E-mail Id");
return false;
}
} */
if(pwd==""){
alert("Can't leave password field empty");
}
}
</script>
</head>
<body>
<h1>LOGIN HERE</h1>
<?php
include("connect.php");
if(isset($_POST['Login'])){
$email=$_POST['email'];
$pwd=($_POST['pwd']);
//$query="select *from register where Email='$email' and Password='$pwd'";
$result=mysqli_query($con,"select *from reg where Email='$email' and Password='$pwd'");
echo mysqli_num_rows($result);
if(mysqli_num_rows($result)==1){
$row=mysqli_fetch_assoc($result);
/* if($row['$status']==1){ */
$_SESSION['loggedin']=$row['Id'];
header('Location:http://localhost:8080/login_home.php');
}
/* else{
echo "Please activate your account";
} */
else {
echo "Wrong credentials";
}
}
?>
<form action="" method="POST" onsubmit="return Validate()">
<table>
<tr>
<td>E-mail</td>
<td><input type="email" name="email" id="email" placeholder="--email--"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="pwd" id="pwd"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Login" name="Login">
<a href="forgot_pwd.php">Forgot Password ?</a>
</td>
</tr>
</table>
</form>
</body>
</html>