-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
85 lines (85 loc) · 1.95 KB
/
login.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
<?php
include("header2.php");
?>
<style type="text/css">
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
.container_main{
background: #34495e;
height: 91vh;
display: flex;
justify-content: center;
align-items: center;
}
.boxing{
background: #fff;
padding: 1.5em 2em;
box-shadow: 0 3px 7px rgba(0,0,0,.3);
border: 1px solid green;
border-radius: 10px;
}
.boxing h1{
text-decoration: underline red;
padding-bottom: .5em;
}
.btn{
border: 2px solid black;
border-radius: 5px;
box-shadow: 0 3px 7px rgba(0,0,0,.3);
background: #f2f2f2;
}
.btn:hover{
background: #000;
color: #fff;
}
.register{
float: right;
}
</style>
<?php
//session_start();
include("connection.php");
?>
<div class="container_main">
<div class="boxing">
<form method="POST">
<h1>Login</h1>
Email<br><input type="text" name="email" required><br><br>
Password<br><input type="password" name="password" required><br><br>
<input class="btn" type="submit" name="login">
</form>
<a href="signup.php" float="right" class="register">Signup</a><br>
<!--php file-->
<?php
if(isset($_POST['login']))
{
$useremail=$_POST['email'];
$userpass=$_POST['password'];
if($useremail!="" && $userpass!="")
{
$query="select * from signup where email='$useremail' && password='$userpass'";
$data=mysqli_query($connect,$query);
$count=mysqli_num_rows($data);
if($count>0)
{
$_SESSION['user_email']=$useremail;
/*echo $_SESSION['username'];*/
header('location:index2.php');
/*echo "<font color='green'>✔ </font>Successfully Logged in";*/
}
else
{
echo "<font color='red'>✘ </font>Invalid user or password<br>
<a href='forgotpass.php'>Forgot Password?</a>";
}
}
/*else{
echo "<font color='red'>✘ </font>All fields are required!";
}*/
}
?>
</div>
</div>