-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdonor_functions.php
35 lines (31 loc) · 1.29 KB
/
donor_functions.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
<?php
function validateSession($connection,$username,$password){
$sql_username = mysql_entities_fix_string($connection, $username);
$sql_password = mysql_entities_fix_string($connection, $password);
$sql = "SELECT * FROM donor WHERE username = '$sql_username'";
$result = $connection->query($sql);
if (!$result) die($connection->error);
elseif ($result->num_rows) {
$row = $result->fetch_array(MYSQLI_NUM);
$result->close();
if($password != $row[2]) {
die("Sorry Some Error occured-User not authorized Please login again <a href=loginUI.php>Click Here to Login</a> ");
}
else "";
}
else die("Sorry Some Error occured-User not authorized Please login again <a href=loginUI.php>Click Here to Login</a> ");
}
function getDonorID($connection,$username,$password){
$sql_username = mysql_entities_fix_string($connection, $username);
$sql_password = mysql_entities_fix_string($connection, $password);
$sql = "SELECT * FROM donor WHERE username = '$sql_username'";
$result = $connection->query($sql);
if (!$result) die($connection->error);
elseif ($result->num_rows) {
$row = $result->fetch_array(MYSQLI_NUM);
$text = implode(",", $row);
return $text;
$result->close();
}
}
?>