Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: dėl nariu peržiurėjimo

Parašė altenis· 2010 Rugp. 26 16:08:44
#5

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright (c) 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "../maincore.php";
require_once BASEDIR."subheader.php";
require_once ADMIN."navigation.php";
include LOCALE.LOCALESET."admin/members.php";
include LOCALE.LOCALESET."user_fields.php";

if (!checkrights("M")) fallback("../index.php");
if (isset($user_id) && !isNum($user_id)) fallback("index.php");
if (!isset($step)) $step = "";

if ($step == "add") {
   if (isset($_POST['add_user'])) {
      $error = "";
      
      $username = trim(eregi_replace(" +", " ", $_POST['username']));
      
      if ($username == "" || $_POST['password1'] == "" || $_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_prefix."users WHERE user_name='$username'");
      if (dbrows($result) != 0) $error = $locale['453']."<br>\n";
      
      $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_email='".$_POST['email']."'");
      if (dbrows($result) != 0) $error = $locale['455']."<br>\n";
      
      if ($error == "") {
         $result = dbquery("INSERT INTO ".$db_prefix."users VALUES('', '$username', md5('$password1'), '$email', '$hide_email', '', '0000-00-00', '', '', '', '', '', 'Default', '0', '', '', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '0')");
         opentable($locale['480']);
         echo "<center><br>
".$locale['481']."<br><br>
<a href='members.php'>".$locale['432']."</a><br><br>
<a href='index.php'>".$locale['433']."</a><br><br>
</center>\n";
         closetable();
      } else {
         opentable($locale['480']);
         echo "<center><br>
".$locale['482']."<br><br>
$error<br>
<a href='members.php'>".$locale['432']."</a><br><br>
<a href='index.php'>".$locale['433']."</a><br><br>
</center>\n";
         closetable();
      }
   } else {
      opentable($locale['480']);
      echo "<form name='addform' method='post' action='".FUSION_SELF."?step=add' onSubmit='return ValidateForm(this)'>
<table align='center' cellspacing='0' cellpadding='0'>
<tr>
<td class='tbl'>".$locale['u001']."<span style='color:#ff0000'>*</span></td>
<td class='tbl'><input type='text' name='username' maxlength='30' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['u002']."<span style='color:#ff0000'>*</span></td>
<td class='tbl'><input type='password' name='password1' maxlength='20' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['u004']."<span style='color:#ff0000'>*</span></td>
<td class='tbl'><input type='password' name='password2' maxlength='20' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['u005']."<span style='color:#ff0000'>*</span></td>
<td class='tbl'><input type='text' name='email' maxlength='100' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['u006']."</td>
<td class='tbl'><input type='radio' name='hide_email' value='1'>".$locale['u007']."<input type='radio' name='hide_email' value='0' checked>".$locale['u008']."</td>
</tr>
</tr>
<tr>
<td align='center' colspan='2'><br>
<input type='submit' name='add_user' value='".$locale['480']."' class='button'>
</td>
</tr>
</table>
</form>\n";
      closetable();
   }
} elseif ($step == "view") {
   $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id='$user_id'");
   if (dbrows($result)) { $data = dbarray($result); } else { header("Location: ".FUSION_SELF); }
   
   opentable($locale['470'].$data['user_name']);
   echo "<table align='center' cellpadding='0' cellspacing='0'>
   <tr>\n<td class='tbl2' colspan='3'><b>".$locale['471']."</b></td>\n\n</tr>
   <tr>\n<td align='center' width='150' rowspan='8' class='tbl'>\n";
   
   echo ($data['user_avatar'] ? "<img src='".IMAGES."avatars/".$data['user_avatar']."'>" : $locale['u046'])."\n</td>\n";
   
   echo "<td width='125' class='tbl'>".$locale['u005']."</td>\n<td class='tbl'>\n";
   echo ($data['user_hide_email'] != "1" || iADMIN ? "<a href='mailto:".$data['user_email']."'>".$data['user_email']."</a>" : $locale['u047'])."</td>\n</tr>\n";
   
   echo "<tr>\n<td class='tbl'>".$locale['u009']."</td>\n<td class='tbl'>\n";
   echo ($data['user_location'] ? $data['user_location'] : $locale['u048'])."</td>\n</tr>\n";
   
   echo "<tr>\n<td class='tbl'>".$locale['u010']."</td>\n<td class='tbl'>";
   if ($data['user_birthdate'] != "0000-00-00") {
      $months = explode("|", $locale['months']);
      $user_birthdate = explode("-", $data['user_birthdate']);
      echo $months[number_format($user_birthdate['1'])]." ".number_format($user_birthdate['2'])." ".$user_birthdate['0']."</td>\n</tr>\n";
   } else {
      echo $locale['u048']."</td>\n</tr>\n";
   }
   
   echo "<tr>\n<td class='tbl'>".$locale['u021']."</td>\n<td class='tbl'>\n";
   echo ($data['user_aim'] ? $data['user_aim'] : $locale['u048'])."</td>\n</tr>\n";



   
   echo "<tr>\n<td class='tbl'>".$locale['u011']."</td>\n<td class='tbl'>\n";
   echo ($data['user_icq'] ? $data['user_icq'] : $locale['u048'])."</td>\n</tr>\n";
   
   echo "<tr>\n<td class='tbl'>".$locale['u012']."</td>\n<td class='tbl'>\n";
   echo ($data['user_msn'] ? $data['user_msn'] : $locale['u048'])."</td>\n</tr>\n";
   
   echo "<tr>\n<td class='tbl'>".$locale['u013']."</td>\n<td class='tbl'>\n";
   echo ($data['user_yahoo'] ? $data['user_yahoo'] : $locale['u048'])."</td>\n</tr>\n";
   
   echo "<tr>\n<td class='tbl'>".$locale['u014']."</td>\n<td class='tbl'>";
   if ($data['user_web']) {
      $urlprefix = !strstr($data['user_web'], "http://") ? "http://" : "";
      echo "<a href='".$urlprefix.$data['user_web']."' target='_blank'>".$data['user_web']."</a></td>\n</tr>\n";
   } else {
      echo $locale['u048']."</td>\n</tr>\n";
   }
   
   echo "<tr>\n<td class='tbl2' colspan='3'><b>".$locale['472']."</b></td>\n\n</tr>\n";
   
   echo "<tr>\n<td class='tbl'>".$locale['u040']."</td>\n<td class='tbl' colspan='2'>\n";
   echo showdate("longdate", $data['user_joined'])."</td>\n</tr>\n";
   
   echo "<tr>\n<td class='tbl'>".$locale['u041']."</td>\n<td class='tbl' colspan='2'>\n";
   echo dbcount("(shout_id)", "shoutbox", "shout_name='".$data['user_id']."'")."</td>\n</tr>\n";
   
   echo "<tr>\n<td class='tbl'>".$locale['u042']."</td>\n<td class='tbl' colspan='2'>\n";
   echo dbcount("(comment_id)", "comments", "comment_name='".$data['user_id']."'")."</td>\n</tr>\n";
   
   echo "<tr>\n<td class='tbl'>".$locale['u043']."</td>\n<td class='tbl' colspan='2'>\n";
   //echo dbcount("(post_id)", "posts", "post_author='".$data['user_id']."'")."</td>\n</tr>\n";
   echo $data['user_posts']."</td>\n</tr>\n";
   
   echo "<tr>\n<td class='tbl'>".$locale['u044']."</td>\n<td class='tbl' colspan='2'>\n";
   echo ($data['user_lastvisit'] != 0 ? showdate("longdate", $data['user_lastvisit']) : $locale['u049'])."</td>\n</tr>\n";
   
   echo "<tr>\n<td class='tbl'>".$locale['u045']."</td>\n<td class='tbl' colspan='2'>\n";
   echo getuserlevel($data['user_level'])."</td>\n</tr>\n";
   
   if ($data['user_groups']) {
      echo "<tr>\n<td class='tbl2' colspan='3'><b>".$locale['473']."</b></td>\n\n</tr>\n<tr>\n<td class='tbl' colspan='3'>\n";
      $user_groups = (strpos($data['user_groups'], ".") == 0 ? explode(".", substr($data['user_groups'], 1)) : explode(".", $data['user_groups']));
      for ($i = 0;$i < count($user_groups);$i++) {
         echo getgroupname($user_groups[$i]);
         if ($i != (count($user_groups)-1)) echo ", ";
      }
      echo "</td>\n</tr>\n";
   }

   echo "</table>\n";
   closetable();
} elseif ($step == "edit") {
   if (isset($_POST['savechanges'])) {
      require_once "updateuser.php";
      if ($error == "") {
         opentable($locale['430']);
         echo "<center><br>
".$locale['431']."<br><br>
<a href='members.php'>".$locale['432']."</a><br><br>
<a href='index.php'>".$locale['433']."</a><br><br>
</center>\n";
         closetable();
      } else {
         opentable($locale['430']);
         echo "<center><br>
".$locale['434']."<br><br>
$error<br>
<a href='members.php'>".$locale['432']."</a><br><br>
<a href='index.php'>".$locale['433']."</a><br><br>
</center>\n";
         closetable();
      }
   } else {
      $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id='$user_id'");
      if (dbrows($result)) { $data = dbarray($result); } else { header("Location: ".FUSION_SELF); }
      
      if ($data['user_birthdate']!="0000-00-00") {
         $user_birthdate = explode("-", $data['user_birthdate']);
         $user_month = number_format($user_birthdate['1']);
         $user_day = number_format($user_birthdate['2']);
         $user_year = $user_birthdate['0'];
      } else {
         $user_month = 0; $user_day = 0; $user_year = 0;
      }
      $theme_files = makefilelist(THEMES, ".|..", true, "folders");
      array_unshift($theme_files, "Default");
      $offset_list = "";
      for ($i=-13;$i<17;$i++) {
         if ($i > 0) { $offset = "+".$i; } else { $offset = $i; }
         $offset_list .= "<option".($offset == $data['user_offset'] ? " selected" : "").">$offset</option>\n";
      }
      opentable($locale['430']);
      echo "<form name='inputform' method='post' action='".FUSION_SELF."?step=edit&user_id=$user_id' enctype='multipart/form-data'>
<table align='center' cellspacing='0' cellpadding='0'>
<tr>
<td class='tbl'>".$locale['u001']."<font color='red'>*&nbsp</font></td>
<td class='tbl'><input type='text' name='user_name' value='".$data['user_name']."' maxlength='30' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['u003']."</td>
<td class='tbl'><input type='password' name='user_newpassword' maxlength='20' class='textbox' style='width:200px;'></td>
</tr>



<tr>
<td class='tbl'>".$locale['u005']."<font color='red'>*&nbsp</font></td>
<td class='tbl'><input type='text' name='user_email' value='".$data['user_email']."' maxlength='100' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['u006']."</td>
<td class='tbl'><input type='radio' name='user_hide_email' value='1'".($data['user_hide_email'] == "1" ? " checked" : "").">".$locale['u007']."
<input type='radio' name='user_hide_email' value='0'".($data['user_hide_email'] == "0" ? " checked" : "").">".$locale['u008']."</td>
</tr>
<tr>
<td class='tbl'>".$locale['u009']."</td>
<td class='tbl'><input type='text' name='user_location' value='".$data['user_location']."' maxlength='50' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['u010']." <span class='small2'>(mm/dd/yyyy)</span></td>
<td class='tbl'><select name='user_month' class='textbox'>\n<option> </option>\n";
for ($i=1;$i<=12;$i++) echo "<option".($user_month == $i ? " selected" : "").">$i</option>\n";
echo "</select>
<select name='user_day' class='textbox'>\n<option> </option>\n";
for ($i=1;$i<=31;$i++) echo "<option".($user_day == $i ? " selected" : "").">$i</option>\n";
echo "</select>
<select name='user_year' class='textbox'>\n<option> </option>\n";
for ($i=1900;$i<=2004;$i++) echo "<option".($user_year == $i ? " selected" : "").">$i</option>\n";
echo "</select>
</td>
</tr>
<tr>
<td class='tbl'>".$locale['u021']."</td>
<td class='tbl'><input type='text' name='user_aim' value='".$data['user_aim']."' maxlength='16' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['u011']."</td>
<td class='tbl'><input type='text' name='user_icq' value='".$data['user_icq']."' maxlength='15' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['u012']."</td>
<td class='tbl'><input type='text' name='user_msn' value='".$data['user_msn']."' maxlength='100' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['u013']."</td>
<td class='tbl'><input type='text' name='user_yahoo' value='".$data['user_yahoo']."' maxlength='50' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td class='tbl'>".$locale['u014']."</td>
<td class='tbl'><input type='text' name='user_web' value='".$data['user_web']."' maxlength='200' class='textbox' style='width:200px;'></td>
</tr>
</tr>
<tr>
<td class='tbl'>".$locale['u015']."</td>
<td class='tbl'><select name='user_theme' class='textbox' style='width:100px;'>
".makefileopts($theme_files, $data['user_theme'])."
</select></td>
</tr>
</tr>
<tr>
<td class='tbl'>".$locale['u016']."</td>
<td class='tbl'><select name='user_offset' class='textbox' style='width:100px;'>
$offset_list</select></td>
</tr>\n";
if (!$data['user_avatar']) {
echo "<tr>
<td class='tbl'>".$locale['u017']."</td>
<td class='tbl'>
<input type='file' name='user_avatar' enctype='multipart/form-data' class='textbox' style='width:200px;'><br>
<span class='small2'>".$locale['u018']."</span>
</td>
</tr>\n";
}
echo "<tr>



Redagavo altenis· 2010 Rugp. 26 16:08:35