<?php
/**
*
* @ This file is created by http://DeZender.Net
* @ deZender (PHP7 Decoder for SourceGuardian Encoder)
*
* @ Version			:	5.0.1.0
* @ Author			:	DeZender
* @ Release on		:	22.04.2022
* @ Official site	:	http://DeZender.Net
*
*/

session_start();
$ifofuser = $_SESSION["id"];
$db = new SQLite3("./api/db/brbox_panel.db");
$res = $db->query("SELECT * \n\t\t\t\t  FROM USERS \n\t\t\t\t  WHERE id='" . $ifofuser . "'");
$row = $res->fetchArray();
if (isset($_POST["submit"])) {
    $message = "Profile Updated!";
    $db->exec("UPDATE USERS \n\t\t\tSET\tNAME='" . $_POST["name"] . "',\n\t\t\t    USERNAME='" . $_POST["username"] . "', \n\t\t\t\tPASSWORD='" . $_POST["password"] . "',\n\t\t\t\tLOGO='" . $_POST["logo"] . "',\n\t\t\t\tCORP='" . $_POST["corp"] . "'\n\t\t\tWHERE \n\t\t\t\tid='" . $ifofuser . "'");
    header("Location: profile.php");
}
$name = $row["NAME"];
$user = $row["USERNAME"];
$pass = $row["PASSWORD"];
$logo = $row["LOGO"];
$corp = $row["CORP"];
include "includes/header.php";
echo " <!-- Begin Page Content -->\n        <div class=\"container-fluid\">\n\n";
if (isset($_GET["message"])) {
    echo $_GET["message"];
}
echo "          <!-- Content Row -->\n          <div class=\"row\">\n\n            <!-- First Column -->\n            <div class=\"col-lg-12\">\n\n              <!-- Custom codes -->\n                <div class=\"card text-text-primary\">\n                <div class=\"card-header bg-primary py-3\">\n                <center><h4 align=\"center\" class=\"m-0 text-white\"><i class=\"fas fa-user\"\n                                    style=\"font-size:20px\">&nbsp;&nbsp;</i> Admin Update Profile</h4>\n                        \n\t\t\t\t\t\t</center>\n\n            </div>\n                <div class=\"card-body\">\n                            <form method=\"post\">\n\t\t\t\t\t\t\t<div class=\"form-group \">\n                            <label class=\" text-primary control-label\" for=\"apkautoupdate\" >\n                              <strong>  Update Profile: </strong></label>\n                <div class=\"card-body\">\n                            <form method=\"post\">\n                            <div class=\"form-group \">\n                            <label class=\"control-label  text-primary\" for=\"name\">\n                            <strong>Name</strong>\n                            </label>\n                            <div class=\"input-group\">\n";
echo "                            <input type=\"text\" class=\"form-control text-primary\" name=\"name\" value=\"" . $name . "\" placeholder=\"Enter Name\">\n";
echo "                            </div>\n                            </div>\n                            <div class=\"form-group \">\n                            <label class=\"control-label text-primary \" for=\"username\">\n                            <strong>Username</strong>\n                            </label>\n                            <div class=\"input-group\">\n";
echo "                            <input type=\"text\" class=\"form-control text-primary\" name=\"username\" value=\"" . $user . "\" placeholder=\"Enter Username\">\n";
echo "                            </div>\n                            </div>\n                            <div class=\"form-group \">\n                            <label class=\"control-label text-primary \" for=\"password\">\n                            <strong>Password</strong>\n                            </label>\n                            <div class=\"input-group\">\n                            <input type=\"password\" class=\"form-control text-primary\" name=\"password\"";
echo "value=\"" . $pass . "\"";
echo " id=\"myInput\" placeholder=\"Enter Password\">\n                            </div>\n                            </div>\n                            <div class=\"form-group \">\n <input type=\"checkbox\" onclick=\"myFunction()\">\n                            <label class=\"control-label text-primary \" for=\"password\">\n                            <strong>Show Password</strong>\n                            </label>\n                            </div>\n                            <div class=\"form-group \">\n                            <label class=\"control-label text-primary \" for=\"logo\">\n                            <strong>Logo Panel</strong>\n                            </label>\n                            <div class=\"input-group\">\n";
echo "                            <input type=\"text\" class=\"form-control text-primary\" name=\"logo\" value=\"" . $logo . "\" placeholder=\"Enter Image URL\">\n";
echo "                            </div>\n                            </div>\n                            <div class=\"form-group\">\n";
echo "                            <img type=\"image\" width=\"100px\" src=\"" . $logo . "\" alt=\"image\" />\n";
echo "                            </div>\n\t\t\t\t\t\t\t\t                       <div class=\"form-group\">\n                        <button class=\"btn btn-success btn-icon-split\" name=\"submit\" type=\"submit\">\n                        <span class=\"icon text-white-50\"><i class=\"fas fa-check\"></i></span><span class=\"text\">Submit</span>\n                        </button>\n                            </div>\n                            </div>\n                </div>\n                            </div>\n                            </form>\n            </div>\n                </div>\n                </div>\n";
include "includes/footer.php";
require "includes/brbox.php";
echo "<script>\nfunction myFunction() {\n  var x = document.getElementById('myInput');\n  if (x.type === 'password') {\n    x.type = 'text';\n";
echo "    x.value = '" . $pass . "';\n";
echo "  } else {\n    x.type = 'password';\n  }\n}</script>\n</body>\n";

?>