-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbloodbank_sign_process.php
More file actions
58 lines (53 loc) · 1.81 KB
/
bloodbank_sign_process.php
File metadata and controls
58 lines (53 loc) · 1.81 KB
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
50
51
52
53
54
55
56
57
58
<?php
include("conn.php");
session_start();
$email = $pass = $conf_pass = $name = $area = $city = $open_time = $close_time = "";
$sno = $phno = 0;
// $_SESSION["emailErr"] = NULL;
// $_SESSION["passErr"] = NULL;
$success="";
if($_SERVER["REQUEST_METHOD"] == "POST")
{
//$sql='select email from donor where email=?';
$email = test_input($_POST["email"]);
$stmt = $conn->prepare('select email from blood.bloodbank where email=:email');
$stmt->bindParam(":email", $email);
$stmt->execute();
if($stmt->rowCount()>0)
{
$_SESSION["emailErr"] = "Email address already exists.";
}
$pass = md5('blah@#$'.sha1('3NhNj8&'.$_POST['pass']) );
$conf_pass = md5('blah@#$'.sha1('3NhNj8&'.$_POST['conf_pass']) );
if(strcmp($pass,$conf_pass)!=0)
{
$_SESSION["passErr"] = "Passwords do not match.";
}
if(strlen($_SESSION["emailErr"])==0 && strlen($_SESSION["passErr"])==0)
{
$sql_add = "insert into blood.bloodbank(email,password,bloodbank_name,street_no,area,city,opening_time,closing_time,phone_no) values(?,?,?,?,?,?,?,?,?)";
$name = test_input($_POST["name"]);
$sno = test_input($_POST["sno"]);
$area = test_input($_POST["area"]);
$city = test_input($_POST["city"]);
$phno = test_input($_POST["phno"]);
$stmt2 = $conn->prepare($sql_add);
$stmt2->execute(array($email,$pass,$name,$sno,$area,$city,test_input($_POST["open_time"]),test_input($_POST["close_time"]),$phno));
if($stmt2->rowCount()==1)
{
header("Location: login.php?success=true");
exit();
}
}
else
{
header("Location:Bloodbank.php");
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>