$show_data = dbarray(dbquery("SELECT * FROM ".DB_USERS." INNER JOIN ".DB_EXTEND_USERS." on ".DB_USERS.".user_id = ".DB_EXTEND_USERS.".eu_id WHERE user_id='".$user_id."'"));
if (isset($_REQUEST['user_id'])) { // get username display it no matter what panel is open
$show_data = dbarray(dbquery("SELECT * FROM ".DB_USERS." INNER JOIN ".DB_EXTEND_USERS." on ".DB_USERS.".user_id = ".DB_EXTEND_USERS.".eu_id WHERE user_id='".$user_id."'"));
opentable("User Administration" );
echo "<table cellspacing='0' cellpadding='0' border='0' class='tbl' width='100%'>\n";
echo "<tr>\n";
echo "<td width='1%' style='white-space:nowrap'><a href='members.php?aid=".$aid."' class='side'>Back to user administration</a></td>\n";
echo "<td width='100%'> | <b>".$show_data['user_name']."</b>".($show_data['eu_name'] != "" ? " - ".$show_data['eu_name']." " : "")."[<a href='mailto:".$show_data['user_email']."' class='side'>".$show_data['user_email']."</a>]</td>";
echo "</tr>\n";
echo "</table>\n";
closetable();
}
$show_data = dbarray(dbquery("SELECT * FROM ".DB_USERS." DU INNER JOIN ".DB_EXTEND_USERS." DEU on DU.user_id = DEU.eu_id WHERE DU.user_id='".$user_id."'"));
if ($_GET['step'] == "add") { // Add new user
if (isset($_POST['add_user'])) { // form have been submitted
$active_status = ($_REQUEST['show_group'] == 2 ? 0 : 2);
$add_group = ".".stripinput(trim($_REQUEST['show_group']));
$error = "";
$username = trim(eregi_replace(" +", " ", $_POST['username']));
if ($username == "" || trim($_POST['password1']) == "" || trim($_POST['email']) == "") { $error .= $locale['451']."<br />\n"; }
if (!preg_match("/^[-0-9A-Z_@\s]+$/i", $username)) { $error .= $locale['452']."<br />\n"; }
if (preg_match("/^[0-9A-Z@]{6,20}$/i", $_POST['password1'])) {
if ($_POST['password1'] != $_POST['password2']) { $error .= $locale['456']."<br />\n"; }
} else {
$error .= $locale['457']."<br />\n";
}
if (!preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $_POST['email'])) {
$error .= $locale['454']."<br />\n";
}
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_name='$username'");
if (dbrows($result)) { $error = $locale['453']."<br />\n"; }
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_email='".$_POST['email']."'");
if (dbrows($result)) { $error = $locale['455']."<br />\n"; }
$profile_method = "validate_insert"; $db_fields = ""; $db_values = "";
$result = dbquery("SELECT * FROM ".DB_USER_FIELDS." ORDER BY field_order");
if (dbrows($result)) {
while($data = dbarray($result)) {
if (file_exists(LOCALE.LOCALESET."user_fields/".$data['field_name'].".php")) {
include LOCALE.LOCALESET."user_fields/".$data['field_name'].".php";
}
if (file_exists(INCLUDES."user_fields/".$data['field_name']."_include.php")) {
include INCLUDES."user_fields/".$data['field_name']."_include.php";
}
}
}
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".(isset($db_fields) ? $db_fields : "").") VALUES('$username', '".md5(md5($_POST['password1']))."', '', '".$_POST['email']."', '".intval($_POST['hide_email'])."', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '2', '101', '0'".(isset($db_values) ? $db_values : "").")");
$this_user_id = dbarray(dbquery("SELECT * FROM ".DB_USERS." WHERE user_email = '".$email."'"));
$sql = dbquery("INSERT INTO ".DB_EXTEND_USERS." (eu_id, eu_name, eu_email) VALUES('".$this_user_id['user_id']."', '".$username."', '".$email."')");
$redirect = dbarray(dbquery("SELECT * FROM ".DB_USERS." WHERE user_name = '".$username."'"));
redirect(FUSION_SELF.$aidlink."&area=pm&step=edit&user_id=".$redirect['user_id']);
if ($error == "") {
opentable($locale['480']);
echo "<div style='text-align:center'><br />\n".$locale['481']."<br /><br />\n";
echo "<a href='members.php".$aidlink."'>".$locale['432']."</a><br /><br />\n";
echo "<a href='index.php".$aidlink."'>".$locale['433']."</a><br /><br />\n";
echo "</div>\n";
closetable();
} else {
opentable($locale['480']);
echo "<div style='text-align:center'><br />\n".$locale['482']."<br /><br />\n".$error."<br />\n";
echo "<a href='members.php".$aidlink."'>".$locale['432']."</a><br /><br />\n";
echo "<a href='index.php".$aidlink."'>".$locale['433']."</a><br /><br />\n";
echo "</div>\n";
closetable();
}
} else {
opentable($locale['480']);
echo "<form name='addform' method='post' action='".FUSION_SELF.$aidlink."&step=add'>\n";
echo "<table cellpadding='0' cellspacing='0' class='center'>\n<tr>\n";
echo "<td class='tbl'>".$locale['u001']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='username' maxlength='30' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u002']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password1' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u004']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password2' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u005']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='email' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u006']."</td>\n";
echo "<td class='tbl'><label><input type='radio' name='hide_email' value='1' />".$locale['u007']."</label> <label><input type='radio' name='hide_email' value='0' checked='checked' />".$locale['u008']."</label></td>\n";
echo "</tr>\n<tr>\n";
echo "<td align='center' colspan='2'><br />\n";
echo "<input type='submit' name='add_user' value='".$locale['480']."' class='button' /></td>\n";
echo "</tr>\n</table>\n</form>\n";
closetable();
}
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".(isset($db_fields) ? $db_fields : "").") VALUES('$username', '".md5(md5($_POST['password1']))."', '', '".$_POST['email']."', '".intval($_POST['hide_email'])."', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '2', '101', '0'".(isset($db_values) ? $db_values : "").")");
$this_user_id = dbarray(dbquery("SELECT * FROM ".DB_USERS." WHERE user_email = '".$email."'"));
$sql = dbquery("INSERT INTO ".DB_EXTEND_USERS." (eu_id, eu_name, eu_email) VALUES('".$this_user_id['user_id']."', '".$username."', '".$email."')");
$redirect = dbarray(dbquery("SELECT * FROM ".DB_USERS." WHERE user_name = '".$username."'"));
redirect(FUSION_SELF.$aidlink."&area=pm&step=edit&user_id=".$redirect['user_id']);
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".(isset($db_fields) ? $db_fields : "").") VALUES('$username', '".md5(md5($_POST['password1']))."', '', '".$_POST['email']."', '".intval($_POST['hide_email'])."', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '2', '101', '0'".(isset($db_values) ? $db_values : "").")");
$this_user_id = mysql_insert_id();
$sql = dbquery("INSERT INTO ".DB_EXTEND_USERS." (eu_id, eu_name, eu_email) VALUES('".$this_user_id."', '".$username."', '".$_POST['email']."')");
redirect(FUSION_SELF.$aidlink."&area=pm&step=edit&user_id=".$this_user_id);
if ($_GET['step'] == "add") { // Add new user
if (isset($_POST['add_user'])) { // form have been submitted
$active_status = ($_REQUEST['show_group'] == 2 ? 0 : 2);
$add_group = ".".stripinput(trim($_REQUEST['show_group']));
$error = "";
$username = trim(eregi_replace(" +", " ", $_POST['username']));
if ($username == "" || trim($_POST['password1']) == "" || trim($_POST['email']) == "") { $error .= $locale['451']."<br />\n"; }
if (!preg_match("/^[-0-9A-Z_@\s]+$/i", $username)) { $error .= $locale['452']."<br />\n"; }
if (preg_match("/^[0-9A-Z@]{6,20}$/i", $_POST['password1'])) {
if ($_POST['password1'] != $_POST['password2']) { $error .= $locale['456']."<br />\n"; }
} else {
$error .= $locale['457']."<br />\n";
}
if (!preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $_POST['email'])) {
$error .= $locale['454']."<br />\n";
}
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_name='$username'");
if (dbrows($result)) { $error = $locale['453']."<br />\n"; }
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_email='".$_POST['email']."'");
if (dbrows($result)) { $error = $locale['455']."<br />\n"; }
$profile_method = "validate_insert"; $db_fields = ""; $db_values = "";
$result = dbquery("SELECT * FROM ".DB_USER_FIELDS." ORDER BY field_order");
if (dbrows($result)) {
while($data = dbarray($result)) {
if (file_exists(LOCALE.LOCALESET."user_fields/".$data['field_name'].".php")) {
include LOCALE.LOCALESET."user_fields/".$data['field_name'].".php";
}
if (file_exists(INCLUDES."user_fields/".$data['field_name']."_include.php")) {
include INCLUDES."user_fields/".$data['field_name']."_include.php";
}
}
}
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".(isset($db_fields) ? $db_fields : "").") VALUES('$username', '".md5(md5($_POST['password1']))."', '', '".$_POST['email']."', '".intval($_POST['hide_email'])."', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '2', '101', '0'".(isset($db_values) ? $db_values : "").")");
$this_user_id = mysql_insert_id();
$sql = dbquery("INSERT INTO ".DB_EXTEND_USERS." (eu_id, eu_name, eu_email) VALUES('".$this_user_id."', '".$username."', '".$_POST['email']."')");
redirect(FUSION_SELF.$aidlink."&area=pm&step=edit&user_id=".$this_user_id);
if ($error == "") {
opentable($locale['480']);
echo "<div style='text-align:center'><br />\n".$locale['481']."<br /><br />\n";
echo "<a href='members.php".$aidlink."'>".$locale['432']."</a><br /><br />\n";
echo "<a href='index.php".$aidlink."'>".$locale['433']."</a><br /><br />\n";
echo "</div>\n";
closetable();
} else {
opentable($locale['480']);
echo "<div style='text-align:center'><br />\n".$locale['482']."<br /><br />\n".$error."<br />\n";
echo "<a href='members.php".$aidlink."'>".$locale['432']."</a><br /><br />\n";
echo "<a href='index.php".$aidlink."'>".$locale['433']."</a><br /><br />\n";
echo "</div>\n";
closetable();
}
} else {
opentable($locale['480']);
echo "<form name='addform' method='post' action='".FUSION_SELF.$aidlink."&step=add'>\n";
echo "<table cellpadding='0' cellspacing='0' class='center'>\n<tr>\n";
echo "<td class='tbl'>".$locale['u001']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='username' maxlength='30' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u002']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password1' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u004']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='password' name='password2' maxlength='20' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u005']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><input type='text' name='email' maxlength='100' class='textbox' style='width:200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['u006']."</td>\n";
echo "<td class='tbl'><label><input type='radio' name='hide_email' value='1' />".$locale['u007']."</label> <label><input type='radio' name='hide_email' value='0' checked='checked' />".$locale['u008']."</label></td>\n";
echo "</tr>\n<tr>\n";
echo "<td align='center' colspan='2'><br />\n";
echo "<input type='submit' name='add_user' value='".$locale['480']."' class='button' /></td>\n";
echo "</tr>\n</table>\n</form>\n";
closetable();
}
} elseif ($_GET['step'] == "view" && isnum($_GET['user_id'])) {
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_id='".$_GET['user_id']."'");
if (dbrows($result)) { $user_data = dbarray($result); } else { redirect(FUSION_SELF.$aidlink); }
opentable($locale['470']." ".$data['user_name']);
echo "<table cellpadding='0' cellspacing='1' width='400' class='tbl-border center'>\n<tr>\n";
if ($user_data['user_avatar'] && file_exists(IMAGES."avatars/".$user_data['user_avatar'])) {
echo "<td rowspan='5' width='1%' class='tbl'><img src='".IMAGES."avatars/".$user_data['user_avatar']."' alt='' /></td>\n";
}
echo "<td width='1%' class='tbl1' style='white-space:nowrap'>".$locale['u001']."</td>\n";
echo "<td align='right' class='tbl1'>".$user_data['user_name']."</td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='1%' class='tbl1' style='white-space:nowrap'></td>\n";
echo "<td align='right' class='tbl1'>".getuserlevel($user_data['user_level'])."</td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='1%' class='tbl1' style='white-space:nowrap'>".$locale['u005']."</td>\n";
echo "<td align='right' class='tbl1'>".hide_email($user_data['user_email'])."</td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='1%' class='tbl1' style='white-space:nowrap'>".$locale['u040']."</td>\n";
echo "<td align='right' class='tbl1'>".showdate("longdate", $user_data['user_joined'])."</td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='1%' class='tbl1' style='white-space:nowrap'>".$locale['u041']."</td>\n";
echo "<td align='right' class='tbl1'>".($user_data['user_lastvisit'] ? showdate("longdate", $user_data['user_lastvisit']) : $locale['u042'])."</td>\n";
echo "</tr>\n<tr>\n";
echo "<td colspan='".($user_data['user_avatar'] && file_exists(IMAGES."avatars/".$user_data['user_avatar']) ? "3" : "2")."' class='tbl2' style='text-align:center;white-space:nowrap'><a href='messages.php?msg_send=".$user_data['user_id']."' title='".$locale['u043']."'>".$locale['u043']."</a></td>\n";
echo "</tr>\n</table>\n";
echo "<div style='margin:5px'></div>\n";
$_GET['profile_method'] = "display"; $_GET['user_fields_output'] = ""; $i = 0; $_GET['ob_active'] = false;
$result2 = dbquery("SELECT * FROM ".DB_USER_FIELDS." ORDER BY field_group, field_order");
if (dbrows($result2)) {
while($data2 = dbarray($result2)) {
if ($i != $data2['field_group']) {
if ($ob_active) {
$user_fields_output[$i] = ob_get_contents();
ob_end_clean();
$ob_active = false;
}
$i = $data2['field_group'];
}
if (!(isset($_GET['ob_active']) ? $_GET['ob_active'] : "")) {
ob_start();
$_GET['ob_active'] = true;
}
if (file_exists(LOCALE.LOCALESET."user_fields/".$data2['field_name'].".php")) {
include LOCALE.LOCALESET."user_fields/".$data2['field_name'].".php";
}
if (file_exists(INCLUDES."user_fields/".$data2['field_name']."_include.php")) {
include INCLUDES."user_fields/".$data2['field_name']."_include.php";
}
}
}
if ($ob_active) {
$user_fields_output[$i] = ob_get_contents();
ob_end_clean();
}
if (array_key_exists(1, $user_fields_output) && $user_fields_output[1]) {
echo "<div style='margin:5px'></div>\n";
echo "<table cellpadding='0' cellspacing='1' width='400' class='tbl-border center'>\n<tr>\n";
echo "<td colspan='2' class='tbl2'><strong>".$locale['u044']."</strong></td>\n";
echo "</tr>\n".$_GET['user_fields_output'][1];
echo "</table>\n";
}
if (array_key_exists(2, $user_fields_output) && $user_fields_output[2]) {
echo "<div style='margin:5px'></div>\n";
echo "<table cellpadding='0' cellspacing='1' width='400' class='tbl-border center'>\n<tr>\n";
echo "<td colspan='2' class='tbl2'><strong>".$locale['u045']."</strong></td>\n";
echo "</tr>\n".$user_fields_output[2];
echo "</table>\n";
}
if (array_key_exists(4, $user_fields_output) && $user_fields_output[4]) {
echo "<div style='margin:5px'></div>\n";
echo "<table cellpadding='0' cellspacing='1' width='400' class='tbl-border center'>\n<tr>\n";
echo "<td colspan='2' class='tbl2'><strong>".$locale['u047']."</strong></td>\n";
echo "</tr>\n".$user_fields_output[4];
echo "</table>\n";
}
echo "<div style='margin:5px'></div>\n";
echo "<table cellpadding='0' cellspacing='1' width='400' class='tbl-border center'>\n<tr>\n";
echo "<td colspan='2' class='tbl2'><strong>".$locale['u048']."</strong></td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='1%' class='tbl1' style='white-space:nowrap'>".$locale['u049']."</td>\n";
echo "<td align='right' class='tbl1'>".$user_data['user_ip']."</td>\n";
echo "</tr>\n</table>\n";
closetable();
}
if ($error == "") {
$result = dbquery("INSERT INTO ".DB_USERS." (user_name, user_password, user_admin_password, user_email, user_hide_email, user_avatar, user_posts, user_threads, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status".(isset($db_fields) ? $db_fields : "").") VALUES('$username', '".md5(md5($_POST['password1']))."', '', '".$_POST['email']."', '".intval($_POST['hide_email'])."', '', '0', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '0'".(isset($db_values) ? $db_values : "").")");
$this_user_id = mysql_insert_id();
$result = dbquery("INSERT INTO ".DB_EXTEND_USERS." (eu_id, eu_name, eu_email) VALUES(".$this_user_id.", '".$username."', '".$_POST['email']."')");
opentable($locale['480']);
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
$user_field_name = "1.6 STEAM ID";
$user_field_desc = "Enter your 1.6 Steam ID here";
$user_field_dbname = "user_steamid";
$user_field_group = 1;
$user_field_dbinfo = "VARCHAR(30) NOT NULL DEFAULT ''";
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
if ($profile_method == "input") {
echo "<tr>\n";
echo "<td class='tbl'>1.6 STEAM ID:</td>\n";
echo "<td class='tbl'>";
echo "<input type='text' name='user_steamid' value='".(isset($user_data['user_steamid']) ? $user_data['user_steamid'] : "")."' maxlength='30' class='textbox' style='width:200px;' ";
if (!iSUPERADMIN){
echo "DISABLED />";
echo "<input type='hidden' name='user_steamid' value='".(isset($user_data['user_steamid']) ? $user_data['user_steamid'] : "")."'";
}
echo "/></td>\n</tr>\n";
} elseif ($profile_method == "validate_insert") {
$db_fields .= ", user_steamid";
$db_values .= ", '".(isset($_POST['user_steamid']) ? stripinput(trim($_POST['user_steamid'])) : "")."'";
} elseif ($profile_method == "validate_update") {
$db_values .= ", user_steamid='".(isset($_POST['user_steamid']) ? stripinput(trim($_POST['user_steamid'])) : "")."'";
}
require_once "updateuser.php";
if ($error == "") {
opentable($locale['430']);
echo "<div style='text-align:center'><br />\n";
echo $locale['431']."<br /><br />\n";
echo "<a href='members.php".$aidlink."'>".$locale['432']."</a><br /><br />\n";
echo "<a href='index.php".$aidlink."'>".$locale['433']."</a><br /><br />\n";
echo "</div>\n";
closetable();
}
require_once "updateuser.php";
if ($error == "") {
redirect(FUSION_SELF.$aidlink.'&step=edit&user_id='.$_GET['user_id']);
}
redirect(FUSION_SELF.$aidlink.'&area=pm&step=edit&user_id='.$_GET['user_id']);
redirect(FUSION_SELF.$aidlink.'&area=inv&step=edit&user_id='.$_GET['user_id']);
Category Forum
User Administration - 8Labels
None yet
Statistics
2 participants
Notifications
You are not receiving notifications from this thread.
Related Questions