-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunraiserdetailed.php
428 lines (375 loc) · 10.5 KB
/
funraiserdetailed.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
<?php
session_start();
include("header.php");
//
if(isset($_POST[submit]))
{
$payment_detail = serialize(array($_POST[cardholder],$_POST[cardnumber],$_POST[month],$_POST[cvv]));
$sql ="INSERT INTO fund_collection( fund_raiser_id, donor_id, name, paid_amt, paid_date, payment_type, payment_detail, status) VALUES($_GET[fund_raiser_id],$_SESSION[donor_id],$_POST[donorname],$_POST[donationamount],$dt,$_POST[payment_type],$payment_detail,Active)";
$qsql = mysqli_query($con,$sql);
if(mysqli_affected_rows($con) == 1)
{
$insid = mysqli_insert_id($con);
echo "<script>alert(Fund collection process completed successfully....);</script>";
echo "<script>window.location=fundcollectionreceipt.php?fund_collection_id=$insid;</script>";
}
else
{
echo mysqli_error($con);
}
}
$sql = "SELECT * FROM fund_raiser where status=Active AND fund_raiser_id=$_GET[fund_raiser_id]";
$qsql = mysqli_query($con,$sql);
$rs = mysqli_fetch_array($qsql);
$perc=0;
$sqlfund_collection = "SELECT SUM(paid_amt) FROM fund_collection where fund_raiser_id=$rs[0] AND status=Active";
$qsqlfund_collection = mysqli_query($con,$sqlfund_collection);
$rsfund_collection = mysqli_fetch_array($qsqlfund_collection);
$perc = ($rsfund_collection[0] * 100 / $rs[fund_amount]);
?>
</header>
<div id="cta" class="section">
<div class="section-bg" style="background-image: url(img/charity/downloadfile.jpg);" data-stellar-background-ratio="0.5"></div>
<div class="container">
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="cta-content text-center">
<h1>FUND RAISER</h1>
</div>
</div>
</div>
</div>
</div>
<div class="section">
<div class="container">
<div class="row">
<main id="main" class="col-md-9">
<div class="article causes-details">
<h2 class="article-title"><?php echo $rs[title]; ?></h2>
<div class="article-img">
<?php
if($rs[banner_img] == "")
{
echo "<img src=img/no-image-icon.png style=height: 500px;>";
}
else if(file_exists("imgfundraiser/".$rs[banner_img]))
{
echo "<img src=imgfundraiser/".$rs[banner_img]. " style=height: 500px;>";
}
else
{
echo "<img src=img/no-image-icon.png style=height: 500px; >";
}
?>
</div>
<div class="clearfix">
<div class="causes-progress">
<div class="causes-progress-bar">
<div style="width: <?php
if($perc > 100)
{
echo 100;
}
else
{
echo round($perc);
}
?>%;">
<span><?php
if($perc > 100)
{
echo 100;
}
else
{
echo round($perc);
}
?>%</span>
</div>
</div>
<div>
<span class="causes-raised">Raised: <strong>₹<?php echo $rsfund_collection[0]; ?></strong></span>
<span class="causes-goal">Goal: <strong>₹<?php echo $rs[fund_amount]; ?></strong></span>
</div>
</div>
<a href="" onclick="return false;" class="primary-button causes-donate" data-toggle="modal" data-target="#myModal">Donate Now</a>
</div>
<div class="article-content">
<ul class="article-meta">
<li><b>Started on <?php echo date("d-M-Y",strtotime($rs[start_date])); ?></b></li>
<li><b>Ends at <?php echo date("d-M-Y",strtotime($rs[end_date])); ?></b></li>
</ul>
<?php echo $rs[fund_raiser_description]; ?>
</div>
<?php
/*
<div class="article-tags-share">
<ul class="tags">
<li>TAGS:</li>
<li><a href="#">Charity</a></li>
<li><a href="#">Health</a></li>
<li><a href="#">Donation</a></li>
</ul>
<ul class="share">
<li>SHARE:</li>
<li><a href="#"><i class="fa fa-twitter"></i></a></li>
<li><a href="#"><i class="fa fa-facebook"></i></a></li>
<li><a href="#"><i class="fa fa-google-plus"></i></a></li>
<li><a href="#"><i class="fa fa-pinterest"></i></a></li>
<li><a href="#"><i class="fa fa-instagram"></i></a></li>
</ul>
</div>
*/
?>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Donation panel</h4>
</div>
<div class="modal-body">
<p>
<form method="post" action="" onsubmit="return fun_validate()">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<b>Donation Amount: </b>
<input class="input" name="donationamount" id="donationamount" type="number" placeholder="Donation Amount" min="1">
<span id="errdonationamount" class="errorclass"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<b>Donor Name: </b>
<input class="input" name="donorname" id="donorname" type="text" placeholder="Donor Name" value="<?php echo $rsdonor[name]; ?>">
<span id="errdonorname" class="errorclass"></span>
</div>
</div>
</div><hr>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<b>Payment Type: </b>
<select name="payment_type" id="payment_type" class="form-control">
<option value="">Select Payment Type</option>
<?php
$arr = array("VISA","MASTER CARD","AMERICAN EXPRESS","RUPAY");
foreach($arr as $val)
{
echo "<option vlaue=$val>$val</option>";
}
?>
</select>
<span id="errpayment_type" class="errorclass"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<b>Card holder: </b>
<input class="input" type="text" name="cardholder" id="cardholder" placeholder="Card holder" >
<span id="errcardholder" class="errorclass"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<b>Card Number: </b>
<input name="cardnumber" id="cardnumber" class="input" type="number" placeholder="Card Number">
<span id="errcardnumber" class="errorclass"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<b>Expiry date: </b>
<input class="input" type="month" name="month" id="month" placeholder="Expiry date">
<span id="errmonth" class="errorclass"></span>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<b>CVV Number: </b>
<input class="input" placeholder="CVV Number" name="cvv" id="cvv" type="number" min="101" max="999">
<span id="errcvv" class="errorclass"></span>
</div>
</div>
</div>
</p>
</div>
<div class="modal-footer">
<button class="primary-button" type="submit" name="submit">Make Payment</button>
</div>
</div>
</form>
</div>
</div>
</div>
</main>
<aside id="aside" class="col-md-3">
<div class="widget">
<h3 class="widget-title">Recent Donations</h3>
<?php
$sql = "SELECT * FROM fund_collection LEFT JOIN donor ON donor.donor_id=fund_collection.donor_id LEFT JOIN fund_raiser on fund_raiser.fund_raiser_id=fund_collection.fund_raiser_id where fund_collection.status=Active ORDER BY fund_collection_id DESC LIMIT 4";
$qsql = mysqli_query($con,$sql);
while($rs = mysqli_fetch_array($qsql))
{
?>
<div class="widget-post">
<a href="#">
<div class="widget-img">
<?php
if($rs[profile_img] == "")
{
echo "<img src=img/no-image-icon.png style=height: 75px;>";
}
else if(file_exists("imgdonor/".$rs[profile_img]))
{
echo "<img src=imgdonor/".$rs[profile_img]. " style=height: 75px;>";
}
else
{
echo "<img src=img/no-image-icon.png style=height: 75px; >";
}
?>
</div>
<div class="widget-content">
<?php
echo $rs[name];
?>
<br>
Donated ₹<?php echo $rs[paid_amt]; ?>
</div>
</a>
</div>
<?php
}
?>
</div>
<hr>
<div class="widget">
<h3 class="widget-title">Top donors</h3>
<?php
$sql = "SELECT fund_collection.name, SUM(fund_collection.paid_amt) as subamt, donor.profile_img FROM `fund_collection` left join donor on fund_collection.donor_id=donor.donor_id GROUP BY fund_collection.donor_id order by SUM(fund_collection.paid_amt) desc limit 4";
$qsql = mysqli_query($con,$sql);
while($rs = mysqli_fetch_array($qsql))
{
?>
<div class="widget-post">
<a href="#">
<div class="widget-img">
<?php
if($rs[profile_img] == "")
{
echo "<img src=img/no-image-icon.png style=height: 75px;>";
}
else if(file_exists("imgdonor/".$rs[profile_img]))
{
echo "<img src=imgdonor/".$rs[profile_img]. " style=height: 75px;>";
}
else
{
echo "<img src=img/no-image-icon.png style=height: 75px; >";
}
?>
</div>
<div class="widget-content">
<?php
echo $rs[name];
?>
<br>
Donated ₹<?php echo $rs[subamt]; ?>
</div>
</a>
</div>
<?php
}
?>
</div>
</aside>
</div>
</div>
</div>
<?php
include("footer.php");
?>
<script>
function fun_validate()
{
var i = 0;
$(.errorclass).html();
var numericExpression = /^[0-9]+$/;
var alphaExp = /^[a-zA-Z]+$/;
var alphaSpaceExp = /^[a-zA-Z\s]+$/;
var alphaNumericExp = /^[0-9a-zA-Z]+$/;
var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,6}$/;
var mobno = /^[6-9]\d{9}$/;
if(document.getElementById("donationamount").value <= 0)
{
document.getElementById("errdonationamount").innerHTML = "Minimum donation amount is 1.";
i = 1;
}
if(document.getElementById("donationamount").value=="")
{
document.getElementById("errdonationamount").innerHTML = "Donation Amount should not be empty..";
i = 1;
}
if(!document.getElementById("donorname").value.match(alphaSpaceExp))
{
document.getElementById("errdonorname").innerHTML = "Donor name should contain only alphabets..";
validate = "false";
}
if(document.getElementById("donorname").value=="")
{
document.getElementById("errdonorname").innerHTML = "Kindly enter donor name...";
i = 1;
}
if(document.getElementById("payment_type").value=="")
{
document.getElementById("errpayment_type").innerHTML = "Kindly select Payment Type...";
i = 1;
}
if(!document.getElementById("cardholder").value.match(alphaSpaceExp))
{
document.getElementById("errcardholder").innerHTML = "Card Holder name should contain only alphabets..";
validate = "false";
}
if(document.getElementById("cardholder").value=="")
{
document.getElementById("errcardholder").innerHTML = "Card Holder Should not be empty...";
i = 1;
}
if(document.getElementById("cardnumber").value.length != 16)
{
document.getElementById("errcardnumber").innerHTML = "Card Number should contain 16 digits...";
i = 1;
}
if(document.getElementById("cardnumber").value=="")
{
document.getElementById("errcardnumber").innerHTML = "Card Number Should not be empty...";
i = 1;
}
if(document.getElementById("month").value=="")
{
document.getElementById("errmonth").innerHTML = "Kindly select expiry date...";
i = 1;
}
if(document.getElementById("cvv").value.length != 3)
{
document.getElementById("errcvv").innerHTML = "CVV Number should contain 3 digits...";
i = 1;
}
if(document.getElementById("cvv").value=="")
{
document.getElementById("errcvv").innerHTML = "CVV Number should not be empty...";
i = 1;
}
if(i == 0)
{
return true;
}
else
{
return false;
}
}
</script>