📄 create_account.php
字号:
<?php
/**
* create_account header_php.php
*
* @package page
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: create_account.php 3777 2006-06-15 07:03:03Z drbyte $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
/**
* Set some defaults
*/
if (ACCOUNT_STATE == 'true' && ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN == 'true') {
$zone_id = 0;
$check_query = "select count(*) as total
from " . TABLE_ZONES . "
where zone_country_id = '" . (int)SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY . "'";
$check = $db->Execute($check_query);
$entry_state_has_zones = ($check->fields['total'] > 0);
if ($entry_state_has_zones == true) {
$zones_array = array();
$zones_array[] = array('id' => PULL_DOWN_ALL, 'text' => PULL_DOWN_ALL);
$zones_values = $db->Execute("select zone_name
from " . TABLE_ZONES . "
where zone_country_id = '" . (int)SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY . "'
order by zone_name");
while (!$zones_values->EOF) {
$zones_array[] = array('id' => $zones_values->fields['zone_name'], 'text' => $zones_values->fields['zone_name']);
$zones_values->MoveNext();
}
}
}
$process = false;
/**
* Process form contents
*/
if (isset($_POST['action']) && ($_POST['action'] == 'process')) {
$process = true;
if (ACCOUNT_GENDER == 'true') {
if (isset($_POST['gender'])) {
$gender = zen_db_prepare_input($_POST['gender']);
} else {
$gender = false;
}
}
if (isset($_POST['email_format'])) {
$email_format = zen_db_prepare_input($_POST['email_format']);
} else {
$email_format = false;
}
$firstname = zen_db_prepare_input($_POST['firstname']);
$lastname = zen_db_prepare_input($_POST['lastname']);
$nick = zen_db_prepare_input($_POST['nick']);
// if (ACCOUNT_DOB == 'true') $dob = zen_db_prepare_input($_POST['dob']);
if (ACCOUNT_DOB == 'true') $dob = (empty($_POST['dob']) ? zen_db_prepare_input('0001-01-01 00:00:00') : zen_db_prepare_input($_POST['dob']));
$email_address = zen_db_prepare_input($_POST['email_address']);
if (ACCOUNT_COMPANY == 'true') $company = zen_db_prepare_input($_POST['company']);
$street_address = zen_db_prepare_input($_POST['street_address']);
if (ACCOUNT_SUBURB == 'true') $suburb = zen_db_prepare_input($_POST['suburb']);
$postcode = zen_db_prepare_input($_POST['postcode']);
$city = zen_db_prepare_input($_POST['city']);
if (ACCOUNT_STATE == 'true') {
$state = zen_db_prepare_input($_POST['state']);
if (isset($_POST['zone_id'])) {
$zone_id = zen_db_prepare_input($_POST['zone_id']);
} else {
$zone_id = false;
}
}
$country = zen_db_prepare_input($_POST['country']);
$telephone = zen_db_prepare_input($_POST['telephone']);
$fax = zen_db_prepare_input($_POST['fax']);
$email_format = zen_db_prepare_input($_POST['email_format']);
$customers_authorization = CUSTOMERS_APPROVAL_AUTHORIZATION;
$customers_referral = zen_db_prepare_input($_POST['customers_referral']);
if (isset($_POST['newsletter'])) {
$newsletter = zen_db_prepare_input($_POST['newsletter']);
} else {
$newsletter = false;
}
$password = zen_db_prepare_input($_POST['password']);
$confirmation = zen_db_prepare_input($_POST['confirmation']);
$error = false;
if (DISPLAY_PRIVACY_CONDITIONS == 'true') {
if (!isset($_POST['privacy_conditions']) || ($_POST['privacy_conditions'] != '1')) {
$error = true;
$messageStack->add('create_account', ERROR_PRIVACY_STATEMENT_NOT_ACCEPTED, 'error');
}
}
if (ACCOUNT_GENDER == 'true') {
if ( ($gender != 'm') && ($gender != 'f') ) {
$error = true;
$messageStack->add('create_account', ENTRY_GENDER_ERROR);
}
}
if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR);
}
if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_LAST_NAME_ERROR);
}
if (ACCOUNT_DOB == 'true') {
if (ENTRY_DOB_MIN_LENGTH > 0 or !empty($_POST['dob'])) {
if (substr_count($dob,'/') > 2 || checkdate(substr(zen_date_raw($dob), 4, 2), substr(zen_date_raw($dob), 6, 2), substr(zen_date_raw($dob), 0, 4)) == false) {
$error = true;
$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
}
}
}
if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);
} elseif (zen_validate_email($email_address) == false) {
$error = true;
$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
} else {
$check_email_query = "select count(*) as total
from " . TABLE_CUSTOMERS . "
where customers_email_address = '" . zen_db_input($email_address) . "'";
$check_email = $db->Execute($check_email_query);
if ($check_email->fields['total'] > 0) {
$error = true;
$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
}
}
if ($phpBB->phpBB['installed'] == true) {
if (strlen($nick) < ENTRY_NICK_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_NICK_LENGTH_ERROR);
} else {
// check Zen Cart for duplicate nickname
$check_nick_query = "select * from " . TABLE_CUSTOMERS . "
where customers_nick = '" . $nick . "'";
$check_nick = $db->Execute($check_nick_query);
if ($check_nick->RecordCount() > 0 ) {
$error = true;
$messageStack->add('create_account', ENTRY_NICK_DUPLICATE_ERROR);
}
// check phpBB for duplicate nickname
if ($phpBB->phpbb_check_for_duplicate_nick($nick) == 'already_exists' ) {
$error = true;
$messageStack->add('create_account', ENTRY_NICK_DUPLICATE_ERROR . '(phpBB)');
}
}
}
if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);
}
if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
}
if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_CITY_ERROR);
}
if (is_numeric($country) == false) {
$error = true;
$messageStack->add('create_account', ENTRY_COUNTRY_ERROR);
}
if (ACCOUNT_STATE == 'true') {
$zone_id = 0;
$check_query = "select count(*) as total
from " . TABLE_ZONES . "
where zone_country_id = '" . (int)$country . "'";
$check = $db->Execute($check_query);
$entry_state_has_zones = ($check->fields['total'] > 0);
if ($entry_state_has_zones == true) {
$zones_array = array();
$zones_array[] = array('id' => PULL_DOWN_ALL, 'text' => PULL_DOWN_ALL);
$zones_values = $db->Execute("select zone_name
from " . TABLE_ZONES . "
where zone_country_id = '" . (int)$country . "'
order by zone_name");
while (!$zones_values->EOF) {
$zones_array[] = array('id' => $zones_values->fields['zone_name'], 'text' => $zones_values->fields['zone_name']);
$zones_values->MoveNext();
}
$zone_query = "select distinct zone_id, zone_name
from " . TABLE_ZONES . "
where zone_country_id = '" . (int)$country . "'
and zone_code = '" . strtoupper(zen_db_input($state)) . "'";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -