Initial import

This commit is contained in:
Admin Nasledstvo
2026-05-01 20:52:04 +03:00
commit ac168868ee
10028 changed files with 2337954 additions and 0 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1,6 @@
<?php
$ip_address = ['95.91.211.112', '95.90.247.100'];
if (!in_array($_SERVER['REMOTE_ADDR'], $ip_address))
die('Access denied from IP: '.$_SERVER['REMOTE_ADDR']);
require __DIR__ . '/adminer.php';
@@ -0,0 +1,6 @@
<?php
$ip_address = ['31.18.250.40'];
if (!in_array($_SERVER['REMOTE_ADDR'], $ip_address))
die('Access denied from IP: '.$_SERVER['REMOTE_ADDR']);
require __DIR__ . '/adminer.php';
@@ -0,0 +1,56 @@
<?php
// Connect to the MySQL database
$conn = new mysqli("hostname", "username", "password", "database_name");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Get the HTTP method, path and body of the request
$method = $_SERVER['REQUEST_METHOD'];
$request = explode('/', trim($_SERVER['PATH_INFO'],'/'));
$input = json_decode(file_get_contents('php://input'),true);
// retrieve the table and key from the path
$table = preg_replace('/[^a-z0-9_]+/i','',array_shift($request));
$key = array_shift($request)+0;
// create SQL based on HTTP method
switch ($method) {
case 'GET':
$sql = "select * from `$table`".($key?" WHERE id=$key":''); break;
case 'PUT':
$sql = "update `$table` set $set where id=$key"; break;
case 'POST':
$sql = "insert into `$table` set $set"; break;
case 'DELETE':
$sql = "delete `$table` where id=$key"; break;
}
// excecute SQL statement
$result = mysqli_query($conn,$sql);
// die if SQL statement failed
if (!$result) {
http_response_code(404);
die(mysqli_error());
}
// print results, insert id or affected row count
if ($method == 'GET') {
if (!$key) echo '[';
for ($i=0;$i<mysqli_num_rows($result);$i++) {
echo ($i>0?',':'').json_encode(mysqli_fetch_object($result));
}
if (!$key) echo ']';
} elseif ($method == 'POST') {
echo mysqli_insert_id($conn);
} else {
echo mysqli_affected_rows($conn);
}
// close mysql connection
$conn->close();
?>