-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·124 lines (97 loc) · 3.2 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
<?php
$ch = curl_init();
$data = array(
"username" => "",
"password" => ""
);
$url2 = "pj24.ir/user/login.php";
curl_setopt($ch, CURLOPT_URL,"pj24.ir/user/login.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($ch, CURLOPT_TIMEOUT,10);
//curl_setopt($ch, CURLOPT_REFERER, $url2);
curl_setopt($ch, CURLOPT_ENCODING, '');
$output = curl_exec($ch);
//echo $output;
$now = new DateTime();
$formatter = new IntlDateFormatter(
"fa_IR@calender=persian",
IntlDateFormatter::SHORT,
IntlDateFormatter::SHORT,
'Asia/Tehran',
IntlDateFormatter::TRADITIONAL,
"MM - dd "
);
$url = "pj24.ir/user/index.php";
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 0);
//if($output == '{"ok":true}'){
//echo 'sucess';
//curl_setopt($ch, CURLOPT_URL,"pj24.ir/user/index.php");
$new = curl_exec($ch);
$find_thingsout = explode('<label class="btn btn-circle default green-stripe lable-cursor dashboard-chart-font">',$new);
echo $find_thingsout[1];
//echo $find_thingsout[2];
//echo "Today's date: " . $formatter->format($now);
//echo "<br>";
//}
curl_close($ch);
function convert_to_int( $persiannum ){
$persian_list_num = array(
'۱' => 1,
'۲' => 2,
'۳' => 3,
'۴' => 4,
'۵' => 5,
'۶' => 6,
'۷' => 7,
'۸' => 8,
'۹' => 9,
'۰' => 0,
'-' => '',
' ' => ''
);
$result = strtr($persiannum,$persian_list_num);
return $result;
}
/** Get Today date and convert it to int */
$tdate = $formatter->format($now);
//echo $tdate[6];
$final_tdate = convert_to_int($tdate);
$icount = strlen($final_tdate);
//echo $icount;
//echo $final_tdate;
$tdate_mounth = intval(substr($final_tdate, 0,2));
$tdate_day = intval(substr($final_tdate,2,5));
// $tdate_mounth = 7;
// $tdate_day = 25;
$imploded = strval($find_thingsout[2]);
echo "<br>";
$pj24_date_to_en = convert_to_int($imploded);
$remained_date_len = strlen($pj24_date_to_en);
/** To find the position number of each charecter */
//for( $i = 0 ; $i <= $remained_date_len -1; $i++ ){
// echo '<br>';
// echo 'position is ' . $i;
// echo ' - ' . $pj24_date_to_en[$i];
// }
$expire_mounth = intval(substr($pj24_date_to_en,167,2));
$start_day = intval(substr($pj24_date_to_en,29,2));
$expire_day = intval(substr($pj24_date_to_en,169,2));
if($tdate_mounth == $expire_mounth){
echo "Remained day is ", $expire_day - $tdate_day ;
}
if($tdate_mounth < $expire_mounth){
$static_int = $start_day;
$int1 = $tdate_day - $start_day;
if($tdate_mounth<= 6){
$remained_day = 31 - $int1;
echo "Remained day is ", $remained_day;
}
$remained_day = 30 - $int1;
echo "Remained day is ",$remained_day;
}