-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
36 lines (30 loc) · 1.01 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
<?php
$username = $_POST['username'];
$password = $_POST['password'];
//Database connection
$con = new mysqli("localhost","root","","Goldenlions");
if($con->connect_error){
die("Failed to connect : ".$con->connect_error);
}
else{
$stmt = $con->prepare("select * from Registration_details where username = ?");
$stmt->bind_param("s", $username);
$stmt->execute();
$stmt_result = $stmt->get_result();
if($stmt_result->num_rows > 0){
$data = $stmt_result->fetch_assoc();
if($data['password'] === $password){
echo ("<script LANGUAGE='JavaScript'>
window.alert('Login successful....');
window.location.href='profile.html';
</script>");
}
}
else {
echo ("<script LANGUAGE='JavaScript'>
window.alert('Password or username invalid....');
window.location.href='login.html';
</script>");
}
}
?>