-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcron.php
45 lines (38 loc) · 910 Bytes
/
cron.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
<?php
include ('./config.php');
include ('./functions.php');
$sites = glob('./sites/*.site');
foreach($sites as $site) {
$json = file_get_contents($site);
$json = json_decode($json);
$name = $json->name;
$url = $json->url;
$regx = $json->regx;
$status = $json->status;
$count = $json->count;
$pullData = curlGet($url);
if(preg_match("/$regx/i", $pullData)) {
$count = 0;
if($status == 0) {
$status = 1;
notifyOk($name);
}
}
else {
if($status == 1) {
if($count >= 1) {
$status = 0;
notifyError($name);
}
$count++;
}
}
$data = '{
"name" : "'.$name.'",
"url" : "'.$url.'",
"regx" : "'.$regx.'",
"status" : '.$status.',
"count" : '.$count.'
}';
file_put_contents($site, $data);
}