View Single Post
  #9  
Old 06-20-2002, 06:26 PM
BigJohnson BigJohnson is offline
 
Join Date: Nov 2001
Posts: 535
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

HEre is some code i think that might help. This is a part of the code in the user.php

Please help me out.

PHP Code:
// ###################### Start add #######################
if ($action=="add") {

  echo 
"Add New User";

  
doformheader("user","insert");
  
maketableheader("User Profile");
          
makechoosercode("User Group","usergroupid","usergroup",2);
          
makeinputcode("User Name","ausername");
          
makeinputcode("Password","apassword");
          
makeinputcode("Email Address","email");
          
makeinputcode("User Title","usertitle");
          
makeyesnocode("Use Custom Title<br><font size='1'>(This forces the title that you put in the field above to be used)</font>","customtitle",0);
          
makestylecode("Style set","userstyleid",$user[styleid]);
          
makeinputcode("Home Page","homepage","http://www.");
          
makeinputcode("Birthday<br>(Format yyyy-mm-dd)","birthday");
// Country Hack CP Addon by Stasik (modded by AJ)
          
echo "<tr class='".getrowbg()."'><td>Country Flag</td><td nowrap>";
          eval(
"\$countrytext.= \"".gettemplate("modifyprofile_country")."\";");
          echo 
"$countrytext</td></tr>";
// Country Hack CP Addon End
          
maketextareacode("Signature","signature","",8,45);
          
makeinputcode("ICQ Number","icq");
          
makeinputcode("AIM Handle","aim");
          
makeinputcode("Yahoo Messenger Handle","yahoo");
          
makeyesnocode("COPPA user","coppauser",0);
          
makeinputcode("Parent Email Address","parentemail");
  
maketableheader("Options");
          
makeyesnocode("Receive mailings from admins","adminemail",1);
          
makeyesnocode("Receive Community Bulletin Email","receivebulletin",1);
          
makeyesnocode("Receive Community Bulletin Email Type (Yes = HTML, No = Text)","receivebulletin_type",1);
          
makeyesnocode("Show email address","showemail",1);
          
makeyesnocode("Invisible on 'Online users' list","invisible",0);
          
makeyesnocode("Receive PMs","receivepm",1);
          
makeyesnocode("Email on PM","emailonpm",0);
          
makeyesnocode("PM Popup","pmpopup",0);
          
makeyesnocode("Show Signatures","showsignatures",1);
          
makeyesnocode("Show Avatars","showavatars",1);
          
makeyesnocode("Show Images","showimages",1);
          
makeyesnocode("Show VBcode","showvbcode",1);
          
makeyesnocode("Use email notification by default","emailnotification",1);
          
makeyesnocode("Remember Username and password","cookieuser",1);
          
makeyesnocode("Browse boards with cookies","nosessionhash",1);
          
makeinputcode("Join Date<br>(Format yyyy-mm-dd, leave blank for today)","joindate");
          
makeinputcode("Default view age<br>'Select threads from last x days'<br>Recommended values: 1, 2, 5, 10, 20, 30, 45, 60, 75, 100, 365, 1000 (ie all). -1 gives default forum selection","daysprune","-1");
          
makeinputcode("Last Visit<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastvisit");
          
makeinputcode("Last Activity<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastactivity");
          
makeinputcode("Last Post<br>(Format yyyy-mm-dd hh:mm:ss, leave blank for today)","lastpost");
          
makeinputcode("Number of Posts","posts","0");
          
makeinputcode("Number of Points","storep","0");
          
makeinputcode("Time Zone Offset (hours)","timezoneoffset","0");
          
makeinputcode("IP Address","aipaddress",$ipaddress);
  
maketableheader("Custom Profile Fields");
  
$profilefields=$DB_site->query("SELECT profilefieldid,title FROM profilefield");
  while (
$profilefield=$DB_site->fetch_array($profilefields)) {
    
makeinputcode($profilefield[title],"field".$profilefield[profilefieldid]);
  }

  
doformfooter("Save");
}

// ###################### Start insert #######################
if ($HTTP_POST_VARS['action']=="insert") {

        if (!isset(
$ausername) or $ausername == '') {
                echo 
"<p>You did not give this user an username</p>";
                exit;
        }

        if (
$exists=$DB_site->query_first("SELECT userid FROM user WHERE username='".addslashes(htmlspecialchars($ausername))."'")) {
                echo 
"There is already an ".makelinkcode('user',"user.php?do=edit&userid=$exists[userid]",1)." named <b>".htmlspecialchars($ausername)."</b>";
                exit;
        }

        if (!isset(
$apassword) or $apassword == '') {
                echo 
"You did not give this user a password";
                exit;
        }

  if (
$joindate=="") {
    
$joindate=time();
  } else {
    
$joindate="UNIX_TIMESTAMP('".addslashes($joindate)."')";
  }
  if (
$lastvisit=="") {
    
$lastvisit=time();
  } else {
    
$lastvisit="UNIX_TIMESTAMP('".addslashes($lastvisit)."')";
  }
  if (
$lastactivity=="") {
    
$lastactivity=time();
  } else {
    
$lastactivity="UNIX_TIMESTAMP('".addslashes($lastactivity)."')";
  }
  if (
$lastpost=="") {
    
$lastpost=time();
  } else {
    
$lastpost="UNIX_TIMESTAMP('".addslashes($lastpost)."')";
  }
  if (
$biography=="Location:\r\nOccupation:\r\nInterests:\r\n") {
    
$biography="";
  }

/* remove because it did not like 0000 as year-J $temp = explode("-", $birthday);
  if ((!checkdate($temp[1],$temp[2],$temp[0]))||(!ereg("^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$",$birthday)))
    $birthday = 0; */

  
$options=iif($showsignatures==1,SHOWSIGNATURES,0);
  
$options+=iif($showavatars==1,SHOWAVATARS,0);
  
$options+=iif($showimages==1,SHOWIMAGES,0);
  
$options+=iif($showvbcode==1,SHOWVBCODE,0);

  
$DB_site->query("INSERT INTO user (userid,usergroupid,username,password,email,styleid,parentemail,coppauser,homepage,icq,aim,yahoo,signature,adminemail,receivebulletin,receivebulletin_type,showemail,invisible,usertitle,customtitle,joindate,cookieuser,daysprune,lastvisit,lastactivity,lastpost,posts,storep,timezoneoffset,emailnotification,receivepm,emailonpm,ipaddress,pmpopup,options,birthday) VALUES (NULL,'$usergroupid','".addslashes(htmlspecialchars($ausername))."','".addslashes(md5($apassword))."','".addslashes(htmlspecialchars($email))."','$userstyleid','".addslashes(htmlspecialchars($parentemail))."','$coppauser','".addslashes(htmlspecialchars($homepage))."','".addslashes(htmlspecialchars($icq))."','".addslashes(htmlspecialchars($aim))."','".addslashes(htmlspecialchars($yahoo))."','".addslashes($signature)."','$adminemail','$receivebulletin','$showemail','$invisible','".addslashes($usertitle)."','$customtitle',$joindate,'$cookieuser','$daysprune',$lastvisit,$lastactivity,$lastpost,'$posts','$storep','$timezoneoffset','$emailnotification','$receivepm','$emailonpm','".addslashes($aipaddress)."','$pmpopup','$options','$birthday')");
  
$userid=$DB_site->insert_id();

  
$userfields="";
  
$userfieldsnames="(userid";
  
$profilefields=$DB_site->query("SELECT maxlength,profilefieldid,title
                                  FROM profilefield
                                  ORDER BY displayorder"
);
  while (
$profilefield=$DB_site->fetch_array($profilefields)) {
    
$varname="field$profilefield[profilefieldid]";
    
$userfieldsnames.=",field$profilefield[profilefieldid]";
    
$userfields.=",'".addslashes(htmlspecialchars($$varname))."'";
  }
  
$userfieldsnames.=')';

  
$DB_site->query("INSERT INTO userfield $userfieldsnames VALUES ($userid$userfields)");

  
$action="modify";

  echo 
"<p>Record added</p>";


Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01202 seconds
  • Memory Usage 1,912KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete