-
Notifications
You must be signed in to change notification settings - Fork 1
/
RemoveABidd.php
428 lines (342 loc) · 11.4 KB
/
RemoveABidd.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
<title>Remove a Bid</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">
<body id="grad">
<style>
#grad {
width: 100wh;
height: 90vh;
color: #fff;
background: linear-gradient(45deg, #606c88, #3f4c6b, #203a43, #2c5364);
background-size: 500% 500%;
-webkit-animation: Gradient 40s ease infinite;
-moz-animation: Gradient 40s ease infinite;
animation: Gradient 40s ease infinite;
}
@-webkit-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@-moz-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
</style>
<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>
<br>
<?php
error_reporting(0);
error_reporting(E_ALL & ~E_NOTICE);
$apass = "01234567890";
$pass = $_POST["pass"];
$bidremove = $_POST["bidremove"];
//typical 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;
}
// this function removes the lastest bid and read the latest bid after the bid was removed
function rem($fileread){
// thanks philipnorton42
$filename = $fileread;
$file_handle = fopen($filename, 'r');
$linebreak = false;
$file_start = false;
$bite = 50;
$filesize = filesize($filename);
fseek($file_handle, 0, SEEK_END);
while ($linebreak === false && $file_start === false) {
$pos = ftell($file_handle);
if ($pos < $bite) {
rewind($file_handle);
} else {
fseek($file_handle, -$bite, SEEK_CUR);
}
$string = fread($file_handle, $bite) or die ("Can't read from file " . $filename . ".");
if ($pos + $bite >= $filesize) {
$string = substr_replace($string, '', -1);
}
if ($pos < $bite) {
rewind($file_handle);
} else {
fseek($file_handle, -$bite, SEEK_CUR);
}
if (is_integer($lb = strrpos($string, "\n"))) {
$linebreak = true;
$line_end = ftell($file_handle) + $lb + 1;
}
if (ftell($file_handle) == 0) {
$file_start = true;
}
}
if ($linebreak === true) {
rewind($file_handle);
$file_minus_lastline = fread($file_handle, $line_end);
fclose($file_handle);
$file_handle = fopen($filename, 'w+');
fputs($file_handle, $file_minus_lastline);
fclose($file_handle);
} else {
fclose($file_handle);
}
$line = '';
$f = fopen($fileread, 'r');
$cursor = -1;
fseek($f, $cursor, SEEK_END);
$char = fgetc($f);
while ($char === "\n" || $char === "\r") {
fseek($f, $cursor--, SEEK_END);
$char = fgetc($f);
}
while ($char !== false && $char !== "\n" && $char !== "\r") {
$line = $char . $line;
fseek($f, $cursor--, SEEK_END);
$char = fgetc($f);
}
$testline = $line;
if(empty(trim($testline))){
return "0";
}
else {
return $line;
}
}
if(!(empty($_POST["bidremove"]))){
if ( $pass==$apass ){
$fileread = "information/pre".$_POST["bidremove"].".txt";
$listor="information/"."listor".$_POST["bidremove"].".txt";
$nameend="information/"."end".$_POST["bidremove"].".txt";
$price="information/"."p".$_POST["bidremove"].".txt";
$str = "information/".$_POST["bidremove"].".txt";
// read all the previous bids abd remove the latest one, read the latest one after the latest one was removed
$line = rem($fileread);
$filename = fopen($str, "w") or die("Unable to open file!");
$str4 = $line;
$str2 = $_POST["bidremove"];
$txt1 = findSenior($str2);
$txt = $txt1.": "."$".$str4;
// delete the lastest line in log
fwrite($filename, $txt);
fclose($filename);
//change the price of current senior
$filename = fopen($price, "w") or die("Unable to open file!");
fwrite($filename, $str4);
fclose($filename);
// rewrite for the end file in order to show after the expired.php is executed
$line = rem($listor);
$str2 = $_POST["bidremove"];
$txt1 = findSenior($str2);
$filename = fopen($nameend, "w") or die("Unable to open file!");
$txt = $txt1.": "."$".$str4." by ".$line;
fwrite($filename, $txt);
fclose($filename);
echo "Removed!";
}else{
echo "wrong password";
}
}
?>
<center>
<info><h3>Remove A Bid</h3></info>
<form action="" method="post">
Latest bid remove <br>
<select name = "bidremove">
<option value ="null">Nobody</option>
<?php
// shows all seniors
$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
$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>
Password: <br><input type="password" name="pass" placeholder="password"><br>
<input type="submit" value="Remove!">
</form>
<p> </p>
</center>
<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></centercenter>