Файловый менеджер - Редактировать - /var/www/jonas-eriksen.dk/admin/new.php
Назад
<?php require_once('../include.php'); $admin = new admin($db); $admin->passwordResetCheck(); $log = new log($db); if (!$admin->admin_level(1)) { $admin->redirect("/"); } if (isset($_POST['txt_uname'])) { $uname = trim($_POST['txt_uname']); $upass = trim($_POST['txt_upass']); $name = $_POST['txt_name']; $level = $_POST['level']; if ($uname == "") { $error[] = "provide username !"; } else if ($upass == "") { $error[] = "provide password !"; } else if (strlen($upass) < 6) { $error[] = "Password must be atleast 6 characters"; } else if (strlen($name) == 0) { $error[] = "Must have a name"; } else if ($level < 0) { $error[] = "Level must be a positiv number"; } else { try { $row = $admin->getUsernames($uname); if ($row['username'] == $uname) { $error[] = "Sorry username already in use"; } else { if ($admin->register($uname, $upass, $name, $level)) { $comment = "Ny admin oprettet.<br />Brugernavn: " . $uname . "<br/>Navn: $name"; $log->addLog($_SESSION['userId'], $comment, "Admin", null); $admin->redirect('/'); } else { print "test"; } } } catch (PDOException $e) { echo $e->getMessage(); } } } include('../static/header.php'); ?> <link href="../static/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <form method="post"> <h2>Opret ny admin</h2> <hr/> <?php if (isset($error)) { foreach ($error as $error) { ?> <div class="alert alert-danger"> <i class="glyphicon glyphicon-warning-sign"></i> <?php echo $error; ?> </div> <?php } } else if (isset($_GET['joined'])) { ?> <div class="alert alert-info"> <i class="glyphicon glyphicon-log-in"></i> Successfully registered <a href='/user/index.php'>login</a> here </div> <?php } ?> <div class="form-group"> <input type="text" class="form-control" name="txt_name" placeholder="Fullname"/> </div> <div class="form-group"> Admin level: <input type="number" class="form-control" name="level" placeholder="" value="0"/> </div> <div class="form-group"> <input type="text" class="form-control" name="txt_uname" placeholder="Enter Username" value="<?php if (isset($error)) { echo $uname; } ?>"/> </div> <div class="form-group"> <input type="password" class="form-control" name="txt_upass" placeholder="Enter Password"/> </div> <div class="clearfix"></div> <hr/> <div class="form-group"> <button type="submit" class="btn btn-block btn-primary" name="btn-signup"> <i class="glyphicon glyphicon-open-file"></i> SIGN UP </button> </div> <br/> <label><a href="/admin/login.php">Sign In</a></label> </form>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка