forked from acasadoalonso/SWiface-PHP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetcontestinfo.php
executable file
·86 lines (78 loc) · 2.19 KB
/
getcontestinfo.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
<?php
if (isset($_GET['username']))
$username = $_GET['username'];
if (isset($_GET['cpassord']))
$cpassword = $_GET['cpassword'];
$contestname = $_GET['contestname'];
if (isset($_GET['date']))
$cdate = $_GET['date'];
else
$cdate = 0;
$cwd =getcwd();
$gcucpath=$cwd."/";
#{date}20160309{/date}{task}1{/task}{validday}1{/validday}
$ci1="{date}";
$ci2="{/date}{task}1{/task}{validday}1{/validday}";
if ($cdate == 0)
{
$dtz= new DateTimeZone("UTC");
$dt= new DateTime("now", $dtz);
$ts= $dt->format("U");
$ts -=86400*5;
$date = date_create_from_format('U', $ts);
$tf = $date->format("Ymd");
echo $ci1,$tf,$ci2;
$ts += 86400;
$date = date_create_from_format('U', $ts);
$tf = $date->format("Ymd");
echo $ci1,$tf,$ci2;
$ts += 86400;
$date = date_create_from_format('U', $ts);
$tf = $date->format("Ymd");
echo $ci1,$tf,$ci2;
$ts += 86400;
$date = date_create_from_format('U', $ts);
$tf = $date->format("Ymd");
echo $ci1,$tf,$ci2;
$ts += 86400;
$date = date_create_from_format('U', $ts);
$tf = $date->format("Ymd");
echo $ci1,$tf,$ci2;
echo $ci1,$dt->format("Ymd"),$ci2;
}
elseif ($contestname == "LIVE")
{
//echo $cdate,"TD:", date('Ymd');
if ($cdate == date('Ymd'))
{
$rc=0;
ob_start();
passthru('/usr/bin/python3 '.$gcucpath.'gencuc.py '.$_SERVER['REMOTE_ADDR'].' >>cucmsgs.log', $rc);
$output = ob_get_clean();
#echo $rc, $output;
if ($rc == 0)
{
$myfilename="cuc/".$contestname.$cdate.".cuc";
$myfile = fopen("cuc/".$contestname.$cdate.".cuc", "r") or die("Unable to open file!".$myfilename);
echo fread($myfile,filesize("cuc/".$contestname.$cdate.".cuc"));
fclose($myfile);
}
else
{echo "No flights found...";}
}
else
{
$myfilename="cuc/".$contestname.$cdate.".cuc";
$myfile = fopen("cuc/".$contestname.$cdate.".cuc", "r") or die("Unable to open file!".$myfilename);
echo fread($myfile,filesize("cuc/".$contestname.$cdate.".cuc"));
fclose($myfile);
}
}
else
{
$myfilename="cuc/".$contestname.$cdate.".cuc";
$myfile = fopen("cuc/".$contestname.$cdate.".cuc", "r") or die("Unable to open file!".$myfilename);
echo fread($myfile,filesize("cuc/".$contestname.$cdate.".cuc"));
fclose($myfile);
}
?>