Skip to content
This repository was archived by the owner on Mar 1, 2025. It is now read-only.

Commit d3b7a43

Browse files
committed
Picture API Updated
1 parent f867643 commit d3b7a43

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

pic/config.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
$servername = '';
3+
$username = '';
4+
$password = '';
5+
$db = '';
6+
$conn = new mysqli($servername, $username, $password, $db);

pic/index.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
require_once 'config.php';
3+
if ($conn->connect_error)
4+
exit;
5+
6+
function rd($folder)
7+
{
8+
global $conn;
9+
mt_srand(time());
10+
$row = mysqli_num_rows(mysqli_query($conn, "SELECT * FROM `{$folder}`"));
11+
$rand = mt_rand(0, $row - 1);
12+
$result = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM `{$folder}` LIMIT {$rand},1 "));
13+
return rtrim($result['name']);
14+
}
15+
16+
$files = array('0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1.0', '1.1', '1.2', '1.3', '1.4');
17+
$get = $_GET;
18+
19+
if (array_key_exists('proxy', $get)) {
20+
if (array_key_exists('size', $get)) {
21+
$size = $get['size'];
22+
if (in_array($size, $files) && strstr($size, '.')) {
23+
$name = rd($size);
24+
header("Location: https://drive.sakurapuare.com/Picture/{$size}/{$name}.png?raw&proxied&thumbnail=large");
25+
}
26+
} else {
27+
$folder = $files[array_rand($files)];
28+
$name = rd($folder);
29+
header("Location: https://drive.sakurapuare.com/Picture/{$folder}/{$name}.png?raw&proxied&thumbnail=large");
30+
}
31+
} else {
32+
if (array_key_exists('size', $get)) {
33+
$size = $get['size'];
34+
if (in_array($size, $files) && strstr($size, '.')) {
35+
$name = rd($size);
36+
header("Location: https://oracle.sakurapuare.com/{$size}/{$name}.png");
37+
}
38+
} else {
39+
$folder = $files[array_rand($files)];
40+
$name = rd($folder);
41+
header("Location: https://oracle.sakurapuare.com/{$folder}/{$name}.png");
42+
}
43+
}

0 commit comments

Comments
 (0)