コード例 #1
0
 if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
     $error = true;
     $messageStack->add('account_edit', OSCOM::getDef('entry_last_name_error', ['min_length' => ENTRY_LAST_NAME_MIN_LENGTH]));
 }
 if (ACCOUNT_DOB == 'true') {
     $dobDateTime = new DateTime($dob);
     if (strlen($dob) < ENTRY_DOB_MIN_LENGTH || $dobDateTime->isValid() === false) {
         $error = true;
         $messageStack->add('account_edit', OSCOM::getDef('entry_date_of_birth_error'));
     }
 }
 if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
     $error = true;
     $messageStack->add('account_edit', OSCOM::getDef('entry_email_address_error', ['min_length' => ENTRY_EMAIL_ADDRESS_MIN_LENGTH]));
 }
 if (!Is::email($email_address)) {
     $error = true;
     $messageStack->add('account_edit', OSCOM::getDef('entry_email_address_check_error'));
 }
 $Qcheck = $OSCOM_Db->prepare('select customers_id from :table_customers where customers_email_address = :customers_email_address and customers_id != :customers_id limit 1');
 $Qcheck->bindValue(':customers_email_address', $email_address);
 $Qcheck->bindInt(':customers_id', $_SESSION['customer_id']);
 $Qcheck->execute();
 if ($Qcheck->fetch() !== false) {
     $error = true;
     $messageStack->add('account_edit', OSCOM::getDef('entry_email_address_error_exists'));
 }
 if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
     $error = true;
     $messageStack->add('account_edit', OSCOM::getDef('entry_telephone_number_error', ['min_length' => ENTRY_TELEPHONE_MIN_LENGTH]));
 }
コード例 #2
0
ファイル: HTTP.php プロジェクト: haraldpdl/oscommerce2
 public static function getIpAddress($to_int = false)
 {
     $ips = [];
     if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         foreach (array_reverse(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])) as $x_ip) {
             $ips[] = trim($x_ip);
         }
     }
     if (isset($_SERVER['HTTP_CLIENT_IP'])) {
         $ips[] = trim($_SERVER['HTTP_CLIENT_IP']);
     }
     if (isset($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) {
         $ips[] = trim($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']);
     }
     if (isset($_SERVER['HTTP_PROXY_USER'])) {
         $ips[] = trim($_SERVER['HTTP_PROXY_USER']);
     }
     if (isset($_SERVER['REMOTE_ADDR'])) {
         $ips[] = trim($_SERVER['REMOTE_ADDR']);
     }
     $ip = '0.0.0.0';
     foreach ($ips as $req_ip) {
         if (Is::ip_address($req_ip)) {
             $ip = $req_ip;
             break;
         }
     }
     if ($to_int === true) {
         $ip = sprintf('%u', ip2long($ip));
     }
     return $ip;
 }
コード例 #3
0
 */
use OSC\OM\Hash;
use OSC\OM\HTML;
use OSC\OM\Is;
use OSC\OM\OSCOM;
require 'includes/application_top.php';
$OSCOM_Language->loadDefinitions('password_reset');
$error = false;
if (!isset($_GET['account']) || !isset($_GET['key'])) {
    $error = true;
    $messageStack->add_session('password_forgotten', OSCOM::getDef('text_no_reset_link_found'));
}
if ($error == false) {
    $email_address = HTML::sanitize($_GET['account']);
    $password_key = HTML::sanitize($_GET['key']);
    if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH || Is::email($email_address) == false) {
        $error = true;
        $messageStack->add_session('password_forgotten', OSCOM::getDef('text_no_email_address_found'));
    } elseif (strlen($password_key) != 40) {
        $error = true;
        $messageStack->add_session('password_forgotten', OSCOM::getDef('text_no_reset_link_found'));
    } else {
        $Qcheck = $OSCOM_Db->prepare('select c.customers_id, c.customers_email_address, ci.password_reset_key, ci.password_reset_date from :table_customers c, :table_customers_info ci where c.customers_email_address = :customers_email_address and c.customers_id = ci.customers_info_id');
        $Qcheck->bindValue(':customers_email_address', $email_address);
        $Qcheck->execute();
        if ($Qcheck->fetch() !== false) {
            if (empty($Qcheck->value('password_reset_key')) || $Qcheck->value('password_reset_key') != $password_key || strtotime($Qcheck->value('password_reset_date') . ' +1 day') <= time()) {
                $error = true;
                $messageStack->add_session('password_forgotten', OSCOM::getDef('text_no_reset_link_found'));
            }
        } else {
コード例 #4
0
 $from_email_address = HTML::sanitize($_POST['from_email_address']);
 $from_name = HTML::sanitize($_POST['from_name']);
 $message = HTML::sanitize($_POST['message']);
 if (empty($from_name)) {
     $error = true;
     $messageStack->add('friend', OSCOM::getDef('error_from_name'));
 }
 if (!Is::email($from_email_address)) {
     $error = true;
     $messageStack->add('friend', OSCOM::getDef('error_from_address'));
 }
 if (empty($to_name)) {
     $error = true;
     $messageStack->add('friend', OSCOM::getDef('error_to_name'));
 }
 if (!Is::email($to_email_address)) {
     $error = true;
     $messageStack->add('friend', OSCOM::getDef('error_to_address'));
 }
 $actionRecorder = new actionRecorder('ar_tell_a_friend', isset($_SESSION['customer_id']) ? $_SESSION['customer_id'] : null, $from_name);
 if (!$actionRecorder->canPerform()) {
     $error = true;
     $actionRecorder->record(false);
     $messageStack->add('friend', OSCOM::getDef('error_action_recorder', ['module_action_recorder_tell_a_friend_email_minutes' => defined('MODULE_ACTION_RECORDER_TELL_A_FRIEND_EMAIL_MINUTES') ? (int) MODULE_ACTION_RECORDER_TELL_A_FRIEND_EMAIL_MINUTES : 15]));
 }
 if ($error == false) {
     $email_subject = OSCOM::getDef('text_email_subject', ['from_name' => $from_name, 'store_name' => STORE_NAME]);
     $email_body = OSCOM::getDef('text_email_intro', ['to_name' => $to_name, 'from_name' => $from_name, 'products_name' => $Qproduct->value('products_name'), 'store_name' => STORE_NAME]) . "\n\n";
     if (tep_not_null($message)) {
         $email_body .= $message . "\n\n";
     }
コード例 #5
0
 }
 if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
     $error = true;
     $messageStack->add('create_account', OSCOM::getDef('entry_last_name_error', ['min_length' => ENTRY_LAST_NAME_MIN_LENGTH]));
 }
 if (ACCOUNT_DOB == 'true') {
     $dobDateTime = new DateTime($dob);
     if (strlen($dob) < ENTRY_DOB_MIN_LENGTH || $dobDateTime->isValid() === false) {
         $error = true;
         $messageStack->add('create_account', OSCOM::getDef('entry_date_of_birth_error'));
     }
 }
 if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
     $error = true;
     $messageStack->add('create_account', OSCOM::getDef('entry_email_address_error', ['min_length' => ENTRY_EMAIL_ADDRESS_MIN_LENGTH]));
 } elseif (Is::email($email_address) == false) {
     $error = true;
     $messageStack->add('create_account', OSCOM::getDef('entry_email_address_check_error'));
 } else {
     $Qcheck = $OSCOM_Db->prepare('select customers_id from :table_customers where customers_email_address = :customers_email_address limit 1');
     $Qcheck->bindValue(':customers_email_address', $email_address);
     $Qcheck->execute();
     if ($Qcheck->fetch() !== false) {
         $error = true;
         $messageStack->add('create_account', OSCOM::getDef('entry_email_address_error_exists'));
     }
 }
 if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
     $error = true;
     $messageStack->add('create_account', OSCOM::getDef('entry_street_address_error', ['min_length' => ENTRY_STREET_ADDRESS_MIN_LENGTH]));
 }
コード例 #6
0
ファイル: customers.php プロジェクト: haraldpdl/oscommerce2
     $error = true;
     $entry_lastname_error = true;
 } else {
     $entry_lastname_error = false;
 }
 if (ACCOUNT_DOB == 'true') {
     $dobDateTime = new DateTime($customers_dob);
     if (strlen($customers_dob) >= ENTRY_DOB_MIN_LENGTH && $dobDateTime->isValid()) {
         $entry_date_of_birth_error = false;
     } else {
         $error = true;
         $entry_date_of_birth_error = true;
     }
 }
 $entry_email_address_error = false;
 if (!Is::email($customers_email_address)) {
     $error = true;
     $entry_email_address_check_error = true;
 } else {
     $entry_email_address_check_error = false;
 }
 if (strlen($entry_street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
     $error = true;
     $entry_street_address_error = true;
 } else {
     $entry_street_address_error = false;
 }
 if (strlen($entry_postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
     $error = true;
     $entry_post_code_error = true;
 } else {