-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebnovel_data.php
67 lines (53 loc) · 1.9 KB
/
webnovel_data.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
<?php
require_once('config.php');
require_once('functions.inc.php');
require_once('WLNUpdates.php');
require_once('WebNovel.php');
$loggued=false;
if(direct()) include('header.php');
$action=0;
if(array_key_exists('action', $_REQUEST) && (is_int($_REQUEST['action'])||ctype_digit($_REQUEST['action']))) {
$action=(int)($_REQUEST['action']);
}
$wn=new WebNovel;
$res=$wn->checkLogin();
if($res->code!=0) {
var_dump($res->code, $res->msg);
$res=$wn->login( $accounts['WebNovel']['user'], $accounts['WebNovel']['pass']);
var_dump($res);
}
$files=array();
$res=json_decode(file_get_contents($wn::FOLDER.'_books.json'));
if(is_object($res)) $res=get_object_vars($res);
$files['_books.json']=count($res);
$res=json_decode(file_get_contents($wn::FOLDER.'_books2.json'));
if(is_object($res)) $res=get_object_vars($res);
$files['_books2.json']=count($res);
$res=json_decode(file_get_contents($wn::FOLDER.'_order.json'));
$files['_order.json']=count($res);
$fn=$wn::FOLDER.'_history.json';
if(!file_exists($fn) || (time()-filemtime($fn))>604800) $res2=$wn->history();
$res=json_decode(file_get_contents($fn));
$files['_history.json']=count($res);
$files['ReadingHistoryAjax']=count($res[0]);
$files['get-history']=count($res[1]);
$fn=$wn::FOLDER.'_collection.json';
if(!file_exists($fn) || (time()-filemtime($fn))>604800) $res2=$wn->collections();
$res=json_decode(file_get_contents($fn), true, 512, JSON_OBJECT_AS_ARRAY);
$res3=array_keys($res);
$files['_collection.json']=count($res);
$cols=array();
for($i=0;$i<count($res);$i++) {
$cols[$i.' : '.$res3[$i]]=count($res[$res3[$i]]);
}
$files['_collection.json data']=array_sum($cols);
ob_start();
print_table(array($files));
$data=ob_get_clean();
ob_start();
print_table(array($cols));
$data.=ob_get_clean();
file_put_contents('webnovel_data.htm', $data);
echo $data;
unset($data);
if(direct()) include('footer.php');