<?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
*
*/

ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
error_reporting(32767);
$db1 = new SQLite3("./api/db/brbox_vpn.db");
$res1 = $db1->query("SELECT * \r\n\t\t\t\t  FROM vpn \r\n\t\t\t\t  WHERE id='" . $_GET["update"] . "'");
$row1 = $res1->fetchArray();
$id = $row1["id"];
$vpn_country = $row1["vpn_country"];
$vpn_state = $row1["vpn_state"];
$vpn_config = $row1["vpn_config"];
$vpn_status = $row1["vpn_status"];
$username = $row1["username"];
$password = $row1["password"];
if (isset($_POST["submit"])) {
    $db1->exec("UPDATE vpn SET vpn_country='" . $_POST["vpn_country"] . "', " . "\r\n\t\t\t\t\t\t\t\t" . "vpn_state='" . $_POST["vpn_state"] . "'," . "\r\n\t\t\t\t\t\t\t\t" . "vpn_config='" . $_POST["vpn_config"] . "'," . "\r\n\t\t\t\t\t\t\t\t" . "vpn_status='" . $_POST["vpn_status"] . "'," . "\r\n\t\t\t\t\t\t\t\t" . "username='" . $_POST["username"] . "'," . "\r\n\t\t\t\t\t\t\t\t" . "password='" . $_POST["password"] . "'" . "\r\n\t\t\t\t\t\t" . "  WHERE " . "\r\n\t\t\t\t\t\t\t" . "  id='" . $_POST["id"] . "'");
    $db1->close();
    header("Location: vpn.php");
}
include "includes/header.php";
$id = $row1["id"];
$vpn_country = $row1["vpn_country"];
$vpn_state = $row1["vpn_state"];
$vpn_config = $row1["vpn_config"];
$vpn_status = $row1["vpn_status"];
$user = $row1["username"];
$pass = $row1["password"];
echo " <!-- Begin Page Content -->\n        <div class=\"container-fluid\">\n\n";
if (isset($_GET["message"])) {
    echo $_GET["message"];
}
if (isset($_GET["m"])) {
    echo $_GET["m"];
}
echo "          <!-- Page Heading -->\n          <h1 class=\"h3 mb-1 text-gray-800\">Update VPN</h1>\n         \n          <!-- Content Row -->\n          <div class=\"row\">\n\n            <!-- Second Column -->\n            <div class=\"col-lg-6\">\n\n              <!-- Background Gradient Utilities -->\n              <div class=\"card border-left-primary shadow h-100 card shadow mb-4\">\n                <div class=\"card-header py-3\">\n                <h6 class=\"m-0 font-weight-bold text-primary\"><i class=\"fa fa-user-shield\"></i> Update VPN Details</h6>\n                </div>\n                <div class=\"card-body\">\n\t\t\t\t    \t<form method=\"post\">\n                        <div class=\"form control\">\n                                    <label class=\"control-label \" for=\"vpn_country\"><strong>\n                                        Country Code</strong>\n                                    </label>\n                                    <div class=\"input-group\">\n";
echo "                                        <input type=\"hidden\" name=\"id\" value=\"" . $id . "\">" . "\n";
echo "                                        <input class=\"form-control text-primary\" id=\"description\" name=\"vpn_country\"  value=\"" . $vpn_country . "\" type=\"text\" />" . "\n";
echo "                                    </div></br>\n                                    \n                        <div class=\"form-group \">\n                                    <label class=\"control-label \" for=\"vpn_state\">\n                                        <strong>State / Region</strong> \n                                    </label>\n                                    <div class=\"input-group\">\n";
echo "                                        <input class=\"form-control text-primary\" id=\"description\" name=\"vpn_state\" value=\"" . $vpn_state . "\" type=\"text\"/>" . "\n";
echo "                                    </div>\n                                </div>\n                                <div class=\"form-group \">\n                                    <label class=\"control-label requiredField\" for=\"vpn_status\" >\n                                        <strong>Status</strong>\n                                    </label>\n                                    <select class=\"select form-control text-primary\" id=\"select\" name=\"vpn_status\"  >\n";
$vpn_active = $row["vpn_status"] == "ACTIVE" ? "selected" : "";
$vpn_inactive = $row["vpn_status"] == "INACTIVE" ? "selected" : "";
echo "                                        <option value=\"ACTIVE\" " . $vpn_active . " >ACTIVE</option>" . "\n";
echo "                                        <option value=\"INACTIVE\" " . $vpn_inactive . " >INACTIVE</option>" . "\n";
echo "                                    </select>\n                                </div>\n                                <div class=\"form-group \">\n                                    <label class=\"control-label \" for=\"vpn_config\">\n                                        <strong>URL</strong>\n                                    </label>\n                                    <div class=\"input-group\">\n";
echo "                                        <input type=\"text\" class=\"form-control text-primary\" name=\"vpn_config\" value=\"" . $vpn_config . "\" id=\"discription\" /> " . "\n";
echo "                                    </div>\n                                </div>\n                                <div class=\"form-group \">\n                                    <label class=\"control-label \" 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 . "\" id=\"discription\" />" . "\n";
echo "                                    </div>\n                                </div>\n                                <div class=\"form-group \">\n                                    <label class=\"control-label \" for=\"password\">\n                                        <strong>Password</strong>\n                                    </label>\n                                    <div class=\"input-group\">\n";
echo "                                        <input type=\"text\" class=\"form-control text-primary\" name=\"password\" value=\"" . $pass . "\" id=\"discription\" />" . "\n";
echo "                                    </div>\n                                </div>\n                                <div class=\"form-group\">\n                                    <div>\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\n                                </div>\n                            </form>\n                </div>\n              </div>\n            </div>            </div>            </div>            </div>";
include "includes/footer.php";
require "includes/brbox.php";
echo "</body>\n";

?>