82 lines
2.3 KiB
PHP
82 lines
2.3 KiB
PHP
<?
|
|
if ( ! isset($_SERVER['HTTPS'])) {
|
|
header('Location: https://' . $_SERVER["SERVER_NAME"] . $_SERVER['REQUEST_URI']);
|
|
}
|
|
require_once("../session.lib.php");
|
|
$added = FALSE;
|
|
if (!isset($_SESSION['editor'])) {
|
|
header("Location: https://xxx.org.za/publish/login");
|
|
return;
|
|
} else if (isset($_POST['adduser'])) {
|
|
require_once('../open_db.lib.php');
|
|
open_db('open');
|
|
$table = "editors";
|
|
|
|
$username = $db->real_escape_string($_POST['username']);
|
|
$password = crypt($_POST['password']);
|
|
$email = $db->real_escape_string($_POST['email']);
|
|
$query = "INSERT INTO $table SET".
|
|
"`username` = '".$username."', ".
|
|
"`password` = '".$password."', ".
|
|
"`email` = '".$email."'; ";
|
|
if ($result = $db->query($query)) {
|
|
$added = TRUE;
|
|
$is_admin = TRUE;
|
|
}
|
|
open_db('close');
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width" />
|
|
<title>x.x.x [add editor]</title>
|
|
<link rel="icon" href="favicon.png" />
|
|
<link rel="shortcut icon" href="favicon.png" />
|
|
<link rel="stylesheet" type="text/css" href="../style.css" />
|
|
<link rel='stylesheet' type='text/css' href='../publish/style.css' />
|
|
<link rel="alternate" type="application/rss+xml" title="xxx.org.za RSS feed" href="/feed" />
|
|
<script type="text/javascript" src="../utilities.js"></script>
|
|
</head>
|
|
<? flush(); ?>
|
|
<body>
|
|
<div id="container">
|
|
<? include_once("../sidebar.inc.php"); ?>
|
|
<div id="main">
|
|
<div id="maintext">
|
|
|
|
<H1>add editor</H1>
|
|
|
|
<? if ($added) { ?>
|
|
<p>Added editor <?= $username ?></p>
|
|
<? } else { ?>
|
|
|
|
<form action="https://xxx.org.za<?= $_SERVER['REQUEST_URI'] ?>" method="post">
|
|
<div>
|
|
<label for="username">Username: </label>
|
|
<input type="text" id="username" name="username" />
|
|
</div>
|
|
<div>
|
|
<label for="password">Password: </label>
|
|
<input type="password" id="password" name="password" />
|
|
</div>
|
|
<div>
|
|
<label for="email">Email: </label>
|
|
<input type="text" id="email" name="email" />
|
|
</div>
|
|
<div class="submission">
|
|
<button type="submit" id="adduser" name="adduser" value="1">Add editor</button>
|
|
</div>
|
|
</form>
|
|
<? } ?>
|
|
|
|
</div> <!-- maintext -->
|
|
</div> <!-- main -->
|
|
<? include_once("../bottombar.inc.php"); ?>
|
|
</div> <!-- container -->
|
|
|
|
</body>
|
|
</html>
|
|
|