-
Notifications
You must be signed in to change notification settings - Fork 7
/
functions.php
1569 lines (1346 loc) · 63.7 KB
/
functions.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
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
///////////////////// FORM SUBMISSION DATA \\\\\\\\\\\\\\\\\\\\\
function pokesubmission(){
require('./config/config.php');
$result = $conn->query("SELECT * FROM pokedex");
$id = $pokemon = $cp = $iv = $hour = $min = $ampm = $monster = $latitude = $longitude = $fulladdress = $spotter ="";
if(isset($_SESSION["uname"])){ ?>
<!--///////////////////// SUBMIT FORM \\\\\\\\\\\\\\\\\\\\\-->
<h2 style="text-align:center;"><strong>Add Pokémon:</strong></h2>
<form id="usersubmit" method="post" action="./spotpokemon.php">
<center><table id="t01">
<tbody>
<!--///////////////////// GENERATE MONSTER LIST \\\\\\\\\\\\\\\\\\\\\-->
<tr>
<td style="width: 5%;">Pokemon</td>
<td style="width: 10%;">
<?php
echo "<select id='pokesearch' name='pokemon'>";
while ($row = $result->fetch_assoc()) {
unset($id, $monster);
$id = $row['id'];
$monster= $row['monster'];
echo '<option value="'.$id.'">'.$id.' - '.$monster.'</option>';
}
echo "</select>";
mysqli_close($conn);
?>
</td>
</tr>
<!--///////////////////// Cp enter \\\\\\\\\\\\\\\\\\\\\-->
<tr>
<td style="width: 5%;">CP</td>
<td style="width: 10%;">
<input type="number" name="cp" min="10" max="4760" value="10" class="cpinput"><span id="cpoutput"></span>
</td>
</tr>
<tr>
<td style="width: 5%;">IV in %</td>
<td style="width: 10%;">
<input type="number" name="moniv" min="1" max="100" value="1" class="cpinput"><span id="cpoutput"></span>
</td>
</tr>
<!--///////////////////// ADDRESS \\\\\\\\\\\\\\\\\\\\\-->
<tr>
<td style="width: 5%;">Location</td>
<td style="width: 10%;">
<p>Click the button to get your coordinates.</p>
<p id="ScanLocation"></p>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false&key=<?php echo $gmaps;?>"></script>
<script>
var x = document.getElementById("ScanLocation");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
var latlng = new google.maps.LatLng(lat, lng);
var geocoder = geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'latLng': latlng }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
document.getElementById("addressinput").value = "" + results[0].formatted_address + "";
}
}
});
x.innerHTML = "<input name='latitude' value='" + position.coords.latitude + "' style='width:100%' readonly></input><input name='longitude' value='" + position.coords.longitude + "' style='width:100%' readonly></input><input id='addressinput' value='' style='width:100%'></input> ";
}
</script>
<button type="button" onclick="getLocation();enablespotbutton()">Get Location</button>
</td>
</tr>
<!--///////////////////// fORM SUBMIT BUTTON \\\\\\\\\\\\\\\\\\\\\-->
<center><td style="width:10%;"><input type="submit" id="spotbutton" value="SPOT!" disabled/></td></center>
</tbody>
</table></center>
</form>
<?php } else {
echo "<center><div style='margin-top:10px;'>";
echo "Login to spot a pokemon";
?><br /><br /><a href="./login/login.php">Login Here</a><?php
echo "</div></center>";
}
}
///////////////////// SPOTTED MONSTER TABLE \\\\\\\\\\\\\\\\\\\\\
function spottedpokemon(){
require('./config/config.php');
$results_per_page = 10;
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $results_per_page;
$sql = "SELECT * FROM spots,pokedex WHERE spots.pokemon = pokedex.id ORDER BY spotid DESC LIMIT $start_from,".$results_per_page;
$result = mysqli_query($conn,$sql)or die(mysqli_error($conn));
$sqlcnt = "SELECT COUNT(SPOTID) AS total FROM spots";
$resultcnt = $conn->query($sqlcnt);
$row = $resultcnt->fetch_assoc();
$total_pages = ceil($row["total"] / $results_per_page);
?>
<h2 style="text-align:center;"><strong>Spotted Pokemon:</strong></h2>
<center>
<!--///////////////////// START OF TABLE \\\\\\\\\\\\\\\\\\\\\-->
<?php
echo "<table id=\"t02\" class=\"spotted\">";
if(isset($_SESSION["uname"])){
echo "<tr><th>#</th><th>ID</th><th>POKEMON</th><th>CP</th><th>IV</th><th>FOUND</th><th>LOCATION</th><th>VOTING</th></tr>";
} else {
echo "<tr><th>#</th><th>ID</th><th>POKEMON</th><th>CP</th><th>IV</th><th>FOUND</th><th>LOCATION</th></tr>";
}
while($row = mysqli_fetch_array($result)) {
$spotid = $row['spotid'];
$id = $row['monster'];
$pokemon = $row['pokemon'];
$cp = $row['cp'];
$iv = $row['iv'];
$hour = $row['hour'];
$min = $row['min'];
$ampm = $row['ampm'];
$latitude = $row['latitude'];
$longitude = $row['longitude'];
$minutes = $min;
$hr = $hour;
$fulladdress = $row['fulladdress'];
if(isset($_SESSION["uname"])){
$good = $row['good'];
$bad = $row['bad'];
}
///////////////////// ADDS "0" TO SIGNLE DIGIT MINUTE TIMES \\\\\\\\\\\\\\\\\\\\\
if ($min < 10) {
$minutes = str_pad($min, 2, "0", STR_PAD_LEFT);
}
///////////////////// 12 HOUR FORMAT \\\\\\\\\\\\\\\\\\\\\
if ($clock=="false"){
///////////////////// 12 HOUR TABLE LAYOUT \\\\\\\\\\\\\\\\\\\\\
if(isset($_SESSION["uname"])){
echo "
<tr>
<td style='text-align:center;'>".$spotid."</td>
<td style='text-align:center;'>".$pokemon."</td>
<td>"?><img style="float:left; padding-right:5px;" src="./static/icons/<?php echo $pokemon?>.png" title="<?php echo $id; ?> (#<?php echo $pokemon?>)" height="24" width="24"><p style="padding-top:6%;"><?php echo $id; ?></p><?php echo "</td>
<td>".$cp."</td>
<td>".$iv."%</td>
<td style='text-align:center;'>".$hour.":".$minutes." ".$ampm."</td>
<td>"?><a href="./?loc=<?php echo "".$latitude,",".$longitude.""?>&zoom=19"><?php echo $fulladdress;?></a><?php echo "</td>
<td style='text-align:center;'>
<span style='display:inline-block;'><form action='good.php' method='post'><input type='hidden' name='spotid' value='$spotid' /><input type='image' name='good' style='width:25px;height:auto;display:inline;' src='static/voting/up.png' value='$good' /></form></span>".$good."<br>
<span style='display:inline-block;'><form action='bad.php' method='post'><input type='hidden' name='spotid' value='$spotid' /><input type='image' name='bad' style='width:27px;height:auto;display:inline;' src='static/voting/down.png' value='$bad' /></form></span>".$bad."</td>
</tr>";
} else {
echo "
<tr>
<td style='text-align:center;'>".$spotid."</td>
<td style='text-align:center;'>".$pokemon."</td>
<td>"?><img style="float:left; padding-right:5px;" src="./static/icons/<?php echo $pokemon?>.png" title="<?php echo $id; ?> (#<?php echo $pokemon?>)" height="24" width="24"><p style="padding-top:6%;"><?php echo $id; ?></p><?php echo "</td>
<td>".$cp."</td>
<td>".$iv."%</td>
<td style='text-align:center;'>".$hour.":".$minutes." ".$ampm."</td>
<td>"?><a href="./?loc=<?php echo "".$latitude,",".$longitude.""?>&zoom=19"><?php echo $fulladdress;?></a><?php echo "</td>
";
}
} else {
///////////////////// 24 HOUR FORMAT \\\\\\\\\\\\\\\\\\\\\
///////////////////// ADDS "0" TO SIGNLE DIGIT HOUR TIMES \\\\\\\\\\\\\\\\\\\\\
if ($hour < 10) {
$hr = str_pad($hour, 2, "0", STR_PAD_LEFT);
}
///////////////////// 24 HOUR TABLE LAYOUT \\\\\\\\\\\\\\\\\\\\\
if(isset($_SESSION["uname"])){
echo "
<tr>
<td style='text-align:center;'>".$spotid."</td>
<td>".$pokemon."</td>
<td>"?><img style="float:left; padding-right:5px;" src="./static/icons/<?php echo $pokemon?>.png" title="<?php echo $id; ?> (#<?php echo $pokemon?>)" height="24" width="24"><p style="padding-top:6%;"><?php echo $id; ?></p><?php echo "</td>
<td>".$cp."</td>
<td>".$iv."%</td>
<td>".$hr.":".$minutes."</td>
<td>"?><a href="./?loc=<?php echo "".$latitude,",".$longitude.""?>&zoom=19"><?php echo $fulladdress;?></a><?php echo "</td>
<td style='text-align:center;'>
<span style='display:inline-block;'><form action='good.php' method='post'><input type='hidden' name='spotid' value='$spotid' /><input type='image' name='good' style='width:25px;height:auto;display:inline;' src='static/voting/up.png' value='$good' /></form></span>".$good."<br>
<span style='display:inline-block;'><form action='bad.php' method='post'><input type='hidden' name='spotid' value='$spotid' /><input type='image' name='bad' style='width:27px;height:auto;display:inline;' src='static/voting/down.png' value='$bad' /></form></span>".$bad."</td>
</tr>";
} else {
echo "
<tr>
<td style='text-align:center;'>".$spotid."</td>
<td>".$pokemon."</td>
<td>"?><img style="float:left; padding-right:5px;" src="./static/icons/<?php echo $pokemon?>.png" title="<?php echo $id; ?> (#<?php echo $pokemon?>)" height="24" width="24"><p style="padding-top:6%;"><?php echo $id; ?></p><?php echo "</td>
<td>".$cp."</td>
<td>".$iv."%</td>
<td>".$hr.":".$minutes."</td>
<td>"?><a href="./?loc=<?php echo "".$latitude,",".$longitude.""?>&zoom=19"><?php echo $fulladdress;?></a><?php echo "</td>
";
}
}}
echo "</table></center><p id='pages'>";
?><center><?php
///////////////////// PAGENATION \\\\\\\\\\\\\\\\\\\\\
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='".basename($_SERVER['PHP_SELF'])."?page=".$i."'>".$i."</a> ";
};
?></center><?php
}
function maps(){
require('./config/config.php');
?>
<div id="map"></div>
<script>
var customLabel = {
monster: {
label: 'pokemon'
}
};
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
center: new google.maps.LatLng(<?php
if (isset($_GET['loc'])) {
echo $_GET['loc'];
} else {
echo $mapcenter;
}?>),
zoom: <?php
if (isset($_GET['zoom'])) {
echo $_GET['zoom'];
} else {
echo 15;
}?>,
gestureHandling: 'greedy',
fullscreenControl: true,
streetViewControl: false,
mapTypeControl: false,
clickableIcons: false
});
var infoWindow = new google.maps.InfoWindow;
// Change this depending on the name of your PHP or XML file
downloadUrl('./frontend/xml.php', function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName('marker');
Array.prototype.forEach.call(markers, function(markerElem) {
var id = markerElem.getAttribute('id');
var spotid = markerElem.getAttribute('spotid');
var pokemon = markerElem.getAttribute('pokemon');
var cp = markerElem.getAttribute('cp');
var iv = markerElem.getAttribute('iv');
var hour = markerElem.getAttribute('hour');
var min = markerElem.getAttribute('min');
var ampm = markerElem.getAttribute('ampm');
var type = markerElem.getAttribute('id');
var good = markerElem.getAttribute('good');
var bad = markerElem.getAttribute('bad');
var spotter = markerElem.getAttribute('spotter');
var point = new google.maps.LatLng(
parseFloat(markerElem.getAttribute('latitude')),
parseFloat(markerElem.getAttribute('longitude')));
var icon = customLabel[type] || {};
var image = {
url: './static/icons/' + id + '.png',
scaledSize: new google.maps.Size(32, 32)
};
var html = '<div class=\"maplabel\"><center><img src=\"./static/icons/' + id + '.png\" height=\"45\" width=\"45\"></img><p><b>'
+ pokemon + ' (#' + id + ')</b><br>CP: ' + cp + '<br>IV: '+ iv + '%<br>Found: ' + hour + ':' + min + ' ' + ampm +
'<?php if(isset($_SESSION["uname"])){?><br><hr><a href =\"./good.php?spotid=' + spotid + '&loc=' + markerElem.getAttribute('latitude') + ',' + markerElem.getAttribute('longitude') + '\"><img src=\"./static/voting/up.png\" height=\"25\" width=\"25\"></img></a>' + good +
' x Found<br><a href =\"./bad.php?spotid=' + spotid + '&loc=' + markerElem.getAttribute('latitude') + ',' + markerElem.getAttribute('longitude') + '\"><img src=\"./static/voting/down.png\" height=\"25\" width=\"25\"></img></a>' + bad + ' x Not found<?php }?><br><hr><a href=\"http://maps.google.com/maps?q=' +
markerElem.getAttribute('latitude') + ',' + markerElem.getAttribute('longitude') + '\">Google Maps</a><?php if(isset($_SESSION["uname"])){?><br><hr>Spotted by: <b>' + spotter + '</b><?php }?></center></div>';
var marker = new google.maps.Marker({
map: map,
position: point,
label: icon.label,
icon: image
});
marker.addListener('click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
});
});
downloadUrl('./frontend/gxml.php', function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName('marker');
Array.prototype.forEach.call(markers, function(markerElem) {
var gid = markerElem.getAttribute('gid');
var gname = markerElem.getAttribute('gname');
var gteam = markerElem.getAttribute('gteam');
var type = markerElem.getAttribute('type');
var tid = markerElem.getAttribute('tid');
var actraid = markerElem.getAttribute('actraid');
var actboss = markerElem.getAttribute('actboss');
var hour = markerElem.getAttribute('hour');
var min = markerElem.getAttribute('min');
var ampm = markerElem.getAttribute('ampm');
var egg = markerElem.getAttribute('egg');
var bossname = markerElem.getAttribute('bossname');
var raidby = markerElem.getAttribute('raidby');
var eggby = markerElem.getAttribute('eggby');
var bosscp = markerElem.getAttribute('bosscp');
var exraid = markerElem.getAttribute('exraid');
var exraiddate = markerElem.getAttribute('exraiddate');
var point = new google.maps.LatLng(
parseFloat(markerElem.getAttribute('glatitude')),
parseFloat(markerElem.getAttribute('glongitude')));
if (actraid === "0" && egg === "0"){
if (exraid === "1"){
var html = '<div class=\"maplabel\"><center><img src=\"./static/gyms/' + gteam + 'ex.png\" height=\"45px\" width=\"45px\"></img><p><b>' + gname + '</b><br>Team: ' + tid + '<?php if(!isset($_SESSION["uname"])){?><hr><b><span class="text-danger">Login to change/add teams or raids.</span></b><?php }?><?php if(isset($_SESSION["uname"])){?><br><hr><strong>EX Raid On:</strong><br> ' + exraiddate + '<br><hr><b>Choose team:</b><br><form action=\"./gymteam.php\" name=\"postInstinct\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"2\"></form><form action=\"./gymteam.php\" name=\"postValor\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"3\"></form><form action=\"./gymteam.php\" name=\"postMystic\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"4\"></form><a href=\"javascript:submitInstinct();\"><img border="0" alt="W3Schools" src="./static/teams/2.png" width="25" height="25"></a> / <a href="javascript:submitValor();\"><img border="0" alt="W3Schools" src="./static/teams/3.png" width="25" height="25"></a> / <a href="javascript:submitMystic();\"><img border="0" alt="W3Schools" src="./static/teams/4.png" width="25" height="25"></a><?php };?><br><hr><a href=\"http://maps.google.com/maps?q=' + markerElem.getAttribute('glatitude') + ',' + markerElem.getAttribute('glongitude') + '\">Google Maps</a></center></div>';
var icon = customLabel[type] || {};
var image = {
url: './static/gyms/' + gteam + 'ex.png',
scaledSize: new google.maps.Size(50, 50)
};
} else if (exraid === "0"){
var html = '<div class=\"maplabel\"><center><img src=\"./static/gyms/' + gteam + '.png\" height=\"45px\" width=\"45px\"></img><p><b>' + gname + '</b><br>Team: ' + tid + '<?php if(!isset($_SESSION["uname"])){?><hr><b><span class="text-danger">Login to change/add teams or raids.</span></b><?php }?><?php if(isset($_SESSION["uname"])){?><br><hr><b>Choose team:</b><br><form action=\"./gymteam.php\" name=\"postInstinct\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"2\"></form><form action=\"./gymteam.php\" name=\"postValor\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"3\"></form><form action=\"./gymteam.php\" name=\"postMystic\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"4\"></form><a href=\"javascript:submitInstinct();\"><img border="0" alt="W3Schools" src="./static/teams/2.png" width="25" height="25"></a> / <a href="javascript:submitValor();\"><img border="0" alt="W3Schools" src="./static/teams/3.png" width="25" height="25"></a> / <a href="javascript:submitMystic();\"><img border="0" alt="W3Schools" src="./static/teams/4.png" width="25" height="25"></a><?php };?><br><hr><a href=\"http://maps.google.com/maps?q=' + markerElem.getAttribute('glatitude') + ',' + markerElem.getAttribute('glongitude') + '\">Google Maps</a></center></div>';
var icon = customLabel[type] || {};
var image = {
url: './static/gyms/' + gteam + '.png',
scaledSize: new google.maps.Size(50, 50)
};
}
} else if (actraid !== "0" && egg === "0"){
if (exraid === "0"){
var html = '<div class=\"maplabel\"><center><img src=\"./static/icons/' + actboss + '.png\" height=\"45px\" width=\"45px\"></img><p><b>' + gname + '</b><br>Boss: ' + bossname + '<br>CP: ' + bosscp + '<br>Team: ' + tid + '<br>Expires: ' + hour + ':' + min + ' ' + ampm + '<?php if(!isset($_SESSION["uname"])){?><hr><b><span class="text-danger">Login to change/add teams or raids.</span></b><?php }?><?php if(isset($_SESSION["uname"])){?><br><hr><b>Choose team:</b><br><form action=\"./gymteam.php\" name=\"postInstinct\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"2\"></form><form action=\"./gymteam.php\" name=\"postValor\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"3\"></form><form action=\"./gymteam.php\" name=\"postMystic\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"4\"></form><a href=\"javascript:submitInstinct();\"><img border="0" alt="W3Schools" src="./static/teams/2.png" width="25" height="25"></a> / <a href="javascript:submitValor();\"><img border="0" alt="W3Schools" src="./static/teams/3.png" width="25" height="25"></a> / <a href="javascript:submitMystic();\"><img border="0" alt="W3Schools" src="./static/teams/4.png" width="25" height="25"></a><?php };?><br><hr><a href=\"http://maps.google.com/maps?q=' + markerElem.getAttribute('glatitude') + ',' + markerElem.getAttribute('glongitude') + '\">Google Maps</a><?php if(isset($_SESSION["uname"])){?><br><hr><b>Spotted by: </b>' + raidby + '<?php }?></center></div>';
var icon = customLabel[type] || {};
var image = {
url: './static/raids/' + actboss + '.png',
scaledSize: new google.maps.Size(75, 75)
};
} else if (exraid === "1"){
var html = '<div class=\"maplabel\"><center><img src=\"./static/icons/' + actboss + '.png\" height=\"45px\" width=\"45px\"></img><p><b>' + gname + '</b><br>Boss: ' + bossname + '<br>CP: ' + bosscp + '<br>Team: ' + tid + '<br>Expires: ' + hour + ':' + min + ' ' + ampm + '<?php if(!isset($_SESSION["uname"])){?><hr><b><span class="text-danger">Login to change/add teams or raids.</span></b><?php }?><?php if(isset($_SESSION["uname"])){?><br><hr><strong>EX Raid On:</strong><br> ' + exraiddate + '<br><hr><b>Choose team:</b><br><form action=\"./gymteam.php\" name=\"postInstinct\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"2\"></form><form action=\"./gymteam.php\" name=\"postValor\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"3\"></form><form action=\"./gymteam.php\" name=\"postMystic\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"4\"></form><a href=\"javascript:submitInstinct();\"><img border="0" alt="W3Schools" src="./static/teams/2.png" width="25" height="25"></a> / <a href="javascript:submitValor();\"><img border="0" alt="W3Schools" src="./static/teams/3.png" width="25" height="25"></a> / <a href="javascript:submitMystic();\"><img border="0" alt="W3Schools" src="./static/teams/4.png" width="25" height="25"></a><?php };?><br><hr><a href=\"http://maps.google.com/maps?q=' + markerElem.getAttribute('glatitude') + ',' + markerElem.getAttribute('glongitude') + '\">Google Maps</a><?php if(isset($_SESSION["uname"])){?><br><hr><b>Spotted by: </b>' + raidby + '<?php }?></center></div>';
var icon = customLabel[type] || {};
var image = {
url: './static/raids/' + actboss + '.png',
scaledSize: new google.maps.Size(75, 75)
};
}
} else if (actraid === "0" && egg !== "0"){
if (exraid === "0"){
var html = '<div class=\"maplabel\"><center><img src=\"./static/eggs/' + egg + '.png\" height=\"45px\" width=\"45px\"></img><p><b>' + gname + '</b><br>Egg level: ' + egg + '<br>Team: ' + tid + '<br>Hatches at: ' + hour + ':' + min + ' ' + ampm + '<?php if(!isset($_SESSION["uname"])){?><hr><b><span class="text-danger">Login to change/add teams or raids.</span></b><?php }?><?php if(isset($_SESSION["uname"])){?><br><hr><b>Choose team:</b><br><form action=\"./gymteam.php\" name=\"postInstinct\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"2\"></form><form action=\"./gymteam.php\" name=\"postValor\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"3\"></form><form action=\"./gymteam.php\" name=\"postMystic\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"4\"></form><a href=\"javascript:submitInstinct();\"><img border="0" alt="W3Schools" src="./static/teams/2.png" width="25" height="25"></a> / <a href="javascript:submitValor();\"><img border="0" alt="W3Schools" src="./static/teams/3.png" width="25" height="25"></a> / <a href="javascript:submitMystic();\"><img border="0" alt="W3Schools" src="./static/teams/4.png" width="25" height="25"></a><?php };?><br><hr><a href=\"http://maps.google.com/maps?q=' + markerElem.getAttribute('glatitude') + ',' + markerElem.getAttribute('glongitude') + '\">Google Maps</a><?php if(isset($_SESSION["uname"])){?><br><hr><b>Spotted by: </b>' + eggby + '<?php }?></center></div>';
var icon = customLabel[type] || {};
var image = {
url: './static/eggs/' + egg + '.png',
scaledSize: new google.maps.Size(55, 55)
};
} else if (exraid === "1"){
var html = '<div class=\"maplabel\"><center><img src=\"./static/eggs/' + egg + '.png\" height=\"45px\" width=\"45px\"></img><p><b>' + gname + '</b><br>Egg level: ' + egg + '<br>Team: ' + tid + '<br>Hatches at: ' + hour + ':' + min + ' ' + ampm + '<?php if(!isset($_SESSION["uname"])){?><hr><b><span class="text-danger">Login to change/add teams or raids.</span></b><?php }?><?php if(isset($_SESSION["uname"])){?><br><hr><strong>EX Raid On:</strong><br> ' + exraiddate + '<br><hr><b>Choose team:</b><br><form action=\"./gymteam.php\" name=\"postInstinct\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"2\"></form><form action=\"./gymteam.php\" name=\"postValor\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"3\"></form><form action=\"./gymteam.php\" name=\"postMystic\" method=\"post\"\"><input type=\"hidden\" name=\"gname\" value=\"' + gid + '\"><input type=\"hidden\" name=\"tname\" value=\"4\"></form><a href=\"javascript:submitInstinct();\"><img border="0" alt="W3Schools" src="./static/teams/2.png" width="25" height="25"></a> / <a href="javascript:submitValor();\"><img border="0" alt="W3Schools" src="./static/teams/3.png" width="25" height="25"></a> / <a href="javascript:submitMystic();\"><img border="0" alt="W3Schools" src="./static/teams/4.png" width="25" height="25"></a><?php };?><br><hr><a href=\"http://maps.google.com/maps?q=' + markerElem.getAttribute('glatitude') + ',' + markerElem.getAttribute('glongitude') + '\">Google Maps</a><?php if(isset($_SESSION["uname"])){?><br><hr><b>Spotted by: </b>' + eggby + '<?php }?></center></div>';
var icon = customLabel[type] || {};
var image = {
url: './static/eggs/' + egg + '.png',
scaledSize: new google.maps.Size(55, 55)
};
}
}
var marker = new google.maps.Marker({
map: map,
position: point,
label: icon.label,
icon: image,
title: gname + ' held by ' + tid
});
marker.addListener('click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
});
});
downloadUrl('./frontend/sxml.php', function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName('marker');
Array.prototype.forEach.call(markers, function(markerElem) {
var sid = markerElem.getAttribute('sid');
var sname = markerElem.getAttribute('sname');
var quest = markerElem.getAttribute('quest');
var quested = markerElem.getAttribute('quested');
var reward = markerElem.getAttribute('reward');
var type = markerElem.getAttribute('type');
var questby = markerElem.getAttribute('questby');
var point = new google.maps.LatLng(
parseFloat(markerElem.getAttribute('slatitude')),
parseFloat(markerElem.getAttribute('slongitude')));
if (quested === "1"){
var html = '<div class=\"maplabel\"><center><img src=\"./static/stops/queststop.png\" height=\"45\" width=\"45\"></img><p><b>' + sname + '</b><?php if(!isset($_SESSION["uname"])){?><br>(<b><span class="text-success">Quested</span></b>)<br><hr><b><span class="text-danger">Login to add/view quests.</span></b><?php }?><?php if(isset($_SESSION["uname"])){?></b><br><hr><b>Quest:</b><br> ' + quest + '<br><hr><b>Reward:</b><br>' + reward + '<?php };?><br><hr><a href=\"http://maps.google.com/maps?q=' + markerElem.getAttribute('slatitude') + ',' + markerElem.getAttribute('slongitude') + '\">Google Maps</a><?php if(isset($_SESSION["uname"])){?><br><hr><b>Spotted by: </b>' + questby + '<?php }?></center></div>';
var icon = customLabel[type] || {};
var image = {
url: './static/stops/queststop.png',
scaledSize: new google.maps.Size(30, 30)
};
} else if (quested === ""){
var html = '<div class=\"maplabel\"><center><img src=\"./static/stops/stops.png\" height=\"45\" width=\"45\"></img><p><b>' + sname + '</b><?php if(!isset($_SESSION["uname"])){?><br><hr><b><span class="text-danger">Login to add/view quests.</span></b><?php }?><br><hr><a href=\"http://maps.google.com/maps?q=' + markerElem.getAttribute('slatitude') + ',' + markerElem.getAttribute('slongitude') + '\">Google Maps</a></center></div>';
var icon = customLabel[type] || {};
var image = {
url: './static/stops/stops.png',
scaledSize: new google.maps.Size(30, 30)
};
}
var marker = new google.maps.Marker({
map: map,
position: point,
label: icon.label,
icon: image,
});
marker.addListener('click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
});
});
}
function downloadUrl(url, callback) {
var request = window.ActiveXObject ?
new ActiveXObject('Microsoft.XMLHTTP') :
new XMLHttpRequest;
request.onreadystatechange = function() {
if (request.readyState == 4) {
request.onreadystatechange = doNothing;
callback(request, request.status);
}
};
request.open('GET', url, true);
request.send(null);
}
function doNothing() {}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=<?php echo $gmaps;?>&callback=initMap"></script>
<?php
}
///////////////// SUBMIT RAIDS \\\\\\\\\\\\\\\\\
function raidsubmission(){
require('./config/config.php');
$result = $conn->query("SELECT * FROM raidbosses");
$rid = $rboss = $rlvl = $rhour = $rmin = $rampm = $spotter="";
if(isset($_SESSION["uname"])){
?>
<!--///////////////////// SUBMIT FORM \\\\\\\\\\\\\\\\\\\\\-->
<h2 style="text-align:center;"><strong>Add Raid:</strong></h2>
<form id="usersubmit" method="post" action="./spotraid.php">
<center><table id="t03">
<tbody>
<!--///////////////////// GENERATE BOSS LIST \\\\\\\\\\\\\\\\\\\\\-->
<tr>
<td style="width: 5%;">Raid Boss</td>
<td style="width: 10%;">
<?php
echo "<select id='raidsearch' name='rboss'>";
while ($row = $result->fetch_assoc()) {
unset($rid, $rboss);
$rid = $row['rid'];
$rboss= $row['rboss'];
echo '<option value="'.$rid.'">'.$rid.' - '.$rboss.'</option>';
}
echo "</select>";
mysqli_close($conn);
?>
</td>
</tr>
<!--///////////////////// TIME OF FIND \\\\\\\\\\\\\\\\\\\\\-->
<tr>
<td style="width: 5%;">Minutes until expire:</td>
<td style="width: 10%;">
<style>
.sliderraid
{
width: 100% !important;
}
</style>
<input type="range" name="rtime" min="0" max="45" value="0" id="rtimerange" class="sliderraid"><span id="rtimeoutput"></span>
<script>
var sliderraid = document.getElementById("rtimerange");
var output = document.getElementById("rtimeoutput");
output.innerHTML = "<br>Raid ends in: " + sliderraid.value + " minutes</center>";
sliderraid.oninput = function() {
output.innerHTML = "<br>Raid ends in: " + this.value + " minutes</center>";
}
</script>
</td>
</tr>
<!--///////////////////// ADDRESS \\\\\\\\\\\\\\\\\\\\\-->
<tr>
<td style="width: 5%;">At Gym</td>
<td style="width: 10%;">
<?php
require('./config/config.php');
$result = $conn->query("SELECT * FROM gyms,teams WHERE gyms.gteam = teams.tid");
$gid = $gname = $gteam = "";
echo "<select id='gymsearch' name='gname'>";
while ($row = $result->fetch_assoc()) {
unset($gid, $gname);
$gid = $row['gid'];
$tid = $row['tname'];
$gname= $row['gname'];
$gteam= $row['gteam'];
echo '<option value="'.$gid.'" label="'.$gteam.'">'.$gname.'</option>';
}
echo "</select>";
?>
</td>
</tr>
<!--///////////////////// fORM SUBMIT BUTTON \\\\\\\\\\\\\\\\\\\\\-->
<center><td style="width:10%;"><input type="submit" value="SPOT!"/></td></center>
</tbody>
</table></center>
</form>
<?php } else{
echo "<center><div style='margin-top:10px;'>";
echo "Login to spot a Raid";
?><br /><br /><a href="./login/login.php">Login Here</a><?php
echo "</div></center>";
} }
////////////////////// SPOTTED RAIDS \\\\\\\\\\\\\\\\\\\\\\\\\
function spottedraids(){
require('./config/config.php');
$results_per_page = 10;
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $results_per_page;
$sql = "SELECT * FROM raidbosses,gyms WHERE gyms.actraid = '1' AND gyms.actboss = raidbosses.rid AND gyms.glatitude AND gyms.glongitude ORDER BY date DESC LIMIT $start_from,".$results_per_page;
$result = mysqli_query($conn,$sql)or die(mysqli_error($conn));
$sqlcnt = "SELECT COUNT(RID) AS total FROM spotraid";
$resultcnt = $conn->query($sqlcnt);
$row = $resultcnt->fetch_assoc();
$total_pages = ceil($row["total"] / $results_per_page);
?>
<h2 style="text-align:center;"><strong>Spotted Raids:</strong></h2>
<center>
<!--///////////////////// START OF TABLE \\\\\\\\\\\\\\\\\\\\\-->
<?php
echo "<table id=\"t02\" class=\"spotted\">";
echo "<tr><th>ID</th><th>BOSS</th><th>LVL / CP</th><th>EXPIRES</th><th>LOCATION</th></tr>";
while($row = mysqli_fetch_array($result)) {
$rid = $row['rid'];
$rboss = $row['rboss'];
$rlvl = $row['rlvl'];
$rcp = $row['rcp'];
$hour = $row['hour'];
$min = $row['min'];
$ampm = $row['ampm'];
$glatitude = $row['glatitude'];
$glongitude = $row['glongitude'];
$minutes = $min;
$hr = $hour;
$gname = $row['gname'];
///////////////////// ADDS "0" TO SIGNLE DIGIT MINUTE TIMES \\\\\\\\\\\\\\\\\\\\\
if ($min < 10) {
$minutes = str_pad($min, 2, "0", STR_PAD_LEFT);
}
///////////////////// 12 HOUR FORMAT \\\\\\\\\\\\\\\\\\\\\
if ($clock=="false"){
///////////////////// 12 HOUR TABLE LAYOUT \\\\\\\\\\\\\\\\\\\\\
echo "
<tr>
<td>".$rid."</td>
<td>"?><img style="float:left; padding-right:5px;" src="./static/icons/<?php echo $rid?>.png" title="<?php echo $rid; ?> (#<?php echo $rboss?>)" height="24" width="24"><p style="padding-top:6%;"><?php echo $rboss; ?></p><?php echo "</td>
<td>".$rlvl." / ".$rcp."</td>
<td>".$hour.":".$minutes." ".$ampm."</td>
<td>"?><a href="./?loc=<?php echo "".$glatitude,",".$glongitude.""?>&zoom=19"><?php echo $gname;?></a><?php echo "</td>
</tr>";
} else {
///////////////////// 24 HOUR FORMAT \\\\\\\\\\\\\\\\\\\\\
///////////////////// ADDS "0" TO SIGNLE DIGIT HOUR TIMES \\\\\\\\\\\\\\\\\\\\\
if ($hour < 10) {
$hr = str_pad($hour, 2, "0", STR_PAD_LEFT);
}
///////////////////// 24 HOUR TABLE LAYOUT \\\\\\\\\\\\\\\\\\\\\
echo "
<tr>
<td>".$rid."</td>
<td>"?><img style="float:left; padding-right:5px;" src="./static/icons/<?php echo $rid?>.png" title="<?php echo $rid; ?> (#<?php echo $rboss?>)" height="24" width="24"><p style="padding-top:6%;"><?php echo $rboss; ?></p><?php echo "</td>
<td>".$rlvl." / ".$rcp."</td>
<td>".$hr.":".$minutes."</td>
<td>"?><a href="./?loc=<?php echo "".$glatitude,",".$glongitude.""?>&zoom=19"><?php echo $gname;?></a><?php echo "</td>
</tr>";
}}
echo "</table></center><p id='pages'>";
?><center><?php
///////////////////// PAGENATION \\\\\\\\\\\\\\\\\\\\\
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='".basename($_SERVER['PHP_SELF'])."?page=".$i."'>".$i."</a> ";
};
?></center><?php
}
///////////////// SUBMIT QUESTS \\\\\\\\\\\\\\\\\
function questsubmission(){
require('./config/config.php');
$result = $conn->query("SELECT * FROM quests");
$qid = $qname= $spotter="";
if(isset($_SESSION["uname"])){
?>
<!--///////////////////// SUBMIT FORM \\\\\\\\\\\\\\\\\\\\\-->
<h2 style="text-align:center;"><strong>Submit a Quest:</strong></h2>
<form id="usersubmit" method="post" action="./spotquest.php">
<center><table id="t03">
<tbody>
<!--///////////////////// GENERATE QUEST & REWARD LIST \\\\\\\\\\\\\\\\\\\\\-->
<tr>
<td style="width: 5%;">Quests</td>
<td style="width: 10%;">
<?php
echo "<select id='questsearch' name='quest'>";
while ($row = $result->fetch_assoc()) {
unset($qid, $qname);
$qid = $row['qid'];
$qname= $row['qname'];
$array[$row['type']][] = $row;
}
// loop the array to create optgroup
foreach($array as $key=>$value){
// check if its an array
if(is_array($value)){
// create optgroup for each groupname
echo "<optgroup label='".$key."'>";
foreach($value as $k=>$v){
echo "<option label='".$v['type']."' value='".$v['qid']."'>'".$v['qname']."'</option>";
}
echo "</optgroup>";
}
}
echo "</select>";
?>
</td>
</tr>
<tr>
<td style="width: 5%;">Rewards</td>
<td style="width: 10%;">
<?php
require('./config/config.php');
$result2 = $conn->query("SELECT * FROM rewards");
$reid = $rname= "";
echo "<select id='rewardsearch' name='reward'>";
while ($row2 = $result2->fetch_assoc()) {
unset($reid, $rname);
$reid = $row2['reid'];
$rname= $row2['rname'];
$array2[$row2['type']][] = $row2;
}
// loop the array to create optgroup
foreach($array2 as $key=>$value){
// check if its an array
if(is_array($value)){
// create optgroup for each groupname
echo "<optgroup label='".$key."'>";
foreach($value as $k=>$v){
echo "<option label='".$v['type']."' value='".$v['reid']."'>'".$v['rname']."'</option>";
}
echo "</optgroup>";
}
}
echo "</select>";
?>
</td>
</tr>
<!--///////////////////// ADDRESS \\\\\\\\\\\\\\\\\\\\\-->
<tr>
<td style="width: 5%;">At Pokestop</td>
<td style="width: 10%;">
<?php
$result = $conn->query("SELECT * FROM stops");
$sid = $sname = $sname = "";
echo "<select id='pokestopsearch' name='sname'>";
while ($row = $result->fetch_assoc()) {
unset($sid, $sname);
$sid = $row['sid'];
$sname= $row['sname'];
echo '<option value="'.$sid.'">'.$sname.'</option>';
}
echo "</select>";
?>
</td>
</tr>
<!--///////////////////// fORM SUBMIT BUTTON \\\\\\\\\\\\\\\\\\\\\-->
<center><td style="width:10%;"><input type="submit" value="SPOT!"/></td></center>
</tbody>
</table></center>
</form>
<?php } else{
echo "<center><div style='margin-top:10px;'>";
echo "Login to spot a Quest";
?><br /><br /><a href="./login/login.php">Login Here</a><?php
echo "</div></center>";
} }
////////////////////// SPOTTED QUESTS \\\\\\\\\\\\\\\\\\\\\\\\\
function spottedquests(){
require('./config/config.php');
$results_per_page = 10;
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $results_per_page;
$sql = "SELECT * from stops,quests,rewards WHERE quested='1' AND stops.actquest = quests.qid AND stops.actreward = rewards.reid ORDER BY date DESC LIMIT $start_from,".$results_per_page;
$result = mysqli_query($conn,$sql)or die(mysqli_error($conn));
$sqlcnt = "SELECT COUNT(SID) AS total FROM stops WHERE quested='1'";
$resultcnt = $conn->query($sqlcnt);
$row = $resultcnt->fetch_assoc();
$total_pages = ceil($row["total"] / $results_per_page);
?>
<h2 style="text-align:center;"><strong>Spotted Quests:</strong></h2>
<center>
<!--///////////////////// START OF TABLE \\\\\\\\\\\\\\\\\\\\\-->
<?php
echo "<table id=\"t02\" class=\"spotted\">";
echo "<tr><th>ID</th><th>QUEST</th><th>REWARD</th><th>SPOTTED</th><th>LOCATION</th></tr>";
while($row = mysqli_fetch_array($result)) {
$questname = $row['qname'];
$sname = $row['sname'];
$reward = $row['rname'];
$sid = $row['sid'];
$slat = $row['slatitude'];
$slon = $row['slongitude'];
$hour = $row['hour'];
$min = $row['min'];
$ampm = $row['ampm'];
$minutes = $min;
$hr = $hour;
///////////////////// ADDS "0" TO SIGNLE DIGIT MINUTE TIMES \\\\\\\\\\\\\\\\\\\\\
if ($min < 10) {
$minutes = str_pad($min, 2, "0", STR_PAD_LEFT);
}
///////////////////// 12 HOUR FORMAT \\\\\\\\\\\\\\\\\\\\\
if ($clock=="false"){
///////////////////// 12 HOUR TABLE LAYOUT \\\\\\\\\\\\\\\\\\\\\
echo "
<tr>
<td>".$sid."</td>
<td>".$questname."</td>
<td>".$reward."</td>
<td>".$hour.":".$minutes." ".$ampm."</td>
<td>"?><a href="./?loc=<?php echo "".$slat,",".$slon.""?>&zoom=19"><?php echo $sname;?></a><?php echo "</td>
</tr>";
} else {
///////////////////// 24 HOUR FORMAT \\\\\\\\\\\\\\\\\\\\\
///////////////////// ADDS "0" TO SIGNLE DIGIT HOUR TIMES \\\\\\\\\\\\\\\\\\\\\
if ($hour < 10) {
$hr = str_pad($hour, 2, "0", STR_PAD_LEFT);
}
///////////////////// 24 HOUR TABLE LAYOUT \\\\\\\\\\\\\\\\\\\\\
echo "
<tr>
<td>".$sid."</td>
<td>".$questname."</td>
<td>".$reward."</td>
<td>".$hr.":".$minutes."</td>
<td>"?><a href="./?loc=<?php echo "".$slat,",".$slon.""?>&zoom=19"><?php echo $sname;?></a><?php echo "</td>
</tr>";
}}
echo "</table></center><p id='pages'>";
?><center><?php
///////////////////// PAGENATION \\\\\\\\\\\\\\\\\\\\\
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='".basename($_SERVER['PHP_SELF'])."?page=".$i."'>".$i."</a> ";
};
?></center><?php
}
////////////////////// SPOTTED EGGS \\\\\\\\\\\\\\\\\\\\\\\\\
function spottedeggs(){
require('./config/config.php');
$results_per_page = 10;
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $results_per_page;
$sql = "SELECT * FROM gyms WHERE gyms.egg != '0' ORDER BY date DESC LIMIT $start_from,".$results_per_page;
$result = mysqli_query($conn,$sql)or die(mysqli_error($conn));
$sqlcnt = "SELECT COUNT(eggby) AS total FROM gyms WHERE egg !='0'";
$resultcnt = $conn->query($sqlcnt);
$row = $resultcnt->fetch_assoc();
$total_pages = ceil($row["total"] / $results_per_page);
?>
<h2 style="text-align:center;"><strong>Spotted Eggs:</strong></h2>
<center>
<!--///////////////////// START OF TABLE \\\\\\\\\\\\\\\\\\\\\-->
<?php
echo "<table id=\"t02\" class=\"spotted\">";
echo "<tr><th>GYM ID</th><th>EGG LVL</th><th>HATCHES</th><th>LOCATION</th></tr>";
while($row = mysqli_fetch_array($result)) {
$gid = $row['gid'];
$hour = $row['hour'];
$min = $row['min'];
$ampm = $row['ampm'];
$glatitude = $row['glatitude'];
$glongitude = $row['glongitude'];
$minutes = $min;
$hr = $hour;
$gname = $row['gname'];
$egg = $row['egg'];
///////////////////// ADDS "0" TO SIGNLE DIGIT MINUTE TIMES \\\\\\\\\\\\\\\\\\\\\
if ($min < 10) {
$minutes = str_pad($min, 2, "0", STR_PAD_LEFT);
}
///////////////////// 12 HOUR FORMAT \\\\\\\\\\\\\\\\\\\\\
if ($clock=="false"){
///////////////////// 12 HOUR TABLE LAYOUT \\\\\\\\\\\\\\\\\\\\\
echo "
<tr>
<td>".$gid."</td>
<td>"?><img style="float:left; padding-right:5px;" src="./static/eggs/<?php echo $egg?>.png" title="<?php echo $egg; ?>" height="24" width="24"><p style="padding-top:6%;"><?php echo $egg; ?></p><?php echo "</td>
<td>".$hour.":".$minutes." ".$ampm."</td>
<td>"?><a href="./?loc=<?php echo "".$glatitude,",".$glongitude.""?>&zoom=19"><?php echo $gname;?></a><?php echo "</td>
</tr>";
} else {
///////////////////// 24 HOUR FORMAT \\\\\\\\\\\\\\\\\\\\\
///////////////////// ADDS "0" TO SIGNLE DIGIT HOUR TIMES \\\\\\\\\\\\\\\\\\\\\
if ($hour < 10) {
$hr = str_pad($hour, 2, "0", STR_PAD_LEFT);
}
///////////////////// 24 HOUR TABLE LAYOUT \\\\\\\\\\\\\\\\\\\\\
echo "
<tr>
<td>".$gid."</td>
<td>"?><img style="float:left; padding-right:5px;" src="./static/eggs/<?php echo $egg?>.png" title="<?php echo $egg; ?>" height="24" width="24"><p style="padding-top:6%;"><?php echo $egg; ?></p><?php echo "</td>
<td>".$hr.":".$minutes."</td>
<td>"?><a href="./?loc=<?php echo "".$glatitude,",".$glongitude.""?>&zoom=19"><?php echo $gname;?></a><?php echo "</td>
</tr>";
}}
echo "</table></center><p id='pages'>";
?><center><?php
///////////////////// PAGENATION \\\\\\\\\\\\\\\\\\\\\
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='".basename($_SERVER['PHP_SELF'])."?page=".$i."'>".$i."</a> ";
};
?></center><?php
}
///////////////////// FORM SUBMISSION DATA \\\\\\\\\\\\\\\\\\\\\
function gymsubmission(){
require('./config/config.php');
$result = $conn->query("SELECT * FROM gyms,teams WHERE gyms.gteam = teams.tid");
$gid = $gname = $gteam = $teamby="";
if(isset($_SESSION["uname"])){
?>
<!--///////////////////// SUBMIT FORM \\\\\\\\\\\\\\\\\\\\\-->
<h2 style="text-align:center;"><strong>Gym team:</strong></h2>
<form id="usersubmit" method="post" action="./gymteam.php">
<center><table id="t04">
<tbody>
<!--///////////////////// GENERATE MONSTER LIST \\\\\\\\\\\\\\\\\\\\\-->
<tr>
<td style="width: 5%;">Gym</td>
<td style="width: 10%;">
<?php
echo "<select id='gymsearch' name='gname'>";
while ($row = $result->fetch_assoc()) {
unset($gid, $gname);
$gid = $row['gid'];
$tid = $row['tname'];
$gname= $row['gname'];
$gteam= $row['gteam'];
echo '<option value="'.$gid.'" label="'.$gteam.'">'.$gname.'</option>';
}
echo "</select>";
?>
</td>
</tr>
<tr>
<td style="width: 5%;">Team</td>
<td style="width: 10%;">
<select id='teamsearch' name='tname'>
<option value="2">Instinct</option>
<option value="4">Mystic</option>
<option value="3">Valor</option>
</select>
</td>
</tr>
<!--///////////////////// fORM SUBMIT BUTTON \\\\\\\\\\\\\\\\\\\\\-->
<center><td style="width:10%;"><input type="submit" value="SPOT!"/></td></center>
</tbody>
</table></center>
</form>