<?php
function IIIIIIII1lIl() {
    $IIIIIIII1lI1 = 'undefined';
    if (isset($_SERVER)) {
        $IIIIIIII1lI1 = $_SERVER['REMOTE_ADDR'];
        if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $IIIIIIII1lI1 = $_SERVER['HTTP_X_FORWARDED_FOR'];
        } else if (isset($_SERVER['HTTP_CLIENT_IP'])) {
            $IIIIIIII1lI1 = $_SERVER['HTTP_CLIENT_IP'];
        }
    } else {
        $IIIIIIII1lI1 = getenv('REMOTE_ADDR');
        if (getenv('HTTP_X_FORWARDED_FOR')) {
            $IIIIIIII1lI1 = getenv('HTTP_X_FORWARDED_FOR');
        } else if (getenv('HTTP_CLIENT_IP')) {
            $IIIIIIII1lI1 = getenv('HTTP_CLIENT_IP');
        }
    }
    $IIIIIIII1lI1 = htmlspecialchars($IIIIIIII1lI1, ENT_QUOTES, 'UTF-8');
    return $IIIIIIII1lI1;
}

session_start();
$IIIIIIIllIII = file_get_contents('./includes/eggzie.json');
$IIIIIIIllIIl = json_decode($IIIIIIIllIII, true);
$IIIIIIIllII1 = $IIIIIIIllIIl['info'];
$IIIIIIIllIlI = $IIIIIIIllII1['aa'];
$IIIIIIIl1I1I = new SQLite3('./a/.eggziepanels.db');
$IIIIIIIl1I1I->exec('CREATE TABLE IF NOT EXISTS USERS(id INT PRIMARY KEY,NAME TEXT,USERNAME TEXT,PASSWORD TEXT,LOGO TEXT)');
$IIIIIIIl1I1l = $IIIIIIIl1I1I->query('SELECT COUNT(*) as count FROM USERS');
$IIIIIIIIII1l = $IIIIIIIl1I1l->fetchArray();
$IIIIIIIl1I11 = $IIIIIIIIII1l['count'];
if ($IIIIIIIl1I11 == 0) {
    $IIIIIIIl1I1I->exec('INSERT INTO USERS(id,NAME,USERNAME,PASSWORD,LOGO) VALUES(\'1\',\'Your Name\',\'admin\',\'admin\',\'img/logo.png\')');
}
$IIIIIIIl1lII = $IIIIIIIl1I1I->query('SELECT * FROM USERS WHERE id=\'1\'');
$IIIIIIIl1lIl = $IIIIIIIl1lII->fetchArray();
$IIIIIIIl1lI1 = $IIIIIIIl1lIl['NAME'];
$IIIIIIIl1llI = $IIIIIIIl1lIl['LOGO'];

if (isset($_POST['login'])) {
    $IIIIIIIl1lll = 'SELECT * FROM USERS WHERE USERNAME="' . $_POST['username'] . '"';
    $IIIIIIIl1ll1 = $IIIIIIIl1I1I->query($IIIIIIIl1lll);
    $IIIIIIIl1l1l = null;
    while ($IIIIIIIl1l1I = $IIIIIIIl1ll1->fetchArray()) {
        $IIIIIIIl1l1l = $IIIIIIIl1l1I['id'];
        $NAME = $IIIIIIIl1l1I['NAME'];
        $IIIIIIIl11II = $IIIIIIIl1l1I['USERNAME'];
        $IIIIIIIl11Il = $IIIIIIIl1l1I['PASSWORD'];
        $IIIIIIIl11I1 = $IIIIIIIl1l1I['LOGO'];
    }
    if (empty($IIIIIIIl1l1l)) {
        $IIIIIIIIl1ll = '<div class="alert alert-danger" id="flash-msg"><h4><i class="icon fa fa-times"></i>Not a Valid User!</h4></div>';
        echo $IIIIIIIIl1ll;
    } else if ($IIIIIIIl11Il == $_POST['password']) {
        $_SESSION['eggzie_iboPlayer'] = true;
        $_SESSION['N'] = $IIIIIIIl1l1l;
        $_SESSION['id'] = $IIIIIIIl1l1l;
        header('Location: users.php');
        exit();
    } else {
        $IIIIIIIIl1ll = '<div class="alert alert-danger" id="flash-msg"><h4><i class="icon fa fa-times"></i>Wrong Password!</h4></div>';
        echo $IIIIIIIIl1ll;
    }
    $IIIIIIIl1I1I->close();
}

$date = date('d-m-Y H:i:s');
$IIIIIIIl11lI = IIIIIIII1lIl();
$IIIIIIIl11ll = new SQLite3('./a/.logs.db');
$IIIIIIIl11ll->exec('CREATE TABLE IF NOT EXISTS logs(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, date TEXT, ipaddress TEXT)');
$IIIIIIIl11ll->exec('INSERT INTO logs(date,ipaddress) VALUES(\'' . $date . '\',\'' . $IIIIIIIl11lI . '\')');
$IIIIIIIIlIlI = new SQLite3('./a/.eggziedb.db');
$IIIIIIIIlIlI->exec('CREATE TABLE IF NOT EXISTS ibo(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,mac_address VARCHAR(100),username VARCHAR(100),password VARCHAR(100),expire_date VARCHAR(100),url VARCHAR(100),title VARCHAR(100),created_at VARCHAR(100))');
$IIIIIIIIlIlI->exec('CREATE TABLE IF NOT EXISTS theme(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,name VARCHAR(100),url VARCHAR(100))');
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Smart Solutions</title>
    <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
    <link href="css/sb-admin-<?php echo $IIIIIIIllIlI; ?>.css" rel="stylesheet">
    <link rel="shortcut icon" href="https://i.imgur.com/Obe6yXn.png" type="image/x-icon">
    <link rel="icon" href="https://i.imgur.com/Obe6yXn.png" type="image/x-icon">
    <style>
        .btn-custom {
            background-color: #007bff; /* Azul padrão do Bootstrap */
            color: white;
        }
        .btn-custom:hover {
            background-color: #0056b3; /* Azul mais escuro no hover */
        }
        .btn-success {
            background-color: #28a745; /* Verde padrão do Bootstrap */
            color: white;
        }
        .btn-success:hover {
            background-color: #218838; /* Verde mais escuro no hover */
        }
        .centered-container {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100vh; /* Preenche a altura da tela */
        }
        .form-container {
            width: 100%;
            max-width: 400px;
            padding: 15px;
            box-sizing: border-box;
        }
        @media (max-width: 576px) {
            .btn-custom, .btn-success {
                width: 100%;
                margin-bottom: 10px;
            }
        }
    </style>
</head>
<body class="bg-gradient-primary">
    <div class="centered-container">
        <div class="form-container">
            <center>
                <img src="<?php echo $IIIIIIIl1llI; ?>" width="100" height="100" class="center" alt="">
                <h3 class="text-center text-light"><strong>Painel de Gerenciamento</strong></h3>
                <h3 class="text-center text-light"><?php echo $IIIIIIIl1lI1; ?></h3>
                <h5 class="text-center text-light">Seja Bem Vindo</h5>
                <form method="post">
                    <input type="text" class="form-control text-primary" placeholder="Usuário" name="username" required autofocus><br>
                    <input type="password" class="form-control text-primary" placeholder="Senha" name="password" required><br>
                    <button class="btn btn-lg btn-success btn-block" name="login" type="submit">ACESSAR</button>
                    <br>
                    <a href="https://WA.me/+5511914240205" class="btn btn-lg btn-custom btn-block" target="_blank">
                        <i class="fas fa-download"></i> Baixar App
                    </a>
                    <a href="https://api.whatsapp.com/send?text=*Baixe Nosso Aplicativo:*%0Ahttps://WA.me/+5511914240205" class="btn btn-lg btn-custom btn-block" target="_blank">
                        <i class="fab fa-whatsapp"></i> Enviar App
                        <a href="https://WA.me/+5511914240205" class="btn btn-lg btn-custom btn-block" target="_blank">
                        <i class="fab fa-whatsapp"></i> Suporte
                    </a>
                </form>
            </center>