*/ $wpvarstoreset = array('action','standalone','redirect','profile'); for ($i=0; $iERROR: Please enter a login.'); } /* checking the password has been typed twice */ if ($pass1 == '' || $pass2 == '') { die ('ERROR: Please enter your password twice.'); } /* checking the password has been typed twice the same */ if ($pass1 != $pass2) { die ('ERROR: Please type the same password in the two password fields.'); } $user_nickname = $user_login; /* checking e-mail address */ if ($user_email == '') { die ('ERROR: Please type your e-mail address.'); } else if (!is_email($user_email)) { die ('ERROR: The email address isn’t correct.'); } /* checking the login isn't already used by another user */ $loginthere = $wpdb->get_var("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'"); if ($loginthere) { die ('ERROR: This login is already registered, please choose another one.'); } $user_login = addslashes(stripslashes($user_login)); $pass1 = addslashes(stripslashes($pass1)); $user_nickname = addslashes(stripslashes($user_nickname)); $user_firstname = addslashes(stripslashes($user_firstname)); $user_lastname = addslashes(stripslashes($user_lastname)); $now = current_time('mysql'); $result = $wpdb->query("INSERT INTO $tableusers (user_login, user_pass, user_nickname, user_email, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_idmode, user_firstname, user_lastname) VALUES ('$user_login', '$pass1', '$user_nickname', '$user_email', '$user_ip', '$user_domain', '$user_browser', '$now', '$new_users_can_blog', 'nickname', '$user_firstname', '$user_lastname')"); if ($result == false) { die ('ERROR: Couldn’t register you... please contact the webmaster !'); } $stars = ''; for ($i = 0; $i < strlen($pass1); $i = $i + 1) { $stars .= '*'; } $message = "New user registration on your blog $blogname:\r\n\r\n"; $message .= "Login: $user_login\r\n\r\nE-mail: $user_email"; @mail($admin_email, "[$blogname] New User Registration", $message); header('Location: users.php'); break; case 'promote': $standalone = 1; require_once('admin-header.php'); if (empty($HTTP_GET_VARS['prom'])) { header('Location: users.php'); } $id = $HTTP_GET_VARS['id']; $prom = $HTTP_GET_VARS['prom']; $user_data = get_userdata($id); $usertopromote_level = $user_data->user_level; if ($user_level <= $usertopromote_level) { die('Can’t change the level of a user whose level is higher than yours.'); } if ('up' == $prom) { $new_level = $usertopromote_level + 1; $sql="UPDATE $tableusers SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level"; } elseif ('down' == $prom) { $new_level = $usertopromote_level - 1; $sql="UPDATE $tableusers SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level"; } $result = $wpdb->query($sql); header('Location: users.php'); break; case 'delete': $standalone = 1; require_once('admin-header.php'); $id = $HTTP_GET_VARS['id']; if (!$id) { header('Location: users.php'); } $user_data = get_userdata($id); $usertodelete_level = $user_data->user_level; if ($user_level <= $usertodelete_level) die('Can’t delete a user whose level is higher than yours.'); $sql = "DELETE FROM $tableusers WHERE ID = $id"; $result = $wpdb->query($sql) or die("Couldn’t delete user #$id."); $sql = "DELETE FROM $tableposts WHERE post_author = $id"; $result = $wpdb->query($sql) or die("Couldn’t delete user #$id’s posts."); header('Location: users.php'); break; default: $standalone = 0; include ('admin-header.php'); ?>

Authors

get_results("SELECT ID FROM $tableusers WHERE user_level > 0 ORDER BY ID"); foreach ($users as $user) { $user_data = get_userdata($user->ID); $email = $user_data->user_email; $url = $user_data->user_url; $short_url = str_replace('http://', '', stripslashes($url)); $short_url = str_replace('www.', '', $short_url); if ('/' == substr($short_url, -1)) $short_url = substr($short_url, 0, -1); if (strlen($short_url) > 35) $short_url = substr($short_url, 0, 32).'...'; $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $tableposts WHERE post_author = $user->ID and post_status = 'publish'"); if (0 < $numposts) $numposts = "$numposts"; echo " "; echo ''; } ?>
ID Nickname Name E-mail URI Level Posts
$user_data->ID $user_data->user_nickname $user_data->user_firstname $user_data->user_lastname $email $short_url "; if (($user_level >= 2) and ($user_level > $user_data->user_level) and ($user_data->user_level > 0)) echo " ID."&prom=down\">- "; echo $user_data->user_level; if (($user_level >= 2) and ($user_level > ($user_data->user_level + 1))) echo " ID."&prom=up\">+ "; echo "$numposts
get_results("SELECT * FROM $tableusers WHERE user_level = 0 ORDER BY ID"); if ($users) { ?>

Users

ID); $email = $user_data->user_email; $url = $user_data->user_url; $short_url = str_replace('http://', '', stripslashes($url)); $short_url = str_replace('www.', '', $short_url); if ('/' == substr($short_url, -1)) $short_url = substr($short_url, 0, -1); if (strlen($short_url) > 35) $short_url = substr($short_url, 0, 32).'...'; $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; echo "\n\n\n"; } ?>
ID Nickname Name E-mail URI Level
$user_data->ID $user_data->user_nickname $user_data->user_firstname $user_data->user_lastname $email $short_url "; if ($user_level >= 3) echo " ID."\" style=\"color:red;font-weight:bold;\">X "; echo $user_data->user_level; if ($user_level >= 2) echo " ID."&prom=up\">+ "; echo "

To delete a user, bring his level to zero, then click on the red X.
Warning: deleting a user also deletes all posts made by this user.

Add User

Users can register themselves or you can manually create users here.

Nickname
First Name
Last Name
Email
URI
Password (twice)

*/ include('admin-footer.php'); ?>