Testpanel klasörüne güncel dosyalar eklendi

This commit is contained in:
2026-04-20 22:28:31 +03:00
commit eb7e1a2b0f
107 changed files with 16317 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
<?php
session_start();
header('Content-Type: application/json');
try {
$db = new PDO('sqlite:../ibo_panel.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
ini_set("log_errors", 1);
ini_set("error_log", "error_log.txt");
$input = json_decode(file_get_contents('php://input'), true); // JSON veriyi alın
$action = $input['action'] ?? 'view';
if ($action === 'view') {
$stmt = $db->query("SELECT * FROM dns");
$dnsRecords = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(['success' => true, 'data' => $dnsRecords]);
} elseif ($action === 'add') {
$title = trim($input['title']);
$url = trim($input['url']);
if (empty($title) || empty($url)) {
echo json_encode(['success' => false, 'message' => 'Title and URL are required']);
exit();
}
$stmt = $db->prepare("INSERT INTO dns (title, url) VALUES (:title, :url)");
$stmt->bindParam(':title', $title);
$stmt->bindParam(':url', $url);
$stmt->execute();
$newId = $db->lastInsertId(); // Yeni eklenen kaydın ID'sini al
echo json_encode(['success' => true, 'message' => 'DNS added successfully', 'new_id' => $newId]);
} elseif ($action === 'edit') {
$id = $input['id'];
$title = trim($input['title']);
$url = trim($input['url']);
$stmt = $db->prepare("UPDATE dns SET title = :title, url = :url WHERE id = :id");
$stmt->bindParam(':id', $id);
$stmt->bindParam(':title', $title);
$stmt->bindParam(':url', $url);
$stmt->execute();
echo json_encode(['success' => true, 'message' => 'DNS updated successfully']);
} elseif ($action === 'delete') {
$id = $input['id'];
$stmt = $db->prepare("DELETE FROM dns WHERE id = :id");
$stmt->bindParam(':id', $id);
$stmt->execute();
echo json_encode(['success' => true, 'message' => 'DNS deleted successfully']);
} else {
echo json_encode(['success' => false, 'message' => 'Invalid action']);
}
} catch (PDOException $e) {
error_log("Database error: " . $e->getMessage());
echo json_encode(['success' => false, 'message' => 'Database error: ' . $e->getMessage()]);
}

View File

View File

@@ -0,0 +1,75 @@
<?php
session_start();
header('Content-Type: application/json');
try {
$db = new PDO('sqlite:../ibo_panel.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$input = json_decode(file_get_contents('php://input'), true);
$action = $input['action'] ?? 'view';
if ($action === 'view') {
$stmt = $db->query("SELECT * FROM playlist");
$playlistRecords = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(['success' => true, 'data' => $playlistRecords]);
} elseif ($action === 'get_dns_options') {
$stmt = $db->query("SELECT id, title FROM dns");
$dnsOptions = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(['success' => true, 'data' => $dnsOptions]);
} elseif ($action === 'add') {
$dns_id = trim($input['dns_id']);
$mac_address = trim($input['mac_address']);
$username = trim($input['username']);
$password = trim($input['password']);
$pin = trim($input['pin']);
if (empty($dns_id) || empty($mac_address) || empty($username) || empty($password) || empty($pin)) {
echo json_encode(['success' => false, 'message' => 'All fields are required']);
exit();
}
$stmt = $db->prepare("INSERT INTO playlist (dns_id, mac_address, username, password, pin) VALUES (:dns_id, :mac_address, :username, :password, :pin)");
$stmt->execute([
':dns_id' => $dns_id,
':mac_address' => $mac_address,
':username' => $username,
':password' => $password,
':pin' => $pin,
]);
$newId = $db->lastInsertId();
echo json_encode(['success' => true, 'message' => 'Playlist entry added successfully', 'new_id' => $newId]);
} elseif ($action === 'edit') {
$id = $input['id'];
$dns_id = trim($input['dns_id']);
$mac_address = trim($input['mac_address']);
$username = trim($input['username']);
$password = trim($input['password']);
$pin = trim($input['pin']);
$stmt = $db->prepare("UPDATE playlist SET dns_id = :dns_id, mac_address = :mac_address, username = :username, password = :password, pin = :pin WHERE id = :id");
$stmt->execute([
':dns_id' => $dns_id,
':mac_address' => $mac_address,
':username' => $username,
':password' => $password,
':pin' => $pin,
':id' => $id,
]);
echo json_encode(['success' => true, 'message' => 'Playlist entry updated successfully']);
} elseif ($action === 'delete') {
$id = $input['id'];
$stmt = $db->prepare("DELETE FROM playlist WHERE id = :id");
$stmt->execute([':id' => $id]);
echo json_encode(['success' => true, 'message' => 'Playlist entry deleted successfully']);
} else {
echo json_encode(['success' => false, 'message' => 'Invalid action']);
}
} catch (PDOException $e) {
echo json_encode(['success' => false, 'message' => 'Database error: ' . $e->getMessage()]);
}
?>

View File

@@ -0,0 +1,61 @@
<?php
session_start();
header('Content-Type: application/json');
try {
$db = new PDO('sqlite:../ibo_panel.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$input = json_decode(file_get_contents('php://input'), true);
$action = $input['action'] ?? 'view';
if ($action === 'view') {
$stmt = $db->query("SELECT * FROM settings");
$notes = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(['success' => true, 'data' => $notes]);
} elseif ($action === 'add') {
$note_title = trim($input['note_title']);
$note_content = trim($input['note_content']);
if (empty($note_title) || empty($note_content)) {
echo json_encode(['success' => false, 'message' => 'Title and Content are required']);
exit();
}
$stmt = $db->prepare("INSERT INTO settings (note_title, note_content) VALUES (:note_title, :note_content)");
$stmt->bindParam(':note_title', $note_title);
$stmt->bindParam(':note_content', $note_content);
$stmt->execute();
$newId = $db->lastInsertId();
echo json_encode(['success' => true, 'message' => 'Note added successfully', 'new_id' => $newId]);
} elseif ($action === 'edit') {
$id = $input['id'];
$note_title = trim($input['note_title']);
$note_content = trim($input['note_content']);
$stmt = $db->prepare("UPDATE settings SET note_title = :note_title, note_content = :note_content WHERE id = :id");
$stmt->bindParam(':id', $id);
$stmt->bindParam(':note_title', $note_title);
$stmt->bindParam(':note_content', $note_content);
$stmt->execute();
echo json_encode(['success' => true, 'message' => 'Note updated successfully']);
} elseif ($action === 'delete') {
$id = $input['id'];
$stmt = $db->prepare("DELETE FROM settings WHERE id = :id");
$stmt->bindParam(':id', $id);
$stmt->execute();
echo json_encode(['success' => true, 'message' => 'Note deleted successfully']);
} else {
echo json_encode(['success' => false, 'message' => 'Invalid action']);
}
} catch (PDOException $e) {
error_log("Database error: " . $e->getMessage());
echo json_encode(['success' => false, 'message' => 'Database error: ' . $e->getMessage()]);
}
?>

View File

@@ -0,0 +1,42 @@
<?php
session_start();
header('Content-Type: application/json');
try {
$db = new PDO('sqlite:../ibo_panel.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$input = json_decode(file_get_contents('php://input'), true);
$action = $input['action'] ?? 'view';
if ($action === 'view') {
$stmt = $db->query("SELECT * FROM themes LIMIT 1");
$theme = $stmt->fetch(PDO::FETCH_ASSOC);
echo json_encode(['success' => true, 'data' => $theme]);
} elseif ($action === 'edit') {
$theme_id = trim($input['theme_id']);
if (empty($theme_id)) {
echo json_encode(['success' => false, 'message' => 'Theme ID is required']);
exit();
}
$theme_number = str_replace('theme_', '', $theme_id);
if (!is_numeric($theme_number)) {
echo json_encode(['success' => false, 'message' => 'Invalid Theme ID format']);
exit();
}
$stmt = $db->prepare("UPDATE themes SET theme_id = :theme_id");
$stmt->execute([':theme_id' => $theme_number]);
echo json_encode(['success' => true, 'message' => 'Theme updated successfully']);
} else {
echo json_encode(['success' => false, 'message' => 'Invalid action']);
}
} catch (PDOException $e) {
echo json_encode(['success' => false, 'message' => 'Database error: ' . $e->getMessage()]);
}
?>

View File

@@ -0,0 +1,41 @@
<?php
session_start();
header('Content-Type: application/json');
try {
$db = new PDO('sqlite:../ibo_panel.db');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$input = json_decode(file_get_contents('php://input'), true);
$action = $input['action'] ?? 'view';
if ($action === 'view') {
$stmt = $db->query("SELECT id, username FROM users"); // Yalnızca gerekli alanları alıyoruz
$users = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(['success' => true, 'data' => $users]);
} elseif ($action === 'edit') {
$id = $input['id'];
$username = trim($input['username']);
$password = trim($input['password']);
if (empty($username) || empty($password)) {
echo json_encode(['success' => false, 'message' => 'Username and Password are required']);
exit();
}
$stmt = $db->prepare("UPDATE users SET username = :username, password = :password WHERE id = :id");
$stmt->bindParam(':id', $id);
$stmt->bindParam(':username', $username);
$stmt->bindParam(':password', $password);
$stmt->execute();
echo json_encode(['success' => true, 'message' => 'User updated successfully']);
} else {
echo json_encode(['success' => false, 'message' => 'Invalid action']);
}
} catch (PDOException $e) {
error_log("Database error: " . $e->getMessage());
echo json_encode(['success' => false, 'message' => 'Database error: ' . $e->getMessage()]);
}
?>