function user_modify($user, $pass, $role, $home, $ram, $port, $jar = 'craftbukkit.jar') { // check user existence if (is_file('data/users/' . strtolower(clean_alphanum($user)) . '.json')) { // Create user array $user = array('user' => clean_alphanum($user), 'pass' => bcrypt($pass), 'role' => $role, 'home' => $home, 'ram' => intval($ram), 'port' => intval($port), 'jar' => $jar); // Write to file file_put_contents('data/users/' . strtolower(clean_alphanum($user['user'])) . '.json', json_encode($user)); return true; } else { return false; } }
$conn = connDB(); $sql = "SELECT * FROM tbl_admin WHERE `username` = '{$post_username}' AND `password` = md5({$post_password})"; $query = mysql_query($sql, $conn); $result = mysql_fetch_array($query); return $result; } function get_username($post_username) { $conn = connDB(); $sql = "SELECT COUNT(*) AS rows FROM tbl_admin WHERE `username` = '{$post_username}'"; $query = mysql_query($sql, $conn); $result = mysql_fetch_array($query); return $result; } $username = clean_alphanum($_POST['username']); $password = clean_alphanum($_POST['password']); if ($_POST['btn-admin-login'] == "Sign In") { $get_admin = admin_login($username, $password); if ($get_admin['rows'] != 1) { $_SESSION['alert'] = "error"; $_SESSION['msg'] = "<strong>Login invalid.</strong> Please check your username and password."; $forgot = get_username($username); if ($forgot['rows'] > 0) { $_SESSION['username'] = $username; } else { $_SESSION['username'] = "******"; } } else { $_SESSION['admin'] = $get_admin['id']; ini_set('session.gc_probability', '1'); if (isset($_SESSION['alert'])) {
<?php require_once 'inc/lib.php'; if (!empty($_POST['user'])) { session_start(); user_add($_POST['user'], $_POST['pass'], 'admin', $_POST['dir'], $_POST['ram'], $_POST['port']); $_SESSION['user'] = clean_alphanum($_POST['user']); } ?> <!doctype html> <html> <head> <title>Install MCHostPanel</title> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/smooth.css" id="smooth-css"> <meta name="author" content="Alan Hardman (http://phpizza.com)"> </head> <body> <?php if (!empty($_POST['user'])) { ?> <div class="modal"> <div class="modal-header"> <h3>Install MCHostPanel</h3> </div> <div class="modal-body"> <p>MCHostPanel has been installed, and you are now logged in.</p> <p class="alert alert-error">Delete <code>install.php</code>, otherwise anyone can create an administrator user!</p> </div> <div class="modal-footer">