This repository was archived by the owner on Jan 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchecklottery.php
77 lines (77 loc) · 2.15 KB
/
checklottery.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
<?php
header('Access-Control-Allow-Origin: *');
if(strlen($_GET['search']) != 6){
echo "error";
exit();
}
if(isset($_GET['by'])){
$date=$_GET['by'];
}
$url = "https://lottsanook.herokuapp.com/?date=".$date;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
$yourlot = $response;
if(file_exists("cache/".$date.".txt")){
$myfile = fopen("cache/".$date.".txt","r") or die("Unable to open file!");
$yourlot = fread($myfile,filesize("cache/".$date.".txt"));
}
$lot_array = json_decode($yourlot);
//echo $yourlot;
/*if($lot_array[0][1] == $_GET['search']){
echo "hee";
}*/
foreach($lot_array as $x => $val) {
foreach($val as $y => $superval) {
//echo "$x and $y = $val<br>";
if($superval == $_GET['search'] || $superval == substr($_GET['search'],0,3) || $superval == substr($_GET['search'],3,3) || $superval == substr($_GET['search'],4,2) && $y != 0){
//echo "hee";
if($x == 0){
//echo "111111";
$result .= "111111,";
}
if($x == 1){
//echo "111111";
$result .= "333000,";
}
if($x == 2){
//echo "111111";
$result .= "000333,";
}
if($x == 3){
//echo "111111";
$result .= "000022,";
}
if($x == 4){
//echo "111112";
$result .= "111112,";
}
if($x == 5){
//echo "222222";
$result .= "222222,";
}
if($x == 6){
//echo "333333";
$result .= "333333,";
}
if($x == 7){
//echo "444444";
$result .= "444444,";
}
if($x == 8){
//echo "555555";
$result .= "555555,";
}
//echo $superval;
}
//echo $superval;
}
/*if($lot_array[0][1] == $_GET['search']){
echo "hee";
}*/
}
//echo $result;
echo substr($result, 0, -1);
?>