-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
660 lines (528 loc) · 19.3 KB
/
index.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
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
<html lang="en" >
<head>
<?php include 'SetUpStudents.php';?>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Rent a senior</title>
<link href="image/wcnr.png" rel="shortcut icon" type="favicon"/>
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css'>
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/typicons/2.0.8/typicons.min.css'>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<link rel='stylesheet prefetch' href='https://cdn.rawgit.com/michalsnik/aos/2.0.4/dist/aos.css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body id="grad">
<style>
#grad {
color: #fff;
background: linear-gradient(45deg,#136a8a, #267871, #203a43, #2c5364);
}
</style>
<button onClick="gotop(500)" id="report" title="top" style="display: block;">Top </button>
<p> </p>
<p> </p>
<section id ="Slide">
<div data-aos-duration="2000" data-aos="fade-down">
<!-- #region Jssor Slider Begin -->
<!-- Generator: Jssor Slider Maker -->
<!-- Source: https://www.jssor.com -->
<script src="js/jssor.slider-27.5.0.min.js" type="text/javascript"></script>
<style>
/*jssor slider loading skin spin css*/
.jssorl-009-spin img {
animation-name: jssorl-009-spin;
animation-duration: 1.6s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes jssorl-009-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/*jssor slider bullet skin 051 css*/
.jssorb051 .i {position:absolute;cursor:pointer;}
.jssorb051 .i .b {fill:#fff;fill-opacity:0.5;}
.jssorb051 .i:hover .b {fill-opacity:.7;}
.jssorb051 .iav .b {fill-opacity: 1;}
.jssorb051 .i.idn {opacity:.3;}
/*jssor slider arrow skin 051 css*/
.jssora051 {display:block;position:absolute;cursor:pointer;}
.jssora051 .a {fill:none;stroke:#fff;stroke-width:360;stroke-miterlimit:10;}
.jssora051:hover {opacity:.8;}
.jssora051.jssora051dn {opacity:.5;}
.jssora051.jssora051ds {opacity:.3;pointer-events:none;}
</style>
<div id="jssor_1" style="position:relative;margin:0 auto;top:0px;left:0px;width:980px;height:380px;overflow:hidden;visibility:hidden;">
<!-- Loading Screen -->
<div data-u="loading" class="jssorl-009-spin" style="position:absolute;top:0px;left:0px;width:100%;height:100%;text-align:center;background-color:rgba(0,0,0,0.7);">
<img style="margin-top:-19px;position:relative;top:50%;width:38px;height:38px;" src="image/spin.svg" />
</div>
<div data-u="slides" style="cursor:default;position:relative;top:0px;left:0px;width:980px;height:380px;overflow:hidden;">
<div>
<img data-u="image" src="image/001.png" />
</div>
<div>
<img data-u="image" src="image/002.png" />
</div>
<div>
<img data-u="image" src="image/003.png" />
</div>
<div>
<img data-u="image" src="image/004.png" />
</div>
<div>
<img data-u="image" src="image/005.png" />
</div>
<div>
<img data-u="image" src="image/006.png" />
</div>
<div>
<img data-u="image" src="image/007.png" />
</div>
<div>
<img data-u="image" src="image/008.png" />
</div>
<div>
<img data-u="image" src="image/009.png" />
</div>
<div>
<img data-u="image" src="image/001.png" />
</div>
<div>
<img data-u="image" src="image/001.png" />
</div>
<div>
<img data-u="image" src="image/001.png" />
</div>
<div>
<img data-u="image" src="image/001.png" />
</div>
</div>
<!-- Bullet Navigator -->
<div data-u="navigator" class="jssorb051" style="position:absolute;bottom:12px;right:12px;" data-autocenter="1" data-scale="0.5" data-scale-bottom="0.75">
<div data-u="prototype" class="i" style="width:16px;height:16px;">
<svg viewbox="0 0 16000 16000" style="position:absolute;top:0;left:0;width:100%;height:100%;">
<circle class="b" cx="8000" cy="8000" r="5800"></circle>
</svg>
</div>
</div>
<!-- Arrow Navigator -->
<div data-u="arrowleft" class="jssora051" style="width:55px;height:55px;top:0px;left:25px;" data-autocenter="2" data-scale="0.75" data-scale-left="0.75">
<svg viewbox="0 0 16000 16000" style="position:absolute;top:0;left:0;width:100%;height:100%;">
<polyline class="a" points="11040,1920 4960,8000 11040,14080 "></polyline>
</svg>
</div>
<div data-u="arrowright" class="jssora051" style="width:55px;height:55px;top:0px;right:25px;" data-autocenter="2" data-scale="0.75" data-scale-right="0.75">
<svg viewbox="0 0 16000 16000" style="position:absolute;top:0;left:0;width:100%;height:100%;">
<polyline class="a" points="4960,1920 11040,8000 4960,14080 "></polyline>
</svg>
</div>
</div>
<script src="js/javascript.js"></script>
<script type="text/javascript">jssor_1_slider_init();</script>
<!-- #endregion Jssor Slider End -->
</div>
</div>
</section>
<center><h1>Renting Seniors</h1></center>
<center><info><p style="color:red" id="timer"></p></info></center>
<center><info>
<i>
<p>Please do not spam/use email(s) that is/are not yours; by doing so, you may get yourself in serious consequences.</p>
</i>
</info></center>
<section id ="amount">
<?php
// random number generator
$min_number = 1;
$max_number = 15;
$random_number1 = mt_rand($min_number, $max_number);
$random_number2 = mt_rand($min_number, $max_number);
?>
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
$emailErr = $amountErr = $naErr = $mathErr="";
$amount = "";
error_reporting(0);
error_reporting(E_ALL & ~E_NOTICE);
$bad = array("","","","","","","","", "", ""); /*Bad words here */
$captchaResult = $_POST["matha"];
$firstNumber = $_POST["firstNumber"];
$secondNumber = $_POST["secondNumber"];
$checkTotal = $firstNumber + $secondNumber;
// find senior function
function findSenior($str2){
$str22 = substr($str2, -1,1);
$str33 = substr($str2, 0,1);
$txt ="";
if ($str22 == "m"){
$str3="allstub.txt";
$lines = file($str3, FILE_IGNORE_NEW_LINES);
$txt= $lines[$str33];
}
elseif ($str22 == "f"){
$str3="allstug.txt";
$lines = file($str3, FILE_IGNORE_NEW_LINES);
$txt= $lines[$str33];
}
return $txt;
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// check if the math is correct
if (empty($_POST["matha"])){
$mathErr = "Math is required";
echo "<script type='text/javascript'>alert('$mathErr');</script>";
}else {
$checkemail = "@dogrschools.org";
$tocheck = $_POST["email"];
if($captchaResult == $checkTotal){
$checc = 0;
if (empty($_POST["amount"])) {
$amountErr = "amount is required";
echo "<script type='text/javascript'>alert('$amountErr');</script>";
$chekk=-1;
$checc = -1;
} else {
if (!is_numeric ($_POST["amount"])){
$amountErr = "Please enter a number";
echo "<script type='text/javascript'>alert('$amountErr');</script>";
$chekk = -1;
$checc = -1;
}
elseif ($chekk==0) {
$amount = removeund($_POST["amount"]);
}
}
//other checkings
if ($amount != ""){
$txt = $amount;
if (isset($_POST["seniorname"])){
if ($_POST["seniorname"] =="null"){
$ee ="Cannot choose nobody and then bid!";
echo "<script type='text/javascript'>alert('$ee');</script>";
$checc =-1;
}
}
if (empty($_POST["seniorname"])) {
$emailErr = "empty name";
$checc = -1;
}
if (empty($_POST["email"])) {
$emailErr = "Email is required";
$checc = -1;
} else {
$tempc = strtolower($_POST["email"]);
foreach ($bad as &$value) {
if (strpos($tempc, $value) !== false){
$emailErr = "Bad words are not allowed";
$checc = -1;
}
}
if (!filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
$emailErr = "Only emails allowed";
$checc =-1;
}elseif(!(strpos( $tocheck, $checkemail)!==false)){
$emailErr = "Only West emails allowed";
$checc =-1;
}
}
if ($checc == -1){
echo "<script type='text/javascript'>alert('$emailErr');</script>";
}
$str4 = (int)$_POST["amount"];
// check if the newer bid bigger than the latest bid
if ($checc==0){
$str3="information/"."p".$_POST["seniorname"].".txt";
$pricefile = fopen($str3, "r") or die("Unable to open file!");
$tocheckbd = (int)fgets($pricefile);
fclose($pricefile);
if ($str4 <= $tocheckbd ){
$AErr = "Your bid must be higher than the lastest bid";
echo "<script type='text/javascript'>alert('$AErr');</script>";
$checc = -1;
}
}
// if there is no error, send email confirmation
if ($checc == 0){
require $_SERVER['DOCUMENT_ROOT'] . '/mail/Exception.php';
require $_SERVER['DOCUMENT_ROOT'] . '/mail/PHPMailer.php';
require $_SERVER['DOCUMENT_ROOT'] . '/mail/SMTP.php';
$str2=$_POST["seniorname"];
$txt ="";
$txt = findSenior($str2);
//send email
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 0; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages
$mail->Host = "smtp.gmail.com"; // use $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6
$mail->Port = 587; // TLS only
$mail->SMTPSecure = 'tls'; // ssl is deprecated
$mail->SMTPAuth = true;
$mail->Username = 'Youremail'; // email
$mail->Password = 'yourpasswd'; // password
$mail->setFrom('your email', 'nullflows smart fridge'); // From email and name
$mail->addAddress($_POST["email"], 'User'); // to email and name
$mail->Subject = 'Verify bidding';
$mail->msgHTML("Did you bid on ".$txt." for $".$amount."?"." Email me if you did/didn't"); //$mail->msgHTML(file_get_contents('contents.html'), __DIR__); //Read an HTML message body from an external file, convert referenced images to embedded,
$mail->AltBody = 'HTML messaging not supported'; // If html emails is not supported by the receiver, show this body
// $mail->addAttachment('images/phpmailer_mini.png'); //Attach an image file
$mess = "";
if(!$mail->send()){
$mess = "Failed! your email is incorrect? Mailer Error: " . $mail->ErrorInfo;
$message = $mess;
echo "<script type='text/javascript'>alert('$message');</script>";
}else{
$filewbid = fopen("information/amount.txt", "a") or die("Unable to open file!");
$txt = "Amount: $".$amount." for ".$_POST["seniorname"]." "."by"." ".$_POST["email"]." ". "at ". date("m/d/Y");
fwrite($filewbid, $txt);
fwrite($filewbid, "\n");
$str3="information/"."p".$_POST["seniorname"].".txt";
$pre="information/"."pre".$_POST["seniorname"].".txt";
$listor="information/"."listor".$_POST["seniorname"].".txt";
$str4 = (int)$_POST["amount"];
$bidder="information/allbidder.txt";
// write all the bidders to a file in order to report later
$prefile=fopen($bidder, "a") or die("Unable to open file!");
fwrite($prefile, $_POST["email"]."\n");
fclose($prefile);
//write all the prices of a specific senior to a file
$prefile=fopen($pre, "a") or die("Unable to open file!");
fwrite($prefile, $_POST["amount"]."\n");
fclose($prefile);
//write all the bidder for a specific senior in a file
$listbfile=fopen($listor, "a") or die("Unable to open file!");
fwrite($listbfile, $_POST["email"]."\n");
fclose($listbfile);
// write the price to a specific senior file
$pricefile=fopen($str3, "w") or die("Unable to open file!");
fwrite($pricefile, $str4);
fclose($pricefile);
$str = "information/".$_POST["seniorname"].".txt";
$filename = fopen($str, "w") or die("Unable to open file!");
$txt ="";
$str2 = $_POST["seniorname"];
$txt1 = findSenior($str2);
$txt = $txt1.": "."$".$str4;
fwrite($filename, $txt);
fclose($filename);
// write to a file with the bidder name + senior name when expired.php is executed
$txtend = $txt1.": "."$".$str4." by ".$_POST["email"];
$strend = "information/"."end".$_POST["seniorname"].".txt";
$filenameend = fopen($strend, "w") or die("Unable to open file!");
fwrite($filenameend, $txtend);
fclose($filenameend);
$mess = "Bidded!";
$message = $mess.", check your email to verify ";
echo "<script type='text/javascript'>alert('$message');</script>";
}
fclose($filewbid);
}
}
}
else {
$mathErr="Wrong answer";
echo "<script type='text/javascript'>alert('$mathErr');</script>";
}
}
}
// remove all the space, weird characters of the bid
function removeund($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<center><info><h3>Bid here</h3></info></center>
<button class="collapsible" data-aos="fade-right"></button>
<div class="content">
<center>
<h4>Buy here</h4>
<form method='post' action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
Amount:<br>
<input type="text" name="amount" placeholder="Amount" value="">
<span class="error"> <?php echo $amountErr;?></span>
<br>
Your senior's name:<br>
<select name = "seniorname">
<option value ="null">Nobody</option>
<?php
// display all the girls to the dropdown menu
$filefdata = fopen("allstug.txt", "r") or die("Unable to open file!");
$i =0;
while(! feof($filefdata))
{
?>
<option value="<?php echo $i."f";?>"><?php echo fgets($filefdata)." (female)";?></option>
<?php
$i++;
}
fclose($filefdata);
?>
<?php
// display all the boys to the dropdown menu
$filefdata = fopen("allstub.txt", "r") or die("Unable to open file!");
$i =0;
while(! feof($filefdata))
{
?>
<option value="<?php echo $i."m";?>"><?php echo fgets($filefdata)." (male)";?></option>
<?php
$i++;
}
fclose($filefdata);
?>
</select>
<br>
Your email:<br>
<input type="text" name="email" placeholder="Your email" value="<?php echo $_POST["email"];?>">
<span class="error"> <?php echo $emailErr;?></span> </input>
<br><?php echo $random_number1 . ' + ' . $random_number2 . ' = '."?"; ?><br>
<input name="firstNumber" type="hidden" value="<?php echo $random_number1; ?>" />
<input name="secondNumber" type="hidden" value="<?php echo $random_number2; ?>" />
<input type="text" name="matha" placeholder="prove that you are human" value="">
<span class="error"> <?php echo $mathErr;?></span> </input>
<br></br>
<input type="submit" value="BID!">
</form>
</center>
</div>
</section>
<script>
var auto_refresh = setInterval(
(function () {
$("#lol").load("drbaa.php");
}), 1000);
</script>
<section id="qaa">
<center><info><h3>Details about lastest bids</h3></info></center>
<button class="collapsible" data-aos="fade-right"></button>
<div class="content">
<center><h4>Recent Bid + amount</h4></center>
<div id ="lol"></div>
</div>
</section>
<script>
var auto_refresh = setInterval(
(function () {
$("#lol2").load("dpfep.php");
}), 1000);
</script>
<section id="pfep">
<center><info> <h3>Price for each person</h3></info></center>
<button class="collapsible" data-aos="fade-right"></button>
<div class="content">
<center><h4>Price for each person</h4></center>
<div id ="lol2"></div>
</div>
</section>
<hr data-aos="zoom-in">
<p> </p>
<center><info><h3>Report Bidder</h3></info></center>
<center>
<style>
.gradient-button {
margin: 10px;
font-family: 'Ubuntu', sans-serif;
font-size: 20px;
padding: 15px;
text-align: center;
transition: 0.5s;
background-size: 200% auto;
color: #FFF;
box-shadow: 0 0 20px #eee;
width: 130px;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
cursor: pointer;
display: inline-block;
}
.gradient-button:hover span{
display: none;
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
margin: 8px 10px 12px;
}
.gradient-button-1 { background-image: linear-gradient(to right, #02AAB0 0%, #00CDAC 51%, #02AAB0 100%)}
.gradient-button-1:hover { background-position: right center; }
</style>
<script>
$(document).ready(function() {
$('.gradient-button').hover(function() {
$(this).html('Report bidder');
}, function() {
$(this).html('Click to report');
});
});
</script>
<a href = "report.php" class="gradient-button gradient-button-1">Report bidder</a><br /></center>
</center>
<center>
<p> </p>
<p></p>
<center>
<hr data-aos="zoom-in">
<p> </p>
<section id = "aboutt">
<refer><h2>About</h2>
<p> Seniors’ secret names are used for anonymity purposes</p>
<p>Verification link is <b><i>NOT</i></b> gonna be developed, and it was removed from to-do list. Therefore, The website only sends you an email,
and you have to reply back if there is anything wrong.</p>
<p>User can see who wins which senior and seniors' secret names after senior renting ends</p>
<p>User can request features, create PR(s), report issues and view source-code <a href="https://github.com/bobdinh139/SeniorRenting"> here</a></p>
</center>
</section>
<p> </p>
<hr data-aos="zoom-in">
<style>
.zoom {
height: 110px;
width: 110px;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.zoom:hover {
width: 130px;
height: 130px;
}
</style>
<center><refer><h2>This website is made possible by:</h2></refer></center>
<div data-aos="zoom-in" >
<center>
<a href="https://www.github.com/null0verflow" target="_blank">
<img src="image/ok.png" width="110" height="110" class="zoom">
</a>
</center>
<center><refer><p> Bob Dinh</p>
<refer><p> Designing/developing</p>
</div>
</refer></center>
<p> </p>
<hr data-aos="zoom-in">
<refer>
<cre>
<center>@bobdinh139</center>
</cre>
</refer>
<div id="navbar" style="top: 0px;">
<center>
<a href="#amount">Bid</a>
<a href="#qaa">Details about Bids</a>
<a href="#pfep">Price</a>
<a href="#aboutt">About</a>
<!–– your email here ––>
<a href="mailto:youremail@email.here?subject=Bug report">Report Issues</a>
</center>
</div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js'></script>
<script src ='js/javascript.js'></script>
<script src='https://cdn.rawgit.com/michalsnik/aos/2.0.4/dist/aos.js'></script>
<script>AOS.init({
duration: 1200,
})</script>