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

$db1 = new SQLite3("./api/db/realm_message.db");
$res1 = $db1->query("SELECT * \r\n\t\t\t\t  FROM messages \r\n\t\t\t\t  WHERE id='" . $_GET["update"] . "'");
while ($row1 = $res1->fetchArray()) {
    $userid = $row1["userid"];
    $mes = $row1["message"];
    $expire = $row1["expire"];
    $status = $row1["status"];
}
$ACTIVE = $status == "ACTIVE" ? "selected" : "";
$INACTIVE = $status == "INACTIVE" ? "selected" : "";
if (isset($_POST["submit"])) {
    $db1->exec("UPDATE messages SET message='" . $_POST["message"] . "'," . "\r\n\t\t\t\t\t\t\t" . "  status='" . $_POST["status"] . "'," . "\r\n\t\t\t\t\t\t\t" . "  expire='" . $_POST["expire"] . "'" . "\r\n\t\t\t\t\t\t" . "  WHERE " . "\r\n\t\t\t\t\t\t\t" . "  userid='" . $_POST["userid"] . "'");
    header("Location: message_send.php");
}
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=\"fa fa-comment\"\n                                    style=\"font-size:20px\">&nbsp;&nbsp;</i> Edit Message</h4>\n                        \n\t\t\t\t\t\t</center>\n\n            </div>\n                <div class=\"card-body\">\n                        <form method=\"post\">\n                        <div class=\"form control\">\n                                    <label class=\"control-label \" for=\"userid\"><strong>\n                                        Username</strong>\n                                    </label>\n                                    <div class=\"input-group\">\n";
echo "                                        <input class=\"form-control text-primary\" id=\"description\" name=\"userid\"  value=\"" . $userid . "\" type=\"text\" readonly/>" . "\n";
echo "                                    </div></br>\n                                    \n                        <div class=\"form-group \">\n                                    <label class=\"control-label text-primary\" for=\"message\">\n                                                                \n                                        <strong>Message</strong>\n                                    </label>\n                                    <div class=\"form-group\">\n";
echo "                                        <input class=\"form-control text-primary\" id=\"message\" name=\"message\" value=\"" . $mes . "\" type=\"text\"/>" . "\n";
echo "                                    </div>\n\n                                </div>\n                                <div class=\"form-group \">\n                                    <label class=\"text-primary control-label requiredField\" for=\"status\" >\n                                        <strong>Status</strong>\n                                    </label>\n                                    <select class=\"select form-control text-primary\" id=\"select\" name=\"status\">\n";
echo "\t\t\t\t\t\t\t\t\t    <option value=\"INACTIVE\"" . $INACTIVE . ">INACTIVE</option>" . "\n";
echo "                                        <option value=\"ACTIVE\"" . $ACTIVE . ">ACTIVE</option>" . "\n";
echo "                                    </select>\n                                </div>\n                                <div class=\"form-group \">\n                                    <label class=\"control-label text-primary\" for=\"expire\">\n                                        <strong>Expiration</strong>\n                                    </label>\n                                    <div class=\"input-group\">\n";
echo "                                        <input type=\"text\" class=\"form-control text-primary\" name=\"expire\" placeholder=\"YYYY-MM-DD\" id=\"datetimepicker\"  autocomplete=\"off\" value=\"" . $expire . "\"> " . "\n";
echo "                                    </div>\n\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>";
include "includes/footer.php";
require "includes/r3alm.php";
echo "</body>\n";

?>