<?php $this->load(); if (isset($_POST['new'])) { $omitted_array = $_POST['new']; unset($omitted_array['password']); unset($omitted_array['username']); \fr_logsys\Fr\LS::register($_POST['new']['username'], $_POST['new']['password'], $omitted_array); sss("Created", "The user has been created. <a href='javascript:window.location.reload();'>Reload page</a> to see changes."); } $columns = $this->dbh->query("DESCRIBE `" . $this->table . "`")->fetchAll(); ?> <h2>New User</h2> <form id="newUser"> <?php foreach ($columns as $column_info) { $column = $column_info['Field']; if ($column != "id" && $column != "password_salt") { ?> <label> <span><?php echo ucfirst($column); ?> </span> <input type='text' name='new[<?php echo $column; ?> ]' /> </label> <?php }
<?php if (isset($dbinfo)) { require_once APP_DIR . "/src/Inc/class.logsys.php"; \fr_logsys\Fr\LS::config(array("db" => array("host" => $dbinfo['db_host'], "port" => $dbinfo['db_port'], "username" => $dbinfo['db_username'], "password" => $dbinfo['db_password'], "name" => $dbinfo['db_name'], "table" => $dbinfo['db_table']), "features" => array("start_session" => false))); }
if ($sql->rowCount() == 0) { echo ser("User Not Found", "The user with the given ID doesn't exist."); } else { $id = $_POST['uid']; if (isset($_POST['update'])) { /** * Update info except password */ \fr_logsys\Fr\LS::updateUser($_POST['update'], $id); /** * Change Password */ if (isset($_POST['user_password']) && $_POST['user_password'] != "") { \fr_logsys\Fr\LS::$user = $id; \fr_logsys\Fr\LS::$loggedIn = true; \fr_logsys\Fr\LS::changePassword($_POST['user_password']); \fr_logsys\Fr\LS::$user = null; \fr_logsys\Fr\LS::$loggedIn = false; } sss("Updated", "The user's data was successfully updated. <a href='javascript:window.location.reload();'>Reload page</a> to see changes."); $sql = $this->dbh->prepare("SELECT * FROM `" . $this->table . "` WHERE `id` = ?"); $sql->execute(array($id)); } $info = $sql->fetch(\PDO::FETCH_ASSOC); ?> <h2><?php echo "Editing User '{$id}'"; ?> </h2> <form id="updateUser"> <input type='hidden' name='uid' value='<?php
$_GET['start'] = isset($_GET['start']) ? $_GET['start'] : 0; $sql = \fr_logsys\Fr\LS::$dbh->prepare("SELECT * FROM `resetTokens` LIMIT :start, 10"); $sql->bindParam(":start", $_GET['start'], \PDO::PARAM_INT); $sql->execute(); if ($sql->rowCount() == 0) { echo sme("No Tokens", "There are currently no tokens stored in the table."); } else { echo "<table><thead><th width='30%'>User</th><th width='50%'>Token</th><th title='YYYY-MM-DD HH:MM:SS' width='20%'>Created</th></thead><tbody>"; while ($r = $sql->fetch()) { ?> <tr> <td title="User ID: <?php echo $r['uid']; ?> "><?php echo \fr_logsys\Fr\LS::getUser("name", $r['uid']); ?> </td> <td><?php echo $r['token']; ?> </td> <td><?php echo $r['requested']; ?> </td> </tr> <?php } echo "</tbody></table>"; echo "<form id='clear_form' action='" . APP_URL . "/admin/tokens' method='POST'><input type='hidden' name='clear_tokens'/><a class='button red' onclick=\"confirm('Are you sure you want to delete all tokens') ? \$('.workspace #clear_form').submit() : '';\">Clear Tokens</a></form>";