link in admincp.php
before last ?> add
in config.php, add
<td align="center"><a href="admincp.php?action=adduser"><img src="images/admin/adduser.png" border="0" width="118" height="80" alt="" /><br /><?php echo T_("ADDUSER"); ?></a><br /></td>before last ?> add
#======================================================================#
# Add Users
#======================================================================#
if ($action == "adduser") {
if ($CURUSER["class"] < "7") {
show_error_msg("Error", "Sorry you do not have the rights to view this page!", 1);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($_POST["username"] == "" || $_POST["password"] == "" || $_POST["email"] == "")
show_error_msg(T_("ERROR"), T_("DONT_LEAVE_ANY_FIELD_BLANK"),1);
if ($_POST["password"] != $_POST["password2"])
show_error_msg(T_("ERROR"), T_("PASSWORDS_NOT_MATCH"),1);
$username = sqlesc($_POST["username"]);
$password = $_POST["password"];
$email = sqlesc($_POST["email"]);
$secret = mksecret();
$passhash = sqlesc(passhash($password)); // hash the password
$secret = sqlesc($secret);
SQL_Query_exec("INSERT INTO users (downloaded, uploaded, invites, added, last_access, secret, username, password, status, email) VALUES($site_config[new_member_upload_ratio], 0, $site_config[new_member_invites], NOW(), NOW(), $secret, $username, $passhash, 'confirmed', $email)");
$res = SQL_Query_exec("SELECT id FROM users WHERE username=$username");
$arr = mysqli_fetch_row($res);
if (!$arr)
show_error_msg(T_("ERROR"), "Unable to create the account. The user name is possibly already taken.",1);
// header("Location: account-details.php?id=$arr[0]");
autolink ("account-details.php?id=$arr[0]", "<b><font color='#ff0000'> Account Created...Directing to details page</font></b>");
die;
}
stdhead("Add user");
begin_frame();
?>
<div align=center>
<h1>Add User</h1>
<form method=post action=admincp.php?action=adduser>
<table border=1 cellspacing=0 cellpadding=5>
<tr><td class=rowhead>Name</td><td><input type=text name=username size=40></td></tr>
<tr><td class=rowhead>Password</td><td><input type=password name=password size=40></td></tr>
<tr><td class=rowhead>Retype password</td><td><input type=password name=password2 size=40></td></tr>
<tr><td class=rowhead>E-mail</td><td><input type=text name=email size=40></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Create" class=btn></td></tr>
</table>
</form>
</div>
<?php
end_frame();
navmenu();
stdfoot();
}
#======================================================================#
# END Add Users
#======================================================================#in config.php, add
$site_config['new_member_upload_ratio'] = 2147483648; //2147483648 = 2GB of upload and inf. ratio to help get started
$site_config['new_member_invites'] = 0 ; // Every new user will get 0 invites to start with.
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Last edited by MicroMonkey on 2021-11-12 22:39:29