-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAdminConfirmDonations.php
186 lines (159 loc) · 5.66 KB
/
AdminConfirmDonations.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.switch {
position: relative;
display: inline-block;
width: 30px;
height: 17px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 13px;
width: 13px;
left: 2px;
bottom: 2px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(13px);
-ms-transform: translateX(13px);
transform: translateX(13px);
}
/* Rounded sliders */
.slider.round {
border-radius: 3417px;
}
.slider.round:before {
border-radius: 50%;
}
</style>
</head>
<body>
<?php
$servername = "localhost"; // host which has established our computer.If the database is on a sever, then this should change accordinly
$username = "root"; // username and the password of the mysql sever
$password = "";
$dbname = "SamajaSathkara";
$conn = new mysqli($servername,$username,$password,$dbname); // making the connection with mysql
if ($conn->connect_error){ // check whether the connection is correctly established or not
die("Connection failed: " . $conn->connect_error);
} // upto here ,connection is established
echo "<h1>Admin Panel/Donations Approving </h1>";
echo '<h3><a href="#C4">View Approved Donations</a></h3>';
$sql = "SELECT id,ProjectID,amount,submitdate,submittime,BankSlip,isMember,UserID,fullname,NIC,email,pnumber,approved FROM Donation Where approved=false"; //reading things from the table
$result = $conn->query($sql);
if ($result->num_rows > 0){
while($row = $result->fetch_assoc()){ //while loop
echo "<b>Data & Time : </b>".$row["submitdate"]." ".$row["submittime"];
echo "<br>";
echo "<b>Name : </b>".$row["fullname"];
echo "<br>";
echo '<b>Email : </b><a href="mailto:'.$row["email"].'?Subject=Samaja%20Sathkara&body=" target="_top">'.$row["email"].'</a>';
echo '(Click this link to send a email)';
echo "<br>";
echo "<b>Phone Number : </b>".$row["pnumber"];
echo "<br>";
echo "<b>ProjectID : </b>".$row["ProjectID"];
echo "<br>";
echo "<b>amount : </b>".$row["amount"];
echo "<br>";
echo "<b>BankSlip : </b>".$row["BankSlip"];
echo "<br>";
echo "<b>isMember : </b>".$row["isMember"];
echo "<br>";
echo "<b>UserID : </b>".$row["UserID"];
echo "<br>";
echo "<b>NIC : </b>".$row["NIC"];
echo "<br>";
echo '<p>Mark as Approved: <label class="switch"> <input type="checkbox" id="'.$row["id"].'" onclick="myFunction('.$row["id"].')"><span class="slider round"></span></label></p>';
echo "<hr>";
}
}else{
//echo "All submitted contact forms have been readed.";
}
echo "<hr>";echo "<hr>";
echo '<h2 id="C4">Approved Donations</h2>';
$sql = "SELECT id,ProjectID,amount,submitdate,submittime,BankSlip,isMember,UserID,fullname,NIC,email,pnumber,approved FROM Donation Where approved=true"; //reading things from the table
$result = $conn->query($sql);
if ($result->num_rows > 0){
while($row = $result->fetch_assoc()){ //while loop
echo "<b>Data & Time : </b>".$row["submitdate"]." ".$row["submittime"];
echo "<br>";
echo "<b>Name : </b>".$row["fullname"];
echo "<br>";
echo '<b>Email : </b><a href="mailto:'.$row["email"].'?Subject=Samaja%20Sathkara&body=" target="_top">'.$row["email"].'</a>';
echo '(Click this link to send a email)';
echo "<br>";
echo "<b>Phone Number : </b>".$row["pnumber"];
echo "<br>";
echo "<b>ProjectID : </b>".$row["ProjectID"];
echo "<br>";
echo "<b>amount : </b>".$row["amount"];
echo "<br>";
echo "<b>BankSlip : </b>".$row["BankSlip"];
echo "<br>";
echo "<b>isMember : </b>".$row["isMember"];
echo "<br>";
echo "<b>UserID : </b>".$row["UserID"];
echo "<br>";
echo "<b>NIC : </b>".$row["NIC"];
echo "<br>";
//echo '<p>Mark as Read: <label class="switch"> <input type="checkbox" id="'.$row["id"].'" onclick="myFunction('.$row["id"].')"><span class="slider round"></span></label></p>';
echo '<p>Mark as Approved: <label class="switch"> <input type="checkbox" checked id="'.$row["id"].'" onclick="myFunction('.$row["id"].')"><span class="slider round"></span></label></p>';
echo "<hr>";
}
}else{
//echo "All submitted contact forms have been readed.";
}
?>
<script>
function myFunction(a) {
var checkBox = document.getElementById(a);
//var text = document.getElementById("text");
if (checkBox.checked == true){
var ajax=new XMLHttpRequest();
var url='markasConfirmed.php';
//ajax.onreadystatechange=response;
ajax.open('POST',url,true);
ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ajax.send('read='+a);
} else {
var ajax=new XMLHttpRequest();
var url='markasNotConfirmed.php';
//ajax.onreadystatechange=response;
ajax.open('POST',url,true);
ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ajax.send('read='+a);
}
}
</script>
</body>
</html>