-
Notifications
You must be signed in to change notification settings - Fork 1
/
auth.php
44 lines (41 loc) · 1.03 KB
/
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
ini_set("display_errors",1);
include_once "config.php";
$type = $_POST["type"];
$name = $_POST["name"];
$id = $_POST["id"];
if(empty($name) || empty($id)){
echo "empty";
}
else{
$name[0] = strtoupper($name[0]);
if($type == "patient"){
$sql = "SELECT * FROM $type WHERE
PID = $id AND PFirstName = '$name'";
} else if($type == "doctor"){
$sql = "SELECT * FROM $type WHERE
DID = $id AND DFirstName = '$name'";
} else if($type == "supplier"){
$sql = "SELECT * FROM $type WHERE
SID = $id and SName = '$name'";
} else{
$sql = "SELECT * FROM $type WHERE
HID = $id";
}
// running the query and storing the result
$result = $link -> query($sql);
if($result == false){
die("INVALID DATA");
}
// Checking the number of rows here
$count = mysqli_num_rows($result);
if($count >= 1){
$link -> close();
$_SESSION['unique-id'] = $id;
echo "success";
} else{
$link -> close();
echo "err";
}
}
?>