-
Notifications
You must be signed in to change notification settings - Fork 12
/
InsertLogin.php
49 lines (41 loc) · 1.23 KB
/
InsertLogin.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
<?php
session_start();
require_once("includes.html");
$conn=mysqli_connect('localhost','root','','appointment');
$username=$_POST['username'];
$email=mysqli_real_escape_string($conn,$username);
$_SESSION['username'] = $_POST['username'];
$pass=$_POST['psw'];
$pass=mysqli_real_escape_string($conn,$pass);
$query= "SELECT username,password from patient where username='".$username."' and password= '".$pass."'";
$result=mysqli_query($conn,$query) or die($mysqli_error($conn));
$num=mysqli_num_rows($result);
if($num == 0)
{
echo "<script>
swal({
title: 'Invalid Credentials!',
text: 'Please check and try again',
type: 'error'
},
function(){
window.location.href = 'Home.php';
});
</script>";
}
else
{
$row=mysqli_fetch_array($result);
$_SESSION['username'] = $row['username'];
echo "<script>
swal({
title: 'Successful!!',
text: 'Welcome!',
type: 'success'
},
function(){
window.location.href = 'Login.php';
});
</script>";
}
?>