-
Notifications
You must be signed in to change notification settings - Fork 0
/
checklogin.php
26 lines (22 loc) · 959 Bytes
/
checklogin.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
include('connection.php');
$email = $_POST['email'];
$password = $_POST['password'];
//to prevent from mysqli injection
$email = stripcslashes($email);
$password = stripcslashes($password);
$email = mysqli_real_escape_string($con, $email);
$password = mysqli_real_escape_string($con, $password);
$sql = "select * from customers where email = '$email' and password = '$password'";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$count = mysqli_num_rows($result);
if($count == 1){
header('Location:homepage.php');
echo '<script> alert("Login successful");</script>';
}
else{
include('login.php');
echo "<p style="."color:white"."> Login failed. Invalid username or password.</p>";
}
?>