diff --git a/admin/index.php b/admin/index.php index e2076d7..421b5db 100644 --- a/admin/index.php +++ b/admin/index.php @@ -818,6 +818,32 @@ tr:hover td{background:rgba(255,255,255,.015)} +
+
Sub-Account
+
+
+ + +
+
+ + +
+
+
+
+
Cashier
+
+
+ + +
+
+ + +
+
+
@@ -2742,6 +2768,24 @@ async function loadGames() { ${escHtmlA(g.agent_password)}
` : ''} ${g.agent_guide ? `
AGENT GUIDE ${escHtmlA(g.agent_guide)}
` : ''} + ${(g.sub_agent_login||g.sub_agent_password) ? `
SUB-ACCOUNT
` : ''} + ${g.sub_agent_login ? `
+ LOGIN + ${escHtmlA(g.sub_agent_login)} +
` : ''} + ${g.sub_agent_password ? `
+ PASSWORD + ${escHtmlA(g.sub_agent_password)} +
` : ''} + ${(g.cashier_login||g.cashier_password) ? `
CASHIER
` : ''} + ${g.cashier_login ? `
+ LOGIN + ${escHtmlA(g.cashier_login)} +
` : ''} + ${g.cashier_password ? `
+ PASSWORD + ${escHtmlA(g.cashier_password)} +
` : ''}
@@ -2768,8 +2812,12 @@ function editGame(id) { document.getElementById('gf-agent-login').value = g.agent_login || ''; document.getElementById('gf-agent-password').value= g.agent_password || ''; document.getElementById('gf-games-link').value = g.games_link || ''; - document.getElementById('gf-agent-guide').value = g.agent_guide || ''; - document.getElementById('gf-color').value = g.color || '#f0c040'; + document.getElementById('gf-agent-guide').value = g.agent_guide || ''; + document.getElementById('gf-sub-agent-login').value = g.sub_agent_login || ''; + document.getElementById('gf-sub-agent-password').value = g.sub_agent_password || ''; + document.getElementById('gf-cashier-login').value = g.cashier_login || ''; + document.getElementById('gf-cashier-password').value = g.cashier_password || ''; + document.getElementById('gf-color').value = g.color || '#f0c040'; document.getElementById('gf-color-hex').value = g.color || '#f0c040'; document.getElementById('gf-sort').value = g.sort_order; document.getElementById('gf-active').value = g.is_active; @@ -2787,8 +2835,12 @@ function resetGameForm() { document.getElementById('gf-agent-login').value = ''; document.getElementById('gf-agent-password').value= ''; document.getElementById('gf-games-link').value = ''; - document.getElementById('gf-agent-guide').value = ''; - document.getElementById('gf-color').value = '#f0c040'; + document.getElementById('gf-agent-guide').value = ''; + document.getElementById('gf-sub-agent-login').value = ''; + document.getElementById('gf-sub-agent-password').value = ''; + document.getElementById('gf-cashier-login').value = ''; + document.getElementById('gf-cashier-password').value = ''; + document.getElementById('gf-color').value = '#f0c040'; document.getElementById('gf-color-hex').value = '#f0c040'; document.getElementById('gf-sort').value = '99'; document.getElementById('gf-active').value = '1'; @@ -2812,8 +2864,12 @@ async function saveGame() { agent_login: document.getElementById('gf-agent-login').value.trim(), agent_password: document.getElementById('gf-agent-password').value.trim(), games_link: document.getElementById('gf-games-link').value.trim(), - agent_guide: document.getElementById('gf-agent-guide').value.trim(), - color: document.getElementById('gf-color-hex').value.trim() || document.getElementById('gf-color').value, + agent_guide: document.getElementById('gf-agent-guide').value.trim(), + sub_agent_login: document.getElementById('gf-sub-agent-login').value.trim(), + sub_agent_password: document.getElementById('gf-sub-agent-password').value.trim(), + cashier_login: document.getElementById('gf-cashier-login').value.trim(), + cashier_password: document.getElementById('gf-cashier-password').value.trim(), + color: document.getElementById('gf-color-hex').value.trim() || document.getElementById('gf-color').value, sort_order: parseInt(document.getElementById('gf-sort').value) || 99, is_active: parseInt(document.getElementById('gf-active').value), }; diff --git a/api/platforms.php b/api/platforms.php index 552f8f2..8414d9b 100644 --- a/api/platforms.php +++ b/api/platforms.php @@ -41,14 +41,18 @@ switch ($action) { $agent_login = substr(trim($d['agent_login'] ?? ''), 0, 200); $agent_password = substr(trim($d['agent_password'] ?? ''), 0, 200); $games_link = substr(trim($d['games_link'] ?? ''), 0, 500); - $agent_guide = trim($d['agent_guide'] ?? ''); + $agent_guide = trim($d['agent_guide'] ?? ''); + $sub_agent_login = substr(trim($d['sub_agent_login'] ?? ''), 0, 200); + $sub_agent_password= substr(trim($d['sub_agent_password'] ?? ''), 0, 200); + $cashier_login = substr(trim($d['cashier_login'] ?? ''), 0, 200); + $cashier_password = substr(trim($d['cashier_password'] ?? ''), 0, 200); $color = preg_match('/^#[0-9a-fA-F]{3,8}$/', $d['color'] ?? '') ? $d['color'] : '#f0c040'; $sort_order = (int)($d['sort_order'] ?? 99); $is_active = isset($d['is_active']) ? (int)(bool)$d['is_active'] : 1; if (!$slug || !$name || !$player_url) { echo json_encode(['success'=>false,'error'=>'Slug, name, and player URL are required']); exit; } try { - $stmt = db()->prepare("INSERT INTO platforms (slug,name,player_url,agent_link,agent_login,agent_password,games_link,agent_guide,color,sort_order,is_active) VALUES (?,?,?,?,?,?,?,?,?,?,?)"); - $stmt->execute([$slug,$name,$player_url,$agent_link,$agent_login,$agent_password,$games_link,$agent_guide,$color,$sort_order,$is_active]); + $stmt = db()->prepare("INSERT INTO platforms (slug,name,player_url,agent_link,agent_login,agent_password,games_link,agent_guide,sub_agent_login,sub_agent_password,cashier_login,cashier_password,color,sort_order,is_active) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); + $stmt->execute([$slug,$name,$player_url,$agent_link,$agent_login,$agent_password,$games_link,$agent_guide,$sub_agent_login,$sub_agent_password,$cashier_login,$cashier_password,$color,$sort_order,$is_active]); echo json_encode(['success'=>true,'id'=>db()->lastInsertId()]); } catch (Exception $e) { echo json_encode(['success'=>false,'error'=>'Slug already exists or DB error']); @@ -66,13 +70,17 @@ switch ($action) { $agent_login = substr(trim($d['agent_login'] ?? ''), 0, 200); $agent_password = substr(trim($d['agent_password'] ?? ''), 0, 200); $games_link = substr(trim($d['games_link'] ?? ''), 0, 500); - $agent_guide = trim($d['agent_guide'] ?? ''); + $agent_guide = trim($d['agent_guide'] ?? ''); + $sub_agent_login = substr(trim($d['sub_agent_login'] ?? ''), 0, 200); + $sub_agent_password= substr(trim($d['sub_agent_password'] ?? ''), 0, 200); + $cashier_login = substr(trim($d['cashier_login'] ?? ''), 0, 200); + $cashier_password = substr(trim($d['cashier_password'] ?? ''), 0, 200); $color = preg_match('/^#[0-9a-fA-F]{3,8}$/', $d['color'] ?? '') ? $d['color'] : '#f0c040'; $sort_order = (int)($d['sort_order'] ?? 99); $is_active = (int)(bool)($d['is_active'] ?? 1); if (!$id || !$name || !$player_url) { echo json_encode(['success'=>false,'error'=>'ID, name, and player URL required']); exit; } - db()->prepare("UPDATE platforms SET name=?,player_url=?,agent_link=?,agent_login=?,agent_password=?,games_link=?,agent_guide=?,color=?,sort_order=?,is_active=? WHERE id=?") - ->execute([$name,$player_url,$agent_link,$agent_login,$agent_password,$games_link,$agent_guide,$color,$sort_order,$is_active,$id]); + db()->prepare("UPDATE platforms SET name=?,player_url=?,agent_link=?,agent_login=?,agent_password=?,games_link=?,agent_guide=?,sub_agent_login=?,sub_agent_password=?,cashier_login=?,cashier_password=?,color=?,sort_order=?,is_active=? WHERE id=?") + ->execute([$name,$player_url,$agent_link,$agent_login,$agent_password,$games_link,$agent_guide,$sub_agent_login,$sub_agent_password,$cashier_login,$cashier_password,$color,$sort_order,$is_active,$id]); echo json_encode(['success'=>true]); break;