Changeset 1524 in ExiteCMS for trunk/register.php


Ignore:
Timestamp:
07/05/08 12:58:33 (4 years ago)
Author:
hverton
Message:

added code coloring for [code] bbcode sections, and an option to download the code
fixed a bug with pm read timestamps
registration now sends a pm to the webmaster when new user activation is set to admin-approval
user activation has been extended to work with both manual approvals and with email verification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/register.php

    r1449 r1524  
    1717require_once PATH_INCLUDES."dns_functions.php"; 
    1818 
     19// do we want extensive email checks? 
     20define('CHECK_EMAIL', true); 
     21 
    1922// temp storage for template variables 
    2023$variables = array(); 
     
    3841            $user_info = unserialize($data['user_info']); 
    3942            $activation = $settings['admin_activation'] == "1" ? "2" : "0"; 
    40             $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_fullname, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status, user_newsletters) VALUES('".$user_info['user_name']."', '".$user_info['user_fullname']."', '".md5(md5($user_info['user_password']))."', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', '0000-00-00', '', '', '', '', '', 'Default', '".$user_info['user_offset']."', '', '', '0', '".time()."', '".time()."', '".USER_IP."', '', '', '101', '$activation', '1')"); 
     43            $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_fullname, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_locale, user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status, user_newsletters) VALUES('".$user_info['user_name']."', '".$user_info['user_fullname']."', '".md5(md5($user_info['user_password']))."', '".$user_info['user_email']."', '".$user_info['user_hide_email']."', '', '0000-00-00', '', '', '', '', '', '".$settings['locale']."', 'Default', '".$user_info['user_offset']."', '', '', '0', '".time()."', '".time()."', '".USER_IP."', '', '', '101', '$activation', '1')"); 
    4144            $result = dbquery("DELETE FROM ".$db_prefix."new_users WHERE user_code='$activate'");    
    4245            if ($settings['admin_activation'] == "1") { 
     
    7477        } 
    7578         
    76         $email_domain = substr(strrchr($email, "@"), 1); 
    77         if (CMS_getmxrr($email_domain, $mxhosts)) { 
    78             // Get the hostname the MX record points to 
    79             $mailhost = $mxhosts[0]; 
    80         } else { 
    81             // No MX record for this domain. Might be a hostname that accepts email 
    82             $mailhost = $email_domain; 
    83         } 
    84         $mailhost_ip = gethostbyname($mailhost); 
    85         if ($mailhost != $mailhost_ip) { 
    86             // found the mailserver for this email address. Check if the address exists 
    87             require_once PATH_INCLUDES.'smtp_include.php'; 
    88             $mail = new SMTP(); 
    89             if (!$mail->Connect($mailhost_ip, 0, 60)) {     // default SMTP port, 60sec timeout 
    90                 // mail server doesn't respond 
    91                 $error .= sprintf($locale['413'], $email_domain)."<br /><br />\n"; 
    92             } else { 
    93                 if (!$mail->Hello(substr(strrchr($settings['siteemail'], "@"), 1))) { 
    94                     // mail server doesn't respond to HELLO message 
     79        if (CHECK_EMAIL) { 
     80            $email_domain = substr(strrchr($email, "@"), 1); 
     81            if (CMS_getmxrr($email_domain, $mxhosts)) { 
     82                // Get the hostname the MX record points to 
     83                $mailhost = $mxhosts[0]; 
     84            } else { 
     85                // No MX record for this domain. Might be a hostname that accepts email 
     86                $mailhost = $email_domain; 
     87            } 
     88            $mailhost_ip = gethostbyname($mailhost); 
     89            if ($mailhost != $mailhost_ip) { 
     90                // found the mailserver for this email address. Check if the address exists 
     91                require_once PATH_INCLUDES.'smtp_include.php'; 
     92                $mail = new SMTP(); 
     93                if (!$mail->Connect($mailhost_ip, 0, 60)) {     // default SMTP port, 60sec timeout 
     94                    // mail server doesn't respond 
    9595                    $error .= sprintf($locale['413'], $email_domain)."<br /><br />\n"; 
    9696                } else { 
    97                     if (!$mail->Mail('address-validation'.strrchr($settings['siteemail'], "@"))) { 
    98                         // mail server doesn't respond to MAIL FROM message 
     97                    if (!$mail->Hello(substr(strrchr($settings['siteemail'], "@"), 1))) { 
     98                        // mail server doesn't respond to HELLO message 
    9999                        $error .= sprintf($locale['413'], $email_domain)."<br /><br />\n"; 
    100100                    } else { 
    101                         if (!$mail->CheckRecipient($email)) { 
    102                             // mail server doesn't respond to RCPT TO message 
    103                             $error .= sprintf($locale['414'], $email, $mailhost)."<br /><br />\n"; 
     101                        if (!$mail->Mail('address-validation'.strrchr($settings['siteemail'], "@"))) { 
     102                            // mail server doesn't respond to MAIL FROM message 
     103                            $error .= sprintf($locale['413'], $email_domain)."<br /><br />\n"; 
    104104                        } else { 
    105                             // email address is accepted 
     105                            if (!$mail->CheckRecipient($email)) { 
     106                                // mail server doesn't respond to RCPT TO message 
     107                                $error .= sprintf($locale['414'], $email, $mailhost)."<br /><br />\n"; 
     108                            } else { 
     109                                // email address is accepted 
     110                            } 
    106111                        } 
    107112                    } 
     113                    $mail->Quit(); 
    108114                } 
    109                 $mail->Quit(); 
    110             } 
    111         } else { 
    112             $error .= sprintf($locale['412'], $email_domain)."<br /><br />\n"; 
    113         } 
    114      
     115            } else { 
     116                $error .= sprintf($locale['412'], $email_domain)."<br /><br />\n"; 
     117            } 
     118        } 
     119 
    115120        $result = dbquery("SELECT * FROM ".$db_prefix."blacklist WHERE blacklist_email='".$email."' OR blacklist_email='$email_domain'"); 
    116121        if (dbrows($result) != 0) $error .= $locale['411']."<br /><br />\n"; 
     
    161166            $user_sig = isset($_POST['user_sig']) ? stripinput(trim($_POST['user_sig'])) : ""; 
    162167        } 
     168        error_reporting(E_ALL); 
    163169        if ($error == "") { 
    164170            if ($settings['email_verification'] == "1") { 
     
    193199            } else { 
    194200                $activation = $settings['admin_activation'] == "1" ? "2" : "0"; 
    195                 $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_theme, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status) VALUES('$username', md5(md5('".$password1."')), '".$email."', '$user_hide_email', '$user_location', '$user_birthdate', '$user_aim', '$user_icq', '$user_msn', '$user_yahoo', '$user_web', '$user_theme', '$user_offset', '', '$user_sig', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$activation')"); 
     201                $result = dbquery("INSERT INTO ".$db_prefix."users (user_name, user_password, user_email, user_hide_email, user_location, user_birthdate, user_aim, user_icq, user_msn, user_yahoo, user_web, user_theme, user_locale, user_offset, user_avatar, user_sig, user_posts, user_joined, user_lastvisit, user_ip, user_rights, user_groups, user_level, user_status) VALUES('$username', md5(md5('".$password1."')), '".$email."', '$user_hide_email', '$user_location', '$user_birthdate', '$user_aim', '$user_icq', '$user_msn', '$user_yahoo', '$user_web', '$user_theme', '".$settings['locale']."', '$user_offset', '', '$user_sig', '0', '".time()."', '0', '".USER_IP."', '', '', '101', '$activation')"); 
    196202                if ($settings['admin_activation'] == "1") { 
    197203                    $variables['message'] = $locale['453']; 
     204                    // send the webmaster a PM that an account needs to be activated 
     205                    $result = dbquery("INSERT INTO ".$db_prefix."pm (pm_subject, pm_message, pm_recipients, pm_size, pm_datestamp) VALUES ('".$locale['509']."', '".mysql_escape_string(sprintf($locale['510'], $username))."', '1', '100', '".time()."')"); 
     206                    if ($result) { 
     207                        $pm_id = mysql_insert_id(); 
     208                        $result = dbquery("INSERT INTO ".$db_prefix."pm_index (pm_id, pmindex_user_id, pmindex_from_id, pmindex_to_id, pmindex_folder) VALUES ('".$pm_id."', '1', '1', '1', '0')"); 
     209                    } 
    198210                } else { 
    199211                    $variables['message'] = $locale['452']; 
Note: See TracChangeset for help on using the changeset viewer.