<?php

/*CONEXAO COM O BANCO*/
include "Connections/config.php";
/*********************/

ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
error_reporting(32767);
session_start();
$jsondata111 = file_get_contents("./includes/boxbr.json");
$json111 = json_decode($jsondata111, true);
$col1 = $json111["info"];
$col2 = $col1["aa"];

$res_login = $db->query("SELECT *  FROM users  WHERE id='1'");
$row_login = $res_login->fetch_array();
$name_login = $row_login["NAME"];
$logo_login = $row_login["LOGO"];
$corp_login = $row_login["CORP"];
if (isset($_POST["login"])) {
    if (!$db) {
        echo $db->lastErrorMsg();
    }
    $sql_check = "SELECT * from users where USERNAME=\"" . $_POST["username"] . "\"";
    $ret_check = $db->query($sql_check);
    while ($row_check = $ret_check->fetch_array()) {
        $id_check = $row_check["id"];
        $NAME = $row_check["NAME"];
        $username_check = $row_check["USERNAME"];
        $password_check = $row_check["PASSWORD"];
        $LOGO_check = $row_check["LOGO"];
        $CORP_check = $row_check["CORP"];
    }
    if (empty($id_check)) {
        $message = "<div class=\"alert alert-danger\" id=\"flash-msg\"><h4><i class=\"icon fa fa-times\"></i>Not a Valid User!</h4></div>";
        echo $message;
    } else {
        if ($password_check == $_POST["password"]) {
            $_SESSION["boxbr_admin_apk"] = true;
            $_SESSION["N"] = $id_check;
            $_SESSION["id"] = $id_check;
            if ($_POST["username"] == "admin" || $_POST["password"] == "admin") {
                //header("Location: newenter.php");
				header("Location: users.php");
            } else {
                header("Location: users.php");
            }
        } else {
            $message = "<div class=\"alert alert-danger\" id=\"flash-msg\"><h4><i class=\"icon fa fa-times\"></i>Wrong Password!</h4></div>";
            echo $message;
        }
    }
    
}
$date = date("d-m-Y H:i:s");
$IPADDRESS = $_SERVER['REMOTE_ADDR'];

$db->query("INSERT INTO logs(date,ipaddress) VALUES('$date','$IPADDRESS')");

echo "<!DOCTYPE html>\n<html>\n\n<head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <title>BoxBR Panel Manager</title>\n    <link href=\"vendor/fontawesome-free/css/all.min.css\" rel=\"stylesheet\" type=\"text/css\">\n    <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\">\n";
echo "    <link href=\"css/sb-admin-" . $col2 . ".css\" rel=\"stylesheet\">" . "\n";
echo "    \n<script src=\"https://code.jquery.com/jquery-3.2.1.min.js\" integrity=\"sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=\" crossorigin=\"anonymous\"></script>\n  <script defer src=\"https://use.fontawesome.com/releases/v5.0.1/js/all.js\"></script>\n\n  <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery.transit/0.9.12/jquery.transit.js\" integrity=\"sha256-mkdmXjMvBcpAyyFNCVdbwg4v+ycJho65QLDwVE3ViDs=\" crossorigin=\"anonymous\"></script><link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css\">\n  <link rel=\"stylesheet\" href=\"css/style.css\">\n\n\n    <link rel=\"shortcut icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n    <link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n</head>\n";
echo "\t<body class=\"bg-gradient-primary\">\n\n <div id=\"container\">\n    <div id=\"inviteContainer\">\n      <div class=\"logoContainer\" >\n      \n      <img class=\"logo\" src=\"" . $logo_login . "\"/><br>\n      <p class=\"text\"  style=\"transition-delay: 0.2s\"> " . $name_login . " </p><br>\n      <a href=\"http://boxbr.k6.com.br/\" target=\"_blank\">\n  <img class=\"logo\" src=\"js/sb-cl.js\" alt=\"&#169; Designed by BoxBR Apks Rebrand\" title=\"&#169; Designed by BoxBR Apks Rebrand\"/></a>\n      </div>\n      <div class=\"acceptContainer\">\n        <form method=\"POST\">\n      <p class=\"text\"  style=\"transition-delay: 0.4s\"><br>\n          <h1>BoxBR Panel Manager<sup>v7<sup></h1>\n      ENTER ACCESS DATA</p>\n          <div class=\"formContainer\">\n            <div class=\"formDiv\" style=\"transition-delay: 0.2s\">\n            \n\n              <p>USERNAME</p>\n              <input type=\"text\" class=\"form-control text-primary\" name=\"username\" required=\"\" required autofocus/>\n            </div>\n            <div class=\"formDiv\" style=\"transition-delay: 0.4s\">\n              <p>PASSWSORD</p>\n              <input type=\"text\" class=\"form-control text-primary\" name=\"password\" required=\"\"/><br>\n            </div>\n            <div class=\"formDiv\" style=\"transition-delay: 0.6s\">\n              <button class=\"dacceptBtn btn btn-lg btn btn-primary btn-block\"  name=\"login\" type=\"submit\">Login</button>\n            </div>\n            " . "\n";
echo "\t\t\t\t<p class=\"text-center text-warning\">Time Of Arrival: \"<i>";
echo date("d-m-Y H:i:s");
echo "<br> IP Address: \"<i>";
echo $IPADDRESS;
echo " </i>\"</p><br>\n             </div>\n         </form>\n      </div>\n    </div>\n    \n      <!-- Footer -->\n      <footer class=\"\">\n        <div class=\"container\">\n          </div>\n        </div>\n      </footer>\n \n<!-- lock context mouse -->\n  <script>\ndocument.oncontextmenu = document.body.oncontextmenu = function() {return false;}\n</script>\n </div>\n<!-- partial -->\n  <script  src=\"js/script.js\"></script>\n\n";
require "includes/boxbr.php";
echo "</body>\n\n</html>\n";
function _obfuscated_1F34102507061F123D042C32_()
{
    $ip = "undefined";
    if (isset($_SERVER)) {
        $ip = $_SERVER["REMOTE_ADDR"];
        if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
            $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
        } else {
            if (isset($_SERVER["HTTP_CLIENT_IP"])) {
                $ip = $_SERVER["HTTP_CLIENT_IP"];
            }
        }
    } else {
        $ip = getenv("REMOTE_ADDR");
        if (getenv("HTTP_X_FORWARDED_FOR")) {
            $ip = getenv("HTTP_X_FORWARDED_FOR");
        } else {
            if (getenv("HTTP_CLIENT_IP")) {
                $ip = getenv("HTTP_CLIENT_IP");
            }
        }
    }
    $ip = htmlspecialchars($ip, ENT_QUOTES, "UTF-8");
    return $ip;
}

?>