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

function my_error_handler($code, $message)
{
	echo sprintf('sprintf', $code);
	echo 'sprintf';
	return 'sprintf';
}

function function_added_to_every_file()
{
}

ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(E_ALL);
$db = new SQLite3('./api/data/.boxbr_info.db');
$res = $db->query('SELECT * ' . "\r\t\t\t\t" . '  FROM act ' . "\r\t\t\t\t" . '  WHERE id=\'' . $_GET['update'] . '\'');
$row = $res->fetchArray();

if (isset($_POST['submit'])) {
	$gurl = 'boxbr';
	$db->exec('UPDATE act SET  title=\'' . $_POST['title'] . '\', ' . "\r\t\t\t\t\t\t\t\t" . 'activecode=\'' . $_POST['activecode'] . '\', ' . "\r\t\t\t\t\t\t\t\t" . 'macAddress=\'' . $_POST['macAddress'] . '\',  ' . "\r\t\t\t\t\t\t\t\t" . 'uid=\'' . $_POST['uid'] . '\', ' . "\r\t\t\t\t\t\t\t\t" . 'username=\'' . $_POST['username'] . '\', ' . "\r\t\t\t\t\t\t\t\t" . 'password=\'' . $_POST['password'] . '\', ' . "\r\t\t\t\t\t\t\t\t" . 'url=\'' . $gurl . '\', ' . "\r\t\t\t\t\t\t\t\t" . 'apptype=\'' . $_POST['apptype'] . '\', ' . "\r\t\t\t\t\t\t\t\t" . 'appname=\'' . $_POST['appname'] . '\', ' . "\r\t\t\t\t\t\t\t\t" . 'status=\'' . $_POST['status'] . '\'' . "\r\t\t\t\t\t\t" . '  WHERE ' . "\r\t\t\t\t\t\t\t" . '  id=\'' . $_POST['id'] . '\'');
	$db->close();
	header('Location: act.php');
}

include 'includes/header.php';
echo '<!-- [ Main Content ] start -->' . "\r" . '    <div class="pcoded-main-container">' . "\r" . '        <div class="pcoded-wrapper">' . "\r" . '            <div class="pcoded-content">' . "\r" . '                <div class="pcoded-inner-content">' . "\r" . '                    <div class="main-body">' . "\r" . '                        <div class="page-wrapper">' . "\r" . '                            <!-- [ Main Content ] start -->' . "\r" . '                            <div class="row">' . "\r" . '                    <!-- Column -->' . "\r" . '                    <div class="col-lg-12">' . "\r" . '                        <div class="card mb-4">' . "\r\t\t\t\t\t\t\t" . '<div class="card-header bg-primary py-3">' . "\r" . '                ' . "\t\t\t\t" . '<h4 align="center" class="m-0 font-weight-bold text-white"><i class="fas fa-code" style="font-size:20px">&nbsp;&nbsp;</i>Edit A ActiveCode : [ ';
echo $row['activecode'];
echo ' ]</h4>' . "\r" . '                ' . "\t\t\t" . '</div>' . "\r" . '                         <div class="card-body">' . "\r\t\t\t\t\t\t" . '<form method="post">' . "\r" . '                        <div  type="hidden" class="form-group">' . "\r\t\t\t\t\t\t" . '   <input type="hidden" name="id" value="';
echo $row['id'];
echo '">' . "\r\t\t\t\t\t\t" . '   <input type="hidden" name="uid" value="';
echo $row['uid'];
echo '">' . "\r" . '                            <input value="';
echo $row['activecode'];
echo '" class="form-control text-primary" id="activecode" name="activecode" type="hidden"  required/>' . "\r" . '                        </div>' . "\r" . '                                                         <div class="form-group">' . "\r" . '                                    <label class="form-label " for="title"><strong>Service Name</strong></label>' . "\r" . '                                    <input value="';
echo $row['title'];
echo '"  class="form-control text-primary" id="ur" name="url" type="text" required/>' . "\r" . '                                </div>' . "\r" . '                                <div class="form-group">' . "\r" . '                                    <label class="form-label " for="url"><strong>Service DNS</strong></label>' . "\r" . '                                    <input value="';
echo $row['url'];

echo '"  class="form-control text-primary" maxlength="17" id="macAddress" name="macAddress" type="text"/>' . "\r" . '                                </div>' . "\r" . '                                <div class="form-group">' . "\r" . '                                    <label class="form-label " for="url"><strong>Username</strong></label>' . "\r" . '                                    <input value="';
echo $row['username'];
echo '"  class="form-control text-primary" id="username" name="username" type="text" required/>' . "\r" . '                                </div>' . "\r" . '                                <div class="form-group">' . "\r" . '                                    <label class="form-label " for="url"><strong>Password</strong></label>' . "\r" . '                                    <input value="';
echo $row['password'];
echo '" class="form-control text-primary" id="password" name="password" type="text" required/>' . "\r" . '                                </div>' . "\r" . '<!--' . "\r" . '                                <div class="form-group">' . "\r" . '                                    <label class="form-label " for="url"><strong>Service DNS</strong></label>' . "\r" . '                                    <input value="';
echo $row['url'];
echo '" class="form-control text-primary" id="apptype" name="apptype" type="text"/>' . "\r" . '                                </div>' . "\r" . '-->' . "\r" . '                                <div class="form-group">' . "\r" . '                                    <label class="form-label " for="apptype"><strong>App Type</strong></label>' . "\r\t\t\t\t\t\t\t\t\t" . '  <select class="input-group form-control type" id="apptype" name="apptype">' . "\r\t\t\t\t\t\t\t\t\t\t" . ' <option data-value="op1" value="0" ';
echo $row['apptype'] == '0' ? 'selected' : '';
echo '>Dual TV/Vod' . "\r\t\t\t\t\t\t\t\t\t\t" . '  </option>' . "\r\t\t\t\t\t\t\t\t\t\t" . '  <option data-value="op1" value="1" ';
echo $row['apptype'] == '1' ? 'selected' : '';
echo '>Only TV' . "\r\t\t\t\t\t\t\t\t\t\t" . '  </option>' . "\r\t\t\t\t\t\t\t\t\t\t" . '  <option data-value="op2" value="2" ';
echo $row['apptype'] == '2' ? 'selected' : '';
echo '>Only Vod' . "\r\t\t\t\t\t\t\t\t\t\t" . '  </option>' . "\r\t\t\t\t\t\t\t\t\t" . '  </select>' . "\r" . '                                    </div>' . "\r" . '                                <div class="form-group">' . "\r" . '                                    <label class="form-label " for="appname"><strong>App Name</strong></label>' . "\r" . '                                    <input value="';
echo $row['appname'];
echo '" class="form-control text-primary" id="appname" name="appname" type="text"/>' . "\r" . '                                </div>' . "\r" . '                                ' . "\r" . '                                <div class="form-group">' . "\r" . '                                    <label class="form-label " for="url"><strong>Status</strong></label>' . "\r\t\t\t\t\t\t\t\t\t" . '  ' . "\r\t\t\t\t\t\t\t\t\t" . '  <select class="form-control type" id="status" name="status">' . "\r\t\t\t\t\t\t\t\t\t\t" . '  <option data-value="op1" value="1" ';
echo $row['status'] == '1' ? 'selected' : '';
echo '>ACTIVE' . "\r\t\t\t\t\t\t\t\t\t\t" . '  </option>' . "\r\t\t\t\t\t\t\t\t\t\t" . '  <option data-value="op0" value="0" ';
echo $row['status'] == '0' ? 'selected' : '';
echo '>INACTIVE' . "\r\t\t\t\t\t\t\t\t\t\t" . '  </option>' . "\r\t\t\t\t\t\t\t\t\t" . '  </select>' . "\r" . '                                </div>' . "\r" . '                        <div align="center" class="form-group mb-3">' . "\r\t\t\t\t\t\t\t\t\t" . '<br>' . "\r\t\t\t\t\t\t\t\t\t\t" . '<button class="btn btn-danger btn-icon-split" name="submit" type="submit"><span class="icon text-white-50"><i class="fas fa-save"></i>&nbsp;&nbsp;</span><span class="text"> Save Settings</span></button>' . "\r" . '                                </div>' . "\r" . '                            </form>' . "\r" . '                            </div>' . "\r" . '                        </div>' . "\r" . '                    </div>' . "\r" . '                    <!-- Column -->' . "\r" . '                </div>' . "\r" . '            </div>' . "\r" . '            <!-- ============================================================== -->' . "\r" . '            <!-- End Container fluid  -->' . "\r" . '            <!-- ============================================================== -->' . "\r" . '        </div>' . "\r" . '        <!-- ============================================================== -->' . "\r" . '        <!-- End Page wrapper  -->' . "\r" . '        <!-- ============================================================== -->' . "\r" . '    </div>' . "\r";
include 'includes/functions.php';

?>