This repository was archived by the owner on Aug 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
105 lines (105 loc) · 4.08 KB
/
index.php
File metadata and controls
105 lines (105 loc) · 4.08 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
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
<!DOCTYPE HTML>
<html>
<head>
<link rel="icon" href="//static.b.osu.pink/favicon.ico">
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title><?php if (isset($_GET['user'])) { echo $_GET['user'].' - '; } ?>批量下osu!bp</title>
<style>
a {
color:#0989f6;
text-decoration:none;
}
h2 {
display:inline;
}
.right {
float:right;
}
</style>
</head>
<body>
<h2>批量下osu!bp</h2>
<span class="right">推广: <a href="https://jq.qq.com/?_wv=1027&k=bOW1smaP">BanYou 玩家群 (osu! 私服)</a></span>
<hr>
<form method="get">
<p>账号(不得为空):<input type="text" name="user" autocomplete="off"></p>
<p>数量(1-100,默认为10):<input type="text" name="limit" autocomplete="off"></p>
<p>模式(默认为osu!std):<br>
osu!std:<input type="radio" name="mode" checked="checked" value="0">
<br>
osu!Taiko:<input type="radio" name="mode" value="1">
<br>
osu!CatchTheBeat:<input type="radio" name="mode" value="2">
<br>
osu!mania:<input type="radio" name="mode" value="3">
</p>
<input type="submit" value="查询">
</form>
<?php
error_reporting(1);
set_time_limit(300);
require_once('config.php');
require_once('../BanYouBot/botconfig.php');
require_once('../BanYouBot/apis/bmcacheLib.php');
$conn=new mysqli(DbAddress,DbUsername,DbPassword,DbName);
if (!empty($_GET['user'])) {
$cacheerror=0;
if (cache) {
$memcache=new Memcache;
if (!$memcache->connect(memadd,memport)) {
$cacheerror=1;
echo "<p>缓存连接失败.</p>\n";
}
}
$user=$_GET['user'];
$limit=(!empty($_GET['limit']) && is_numeric($_GET['limit']) && 1<=$_GET['limit'] && $_GET['limit']<=100) ? $_GET['limit'] : 10;
$mode=(!empty($_GET['mode']) && is_numeric($_GET['mode']) && 0<=$_GET['mode'] && $_GET['mode']<=3) ? $_GET['mode'] :0;
if (empty($_GET['limit']) || !isset($_GET['mode']) || $_GET['mode'] === '') {
header('HTTP/1.1 301 Moved Permanently');
header("Location:http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?user=$user&limit=$limit&mode=$mode");
}
if ($bp=get_bp($user,$mode,$limit)) {
echo "<script>\nfunction alldownload(name) {\nname=document.getElementsByName(name);\nfor (var i=0;i<name.length;i++) {\nvar iframe=document.createElement('iframe');\niframe.src=name[i].href;\niframe.style.display=\"none\";\ndocument.getElementsByTagName('p')[i].appendChild(iframe);\n}\n}\n</script>\n<p><button onclick=\"alldownload('osu');\">批量下载</button> <button onclick=\"alldownload('sayobot');\">批量下载 (Sayobot)</button></p>\n";
for ($i=0;$i<count($bp);$i++) {
$now=$i+1;
$bmid=$bp[$i]['beatmap_id'];
$bms=getbeatmapinfo("b={$bmid}","beatmap_id = {$bmid}",0,1,1,1,1);
if ($bms === 0) {
continue;
}
$bm=$beatmaps[0];
$pp=$bp[$i]['pp'];
$date=$bp[$i]['date'];
$rank=$bp[$i]['rank'];
$bmid=$bm['beatmap_id'];
$bmdid=$bm['beatmapset_id'];
$title=htmlspecialchars($bm['title']);
$score=$bp[$i]['score'];
$artist=htmlspecialchars($bm['artist']);
$version=htmlspecialchars($bm['version']);
$perfect=$bp[$i]['perfect'] ? ' (Perfect) ' : ' ';
$maxcombo=$bp[$i]['maxcombo'];
$count50=$bp[$i]['count50'];
$count100=$bp[$i]['count100'];
$count300=$bp[$i]['count300'];
$countmiss=$bp[$i]['countmiss'];
$countkatu=$bp[$i]['countkatu'];
$countgeki=$bp[$i]['countgeki'];
echo "<p>".$now."、<img src=\"https://s.ppy.sh/images/$rank".'_small.png'."\"> $artist - $title [$version]".$perfect."PP:$pp Combo:$maxcombo Score:$score countmiss:$countmiss count50:$count50 count100:$count100 count300:$count300 countkatu:$countkatu countgeki:$countgeki Date:$date <a href=\"https://osu.ppy.sh/b/$bmid\">谱面地址</a> <a name=\"osu\" href=\"https://osu.ppy.sh/d/$bmdid\">下载地址</a> <a name=\"sayobot\" href=\"https://txy1.sayobot.cn/beatmaps/download/$bmdid\">下载地址 (Sayobot)</a></p>\n";
ob_flush();
flush();
}
} else {
echo "<p>找不到该账号.</p>\n";
}
if (cache && !$cacheerror) {
$memcache->close();
}
} elseif (isset($_GET['user'])) {
header('HTTP/1.1 301 Moved Permanently');
header("Location:http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}");
}
?>
</body>
</html>