-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdonate.php
115 lines (92 loc) · 2.32 KB
/
donate.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
include("classes/probDomCls/member.php");
session_start();
// $id = $_POST['id'];
$id=$_SESSION["donateHosID"];
$name = $_POST['name'];
$email = $_POST['email'];
$amount = $_POST['amount'];
$rand=rand(0,1);
if($rand==0){
$sql = "INSERT INTO Donation
(DonationId,
HospitalId,
Email,
Name,
Amount)
VALUES
('0',
'$id',
'$email',
'$name',
'$amount');
";
if ($result = QueryExecutor::query($sql)) {
$subject = "HFMS Donation Receipt";
$toname = Hospital::getInstance($id)->get_name();
$body = "Dear $name , You have donated $amount Rs. to $toname. Thank you:)";
$mail = new Mail($email, $subject, $body);
$mail->send();
echo '0';
} else {
}
}
else{
$subject = "HFMS Donation Failed";
$body = "Dear $name , Your donation is failed.Thank you:)";
$mail = new Mail($email, $subject, $body);
$mail->send();
echo '1';
}
// class Donation
// {
// private DonationStrategy $donationStrategy;
// public function __construct()
// {
// }
// public function setStrategy(DonationStrategy $donationStrategy): void
// {
// $this->donationStrategy = $donationStrategy;
// }
// public function donate(int $amount): bool
// {
// return $this->donationStrategy->donate($amount);
// }
// }
// interface DonationStrategy
// {
// public function donate(int $amount): bool;
// }
// class CreditCardStrategy implements DonationStrategy
// {
// private String $name;
// private String $cardNumber;
// private String $cvv;
// private String $dateOfExpiry;
// public function __construct(String $name, String $cardNumber, String $cvv, String $dateOfExpiry)
// {
// $this->name = $name;
// $this->cardNumber = $cardNumber;
// $this->cvv = $cvv;
// $this->dateOfExpiry = $dateOfExpiry;
// }
// public function donate(int $amount): bool
// {
// return rand(0,1)==0;
// }
// }
// class PaypalStrategy implements DonationStrategy
// {
// private String $emailId;
// private String $password;
// public function __construct(String $emailId, String $password)
// {
// $this->emailId = $emailId;
// $this->password = $password;
// }
// public function donate(int $amount): bool
// {
// return rand(0,1)==0;
// }
// }
?>