-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave.php
More file actions
58 lines (43 loc) · 1.71 KB
/
Copy pathsave.php
File metadata and controls
58 lines (43 loc) · 1.71 KB
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
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
header('Access-Control-Allow-Headers: Content-Type, Authorization');
require_once('config.php');
require_once('lib.php');
session_start();
if (!isset($_GET['url'])) die('请输入url');
$parsed = parse_url($_GET['url']);
$url = $_GET['url'];
if ($parsed['host'] != 'www.luogu.com.cn') die('只能解析洛谷帖子QwQ');
$thread = intval(basename($parsed['path']));
parse_str($parsed['query'], $out);
$page = intval($out['page']);
if (!$page || $page == 0) $page = 1;
$q0 = $link->query("select thread from discuss_count where title != 'None' and title != '' order by thread desc limit 1")->fetch_assoc();
if (!isset($_SESSION['admin']))
if ($thread < $st_thread || $q0['thread'] - $thread > 70000000) die('帖子超出时间范围');
if ($r = save($thread, $page, $cnt, $title, $creply)) {
if ($r == 2) die('帖子标题包含屏蔽词');
echo 'success';
} else
echo '帖子已被删除';
$arr = $link->query("select * from discuss_log where thread=$thread and page=$page")->fetch_assoc();
if ($title != 'None') addClick($thread, $title, $creply);
else addClick($thread, $arr['title']);
if (!$r || $cnt < 11) die();
/* begin close the connection to the browser */
$size = ob_get_length();
header("Content-Length: $size");
header("Connection: Close");
ob_flush();
flush();
/* end */
// get more pages after disconnecting
for ($i = 1; $i <= 10; ++$i) {
$npage = $page + $i;
$q = $link->query("select title from discuss_log where thread=$thread page=$npage+1");
// if ($q->num_rows) continue;
$r = save($thread, $npage, $cnt, $title);
if ($cnt < 11 || !$r) break; // stop
}
$link->close();