register.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 1,948 行 · 第 1/5 页
PHP
1,948 行
$this->email->subject = $this->ipsclass->lang['email_reg_subj']." ".$this->ipsclass->vars['board_name']; $this->email->to = $member['email']; $this->email->send_mail(); } else if ( $val['email_chg'] == 1 ) { $this->email->get_template("newemail"); $this->email->build_message( array( 'NAME' => $member['members_display_name'], 'THE_LINK' => $this->base_url_nosess."?act=Reg&CODE=03&type=newemail&uid=".$member['id']."&aid=".$val['vid'], 'ID' => $member['id'], 'MAN_LINK' => $this->base_url_nosess."?act=Reg&CODE=07", 'CODE' => $val['vid'], ) ); $this->email->subject = $this->ipsclass->lang['ne_subject'].' '.$this->ipsclass->vars['board_name']; $this->email->to = $member['email']; $this->email->send_mail(); } else { $this->revalidate_one('err_no_validations'); return; } $this->output .= $this->ipsclass->compiled_templates['skin_register']->show_revalidated(); $this->page_title = $this->ipsclass->lang['rv_title']; $this->nav = array( $this->ipsclass->lang['rv_title'] ); } /*-------------------------------------------------------------------------*/ // Coppa Start /*-------------------------------------------------------------------------*/ function coppa_perms_form() { echo($this->ipsclass->compiled_templates['skin_register']->coppa_form()); exit(); } /*-------------------------------------------------------------------------*/ // Coppa form /*-------------------------------------------------------------------------*/ function coppa_start() { $coppa_date = date( 'j-F y', mktime(0,0,0,date("m"),date("d"),date("Y")-13) ); $this->ipsclass->lang['coppa_form_text'] = str_replace( "<#FORM_LINK#>", "<a href='{$this->ipsclass->base_url}act=Reg&CODE=12'>{$this->ipsclass->lang['coppa_link_form']}</a>", $this->ipsclass->lang['coppa_form_text']); $this->output .= $this->ipsclass->compiled_templates['skin_register']->coppa_start($coppa_date); $this->page_title = $this->ipsclass->lang['coppa_title']; $this->nav = array( $this->ipsclass->lang['coppa_title'] ); } /*-------------------------------------------------------------------------*/ // Coppa print /*-------------------------------------------------------------------------*/ function coppa_two() { $this->ipsclass->lang['coppa_form_text'] = str_replace( "<#FORM_LINK#>", "<a href='{$this->ipsclass->base_url}act=Reg&CODE=12'>{$this->ipsclass->lang['coppa_link_form']}</a>", $this->ipsclass->lang['coppa_form_text']); $this->output .= $this->ipsclass->compiled_templates['skin_register']->coppa_two(); $this->page_title = $this->ipsclass->lang['coppa_title']; $this->nav = array( $this->ipsclass->lang['coppa_title'] ); } /*-------------------------------------------------------------------------*/ // lost_password_start /*-------------------------------------------------------------------------*/ function lost_password_start($errors="") { if ($this->ipsclass->vars['bot_antispam']) { //----------------------------------------- // Sort out the security code //----------------------------------------- $r_date = time() - (60*60*6); //----------------------------------------- // Remove old reg requests from the DB //----------------------------------------- $this->ipsclass->DB->simple_exec_query( array( 'delete' => 'reg_antispam', 'where' => "ctime < '$r_date'" ) ); //----------------------------------------- // Set a new ID for this reg request... //----------------------------------------- $regid = md5( uniqid(microtime()) ); //----------------------------------------- // Set a new 6 character numerical string //----------------------------------------- mt_srand ((double) microtime() * 1000000); $reg_code = mt_rand(100000,999999); //----------------------------------------- // Insert into the DB //----------------------------------------- $this->ipsclass->DB->do_insert( 'reg_antispam', array ( 'regid' => $regid, 'regcode' => $reg_code, 'ip_address' => $this->ipsclass->input['IP_ADDRESS'], 'ctime' => time(), ) ); } $this->page_title = $this->ipsclass->lang['lost_pass_form']; $this->nav = array( $this->ipsclass->lang['lost_pass_form'] ); if ($errors != "") { $this->output .= $this->ipsclass->compiled_templates['skin_register']->errors( $this->ipsclass->lang[$errors]); } $this->output .= $this->ipsclass->compiled_templates['skin_register']->lost_pass_form($regid); if ($this->ipsclass->vars['bot_antispam'] == 'gd') { $this->output = str_replace( "<!--{REG.ANTISPAM}-->", $this->ipsclass->compiled_templates['skin_register']->bot_antispam_gd( $regid ), $this->output ); } else if ($this->ipsclass->vars['bot_antispam'] == 'gif') { $this->output = str_replace( "<!--{REG.ANTISPAM}-->", $this->ipsclass->compiled_templates['skin_register']->bot_antispam( $regid ), $this->output ); } } /*-------------------------------------------------------------------------*/ // LOST PASSWORD: SEND /*-------------------------------------------------------------------------*/ function lost_password_end() { if ($this->ipsclass->vars['bot_antispam']) { //----------------------------------------- // Security code stuff //----------------------------------------- if ($this->ipsclass->input['regid'] == "") { $this->lost_password_start('err_reg_code'); return; } $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'reg_antispam', 'where' => "regid='".trim(addslashes($this->ipsclass->input['regid']))."'" ) ); $this->ipsclass->DB->simple_exec(); if ( ! $row = $this->ipsclass->DB->fetch_row() ) { $this->show_reg_form('err_reg_code'); return; } if ( trim( intval($this->ipsclass->input['reg_code']) ) != $row['regcode'] ) { $this->lost_password_start('err_reg_code'); return; } } //----------------------------------------- // Back to the usual programming! :o //----------------------------------------- if ($_POST['member_name'] == "") { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_username' ) ); } //----------------------------------------- // Check for input and it's in a valid format. //----------------------------------------- $member_name = trim(strtolower($this->ipsclass->input['member_name'])); if ($member_name == "") { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_username' ) ); } //----------------------------------------- // Attempt to get the user details from the DB //----------------------------------------- if ( $this->ipsclass->vars['converge_login_method'] == 'username' ) { $this->ipsclass->DB->simple_construct( array( 'select' => 'members_display_name, name, id, email, mgroup', 'from' => 'members', 'where' => "LOWER(name)='$member_name'" ) ); $this->ipsclass->DB->simple_exec(); } else { $this->ipsclass->DB->simple_construct( array( 'select' => 'members_display_name, name, id, email, mgroup', 'from' => 'members', 'where' => "LOWER(email)='$member_name'" ) ); $this->ipsclass->DB->simple_exec(); } if ( ! $this->ipsclass->DB->get_num_rows() ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_such_user' ) ); } else { $member = $this->ipsclass->DB->fetch_row(); //----------------------------------------- // Is there a validation key? If so, we'd better not touch it //----------------------------------------- if ($member['id'] == "") { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_such_user' ) ); } $validate_key = md5( $this->ipsclass->make_password() . uniqid( mt_rand(), TRUE ) ); //----------------------------------------- // Get rid of old entries for this member //----------------------------------------- $this->ipsclass->DB->simple_exec_query( array( 'delete' => 'validating', 'where' => "member_id={$member['id']} AND lost_pass=1" ) ); //----------------------------------------- // Update the DB for this member. //----------------------------------------- $db_str = array( 'vid' => $validate_key, 'member_id' => $member['id'], 'real_group' => $member['mgroup'], 'temp_group' => $member['mgroup'], 'entry_date' => time(), 'coppa_user' => 0, 'lost_pass' => 1, 'ip_address' => $this->ipsclass->input['IP_ADDRESS'] ); $this->ipsclass->DB->do_insert( 'validating', $db_str ); //----------------------------------------- // Send out the email. //----------------------------------------- $this->email->get_template("lost_pass"); $this->email->build_message( array( 'NAME' => $member['members_display_name'], 'PASSWORD' => $new_pass, 'THE_LINK' => $this->base_url_nosess."?act=Reg&CODE=lostpassform&uid=".$member['id']."&aid=".$validate_key, 'MAN_LINK' => $this->base_url_nosess."?act=Reg&CODE=lostpassform", 'EMAIL' => $member['email'], 'ID' => $member['id'], 'CODE' => $validate_key, 'IP_ADDRESS' => $this->ipsclass->input['IP_ADDRESS'], ) ); $this->email->subject = $this->ipsclass->lang['lp_subject'].' '.$this->ipsclass->vars['board_name']; $this->email->to = $member['email']; $this->email->send_mail(); $this->output = $this->ipsclass->compiled_templates['skin_register']->show_lostpasswait( $member ); } $this->page_title = $this->ipsclass->lang['lost_pass_form']; } /*-------------------------------------------------------------------------*/ // show_reg_form /*-------------------------------------------------------------------------*/ function show_reg_form($form_errors = array()) { //----------------------------------------- // INIT //----------------------------------------- $final_errors = array(); if ( $this->ipsclass->vars['no_reg'] == 1 ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'reg_off' ) ); } $coppa = ($this->ipsclass->input['coppa_user'] == 1) ? 1 : 0; //----------------------------------------- // Read T&Cs yet? //----------------------------------------- if ( ! $this->ipsclass->input['termsread'] ) { //----------------------------------------- // Temp Fix to HiveMail.. // If we have a logged in member, and a mailsign up call, // we don't want to show the terms. Boink. //----------------------------------------- if ( $this->ipsclass->member['id'] && $this->ipsclass->input['mailsignup']) { $this->ipsclass->boink_it( $this->ipsclass->base_url.'act=Reg&mailsignup=1&coppa_pass=1&termsread=1&agree_to_terms=1' ); } //----------------------------------------- // Log member out //----------------------------------------- require_once( ROOT_PATH.'sources/action_public/login.php' ); $login = new login(); $login->ipsclass =& $this->ipsclass; $login->do_log_out( 0 ); //----------------------------------------- // Continue //----------------------------------------- $cache = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'conf_settings', 'where' => "conf_key='reg_rules'" ) ); $text = $cache['conf_value'] ? $cache['conf_value'] : $cache['conf_default']; $this->page_title = $this->ipsclass->lang['registration_form']; $this->nav = array( $this->ipsclass->lang['registration_form'] ); $this->output .= $this->ipsclass->compiled_templates['skin_register']->show_terms( $this->ipsclass->my_nl2br($text), $coppa ); return; } else { //----------------------------------------- // Did we agree to the t&c? //----------------------------------------- if ( ! $this->ipsclass->input['agree_to_terms'] ) { $this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'reg_no_agree', 'EXTRA' => $this->ipsclass->base_url ) ); } } //----------------------------------------- // Do we have another URL that one needs // to visit to register? //----------------------------------------- $this->login_method = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1' ) ); if ( $this->login_method['login_register_url'] ) { $this->ipsclass->boink_it( $this->login_method['login_register_url'] ); exit(); } //----------------------------------------- // Continue... //----------------------------------------- if ( $this->ipsclass->vars['reg_auth_type'] ) { $this->ipsclass->lang['std_text'] .= "<br />" . $this->ipsclass->lang['email_validate_text']; //----------------------------------------- // User then admin? //----------------------------------------- if ( $this->ipsclass->vars['reg_auth_type'] == 'admin_user' ) { $this->ipsclass->lang['std_text'] .= "<br />" . $this->ipsclass->lang['user_admin_validation'];
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?