-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth.php
26 lines (22 loc) · 880 Bytes
/
auth.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
<?php
$email= $_POST["email"];
$pwd= $_POST["pwd"];
$con=mysqli_connect("127.0.0.1","root","master123") or die("<p> Failed to connect tonserver</p>");
mysqli_select_db($con,"LOGIN") or die("<p> No data base named LOGIN </p>");
$query="SELECT pwd FROM users WHERE emails='$email';";
$real_pwd=mysqli_query($con,$query) or die("<p> Cannot execute query </p>");
if (mysqli_num_rows($real_pwd) > 0) {
$real_pwd = mysqli_fetch_array($real_pwd);
$real_pwd = $real_pwd[0];
if($real_pwd==$pwd){
echo "<p style='color: green; font-size: 50px;'> Logged in successfully </p>";
// The header will be here
}else{
echo "<p style='color: red; font-weight: 500; '> Wrong username or password </p>";
}
}else{
// The user input the non existing email
echo "<p style='color: red; font-weight: 500'> Wrong username or password </p>";
}
mysqli_close($con);
?>