Beispiel #1
0
    function get_email_addr() {

        if (array_key_exists('text', $_REQUEST) and
            array_key_exists('domain', $_REQUEST)) {
            $is_text = true;

            $text   = valid_phone($_REQUEST['text']);
            $domain = $_REQUEST['domain']; 

            $email = valid_email(sprintf("%s@%s", $text, $domain));

            # Save for next time
            $_SESSION['text'] = $text;
            $_SESSION['domain'] = $domain;

        } else if (array_key_exists('email', $_REQUEST)) {
            $is_text = false;
            
            $email = valid_email($_REQUEST['email']);
            
            # Save for next time
            $_SESSION['email'] = $email;

        } else {
            throw new Exception("No destination information provided.");
        }

        return array($email, $is_text);
    }
Beispiel #2
0
 /**
 * Function checkBankValidate	: check the validation of data input
 * Input 					: array of data
 * Output 					: error code. Return 0 if data is valid and return error code
 							 (number >0).
 */
 function checkBankValidate($data)
 {
     if (!required($data['BankName'])) {
         return 13005;
     }
     if (isset($data['Phone']) && strlen($data['Phone']) > 0 && !valid_phone($data['Phone'])) {
         return 13009;
     }
     if (isset($data['Email']) && strlen($data['Email']) > 0 && !valid_email($data['Email'])) {
         return 13008;
     }
     if (isset($data['Fax']) && strlen($data['Fax']) > 0 && !valid_phone($data['Fax'])) {
         return 13010;
     }
     if (isset($data['MaximumLoanMoney']) && strlen($data['MaximumLoanMoney']) > 0 && !numeric($data['MaximumLoanMoney'])) {
         return 13015;
     }
     if (isset($data['MinimumLoanMoney']) && strlen($data['RaMinimumLoanMoneyte']) > 0 && !numeric($data['MinimumLoanMoney'])) {
         return 13016;
     }
     if (isset($data['MaximumPayMoney']) && strlen($data['MaximumPayMoney']) > 0 && !numeric($data['MaximumPayMoney'])) {
         return 13017;
     }
     if (isset($data['MinimumPayMoney']) && strlen($data['MinimumPayMoney']) > 0 && !numeric($data['MinimumPayMoney'])) {
         return 13018;
     }
     if (isset($data['MaximumLoanMoney']) && isset($data['MinimumLoanMoney']) && $data['MaximumLoanMoney'] < $data['MinimumLoanMoney']) {
         return 13012;
     }
     if (isset($data['MaximumPayMoney']) && isset($data['MinimumPayMoney']) && $data['MaximumPayMoney'] < $data['MinimumPayMoney']) {
         return 13013;
     }
     if (isset($data['CreatedBy']) && !required($data['CreatedBy'])) {
         return 13006;
     }
     if (isset($data['UpdatedBy']) && !required($data['UpdatedBy'])) {
         return 13007;
     }
     return 0;
 }
Beispiel #3
0
<?php

include "../controller/headers.php";
$conn = db_connect(_DB_SERVER_, _DB_USER_, _DB_PASSWD_, _DB_NAME_);
if (isset($_SESSION['id_customer']) && isset($_POST["mail"]) && valid_mail($_POST["mail"]) && isset($_POST["phone"]) && valid_phone($_POST["phone"]) && isset($_POST["address"]) && valid_address($_POST["address"]) && isset($_POST["delivery_address"]) && valid_address($_POST["delivery_address"]) && isset($_POST["shipping_address"]) && valid_address($_POST["shipping_address"]) && isset($_POST["postal"]) && valid_postal($_POST["postal"]) && isset($_POST["city"]) && valid_name($_POST["city"]) && isset($_POST["shipping_postal"]) && valid_postal($_POST["shipping_postal"]) && isset($_POST["shipping_city"]) && valid_name($_POST["shipping_city"]) && isset($_POST["delivery_postal"]) && valid_postal($_POST["delivery_postal"]) && isset($_POST["delivery_city"]) && valid_name($_POST["delivery_city"])) {
    $stmt = $conn->prepare("UPDATE gc_customers SET mail=:r_mail, phone=:r_phone, address=:r_address, \n\t\tdelivery_address=:r_delivery_address, shipping_address=:r_shipping_address, postal_code=:r_postal_code, city=:r_city, \n\t\tdelivery_postal_code=:r_delivery_postal_code, delivery_city=:r_delivery_city, \n\t\tshipping_postal_code=:r_shipping_postal_code, shipping_city=:r_shipping_city WHERE id_customer=:r_customer");
    $stmt->execute(array('r_mail' => $_POST['mail'], 'r_phone' => $_POST['phone'], 'r_address' => $_POST['address'], 'r_delivery_address' => $_POST['delivery_address'], 'r_shipping_address' => $_POST['shipping_address'], 'r_postal_code' => $_POST['postal'], 'r_city' => $_POST['city'], 'r_delivery_postal_code' => $_POST['delivery_postal'], 'r_delivery_city' => $_POST['delivery_city'], 'r_shipping_postal_code' => $_POST['shipping_postal'], 'r_shipping_city' => $_POST['shipping_city'], 'r_customer' => $_SESSION['id_customer']));
    $stmt->closeCursor();
}
if (isset($_SESSION['id_customer']) && isset($_POST["firstname"]) && isset($_POST["lastname"]) && isset($_POST["card_type"]) && isset($_POST["card_number"]) && isset($_POST["cryptogram"]) && isset($_POST["expiring_date"])) {
    $stmt = $conn->prepare("UPDATE gc_cards SET firstname_customer=:r_firstname_card, lastname_customer=:r_lastname_card, \n\t\tcard_type=:r_card_type, card_number=:r_card_number, cryptogram=:r_cryptogram, expiring_date=:r_expiring_date\n\t\tWHERE id_customer=:r_customer");
    $stmt->execute(array('r_firstname_card' => ucfirst(strtolower($_POST['firstname'])), 'r_lastname_card' => ucfirst(strtolower($_POST['lastname'])), 'r_card_type' => $_POST['card_type'], 'r_card_number' => $_POST['card_number'], 'r_cryptogram' => $_POST['cryptogram'], 'r_expiring_date' => $_POST['expiring_date'], 'r_customer' => $_SESSION['id_customer']));
    $stmt->closeCursor();
}
header('Location: ../view/account.php');
Beispiel #4
0
 /**
  * 导入用户
  *
  */
 public function import_user()
 {
     if (!empty($_FILES) && isset($_FILES['userfile']) && $_FILES['userfile']['error'] == 0) {
         $config = array();
         $config = array('upload_path' => realpath(dirname(SELF)) . '/resources/', 'allowed_types' => array('xls', 'xlsx'), 'max_size' => '2048', 'file_name' => 'user_' . time());
         $this->load->library('upload', $config);
         if (!$this->upload->do_upload()) {
             $this->to_api_message(0, $this->upload->display_errors());
         } else {
             $upload_data = $this->upload->data();
             //文件的一些信息
             $excel_path = $upload_data['full_path'];
             @chmod($excel_path, 0644);
             require_once APPPATH . '/libraries/PHPExcel.php';
             require_once APPPATH . '/libraries/PHPExcel/IOFactory.php';
             $objReader = IOFactory::createReader('Excel5');
             $objPHPExcel = $objReader->load($excel_path);
             $sheet = $objPHPExcel->getSheet(0);
             // 读取第一工作表
             $highestRow = $sheet->getHighestRow();
             // 取得总行数
             $highestColumm = $sheet->getHighestColumn();
             // 取得总列数
             $this->load->model('webModel/User_group', 'user_group');
             $this->load->model('webModel/Setting_model', 'setting');
             $setting = $this->setting->get();
             $identity_name = '';
             if ($setting['service_type'] == 1) {
                 $app_info = array();
                 $app_info = array('app_id' => $setting['app_id'], 'app_key' => $setting['app_key'], 'use_private' => FALSE);
                 $this->load->library('Secken', $app_info);
             }
             $error = array();
             $success_row = $error_row = 0;
             for ($row = 1; $row <= $highestRow; $row++) {
                 //行数是以第1行开始
                 if ($row == 1) {
                     continue;
                 }
                 $user_name = $sheet->getCell('A' . $row)->getValue();
                 $true_name = $sheet->getCell('B' . $row)->getValue();
                 $phone = $sheet->getCell('C' . $row)->getValue();
                 if (is_null($user_name) && is_null($true_name) && is_null($phone)) {
                     continue;
                 }
                 if (is_null($user_name)) {
                     $error_row++;
                     $error[] = array('row' => $row, 'user_name' => $user_name, 'true_name' => $true_name, 'phone' => $phone, 'error' => $this->lang->line('username_not_allow_empty'));
                     continue;
                 }
                 //检查用户名
                 $check = $this->user->check_user_name($user_name);
                 if ($check) {
                     $error_row++;
                     $error[] = array('row' => $row, 'user_name' => $user_name, 'true_name' => $true_name, 'phone' => $phone, 'error' => $this->lang->line('username_is_exists'));
                     continue;
                 }
                 if (is_null($true_name)) {
                     $error_row++;
                     $error[] = array('row' => $row, 'user_name' => $user_name, 'true_name' => $true_name, 'phone' => $phone, 'error' => $this->lang->line('truename_not_allow_empty'));
                     continue;
                 }
                 //检查手机号
                 $this->load->helper('phone');
                 $valid_phone = valid_phone($phone);
                 if ($valid_phone === FALSE) {
                     $error_row++;
                     $error[] = array('row' => $row, 'user_name' => $user_name, 'true_name' => $true_name, 'phone' => $phone, 'error' => $this->lang->line('phone_invalid'));
                     continue;
                 }
                 $check = $this->user->check_phone($phone);
                 if ($check) {
                     $error_row++;
                     $error[] = array('row' => $row, 'user_name' => $user_name, 'true_name' => $true_name, 'phone' => $phone, 'error' => $this->lang->line('phone_is_exists'));
                     continue;
                 }
                 if ($this->secken) {
                     settype($phone, "string");
                     $result = $this->secken->exchangeUid($phone);
                     $respone_code = $this->secken->getCode();
                     $identity_name = '';
                     if ($respone_code == 200) {
                         $identity_name = $result['uids'][0];
                         if (empty($identity_name)) {
                             $error_row++;
                             $error[] = array('row' => $row, 'user_name' => $user_name, 'true_name' => $true_name, 'phone' => $phone, 'error' => $this->lang->line('please_login_on_yangcong'));
                             continue;
                         }
                     } else {
                         $error_row++;
                         $error[] = array('row' => $row, 'user_name' => $user_name, 'true_name' => $true_name, 'phone' => $phone, 'error' => $this->lang->line('secken_config_error'));
                         break;
                     }
                 } else {
                     $error_row++;
                     $error[] = array('row' => $row, 'user_name' => $user_name, 'true_name' => $true_name, 'phone' => $phone, 'error' => $this->lang->line('secken_config_error'));
                     break;
                 }
                 $insertData = array();
                 $insertData = array('user_name' => $user_name, 'phone' => $phone, 'true_name' => $true_name, 'yangcong_uid' => $identity_name, 'create_time' => date('Y-m-d H:i:s'), 'update_time' => date('Y-m-d H:i:s'));
                 $op_description = sprintf("导入了新用户:%s", $user_name);
                 $insert_id = $this->user->insert($insertData);
                 if ($insert_id) {
                     $insertData = array();
                     $insertData = array('user_id' => $insert_id, 'gid' => 1);
                     $insert_id = $this->user_group->insert($insertData);
                     if ($insert_id) {
                         $success_row++;
                         $this->add_op_log($op_description, 1);
                     } else {
                         $error_row++;
                         $this->add_op_log($op_description, 0);
                     }
                 } else {
                     $error_row++;
                     $this->add_op_log($op_description, 0);
                 }
             }
             $data = array();
             $data = array('success_row' => $success_row, 'error_row' => $error_row, 'error' => $error);
             $this->to_api_message(1, 'import_user', $data);
         }
     }
 }
Beispiel #5
0
<?php

include "../controller/headers.php";
$conn = db_connect(_DB_SERVER_, _DB_USER_, _DB_PASSWD_, _DB_NAME_);
if (is_Not_Null($_POST["lastname"]) && valid_name($_POST["lastname"]) && is_Not_Null($_POST["firstname"]) && valid_name($_POST["firstname"]) && is_Not_Null($_POST["birthday"]) && valid_birthday($_POST["birthday"]) && is_Not_Null($_POST["phone"]) && valid_phone($_POST["phone"]) && is_Not_Null($_POST["address"]) && valid_address($_POST["address"]) && is_Not_Null($_POST["postal"]) && valid_postal($_POST["postal"]) && is_Not_Null($_POST["city"]) && valid_name($_POST["city"]) && is_Not_Null($_POST["email"]) && valid_mail($_POST["email"]) && is_Not_Null($_POST["pwd"]) && is_Not_Null($_POST["pwd2"]) && valid_pwd($_POST["pwd"], $_POST["pwd2"])) {
    $stmt3 = $conn->prepare("SELECT mail FROM gc_customers WHERE mail = :r_mail");
    $stmt3->execute(array('r_mail' => $_POST['email']));
    if ($stmt3->fetch() == false) {
        $stmt = $conn->prepare("INSERT INTO gc_customers (firstname_customer, lastname_customer, birthday, mail, \n\t\t\tphone, pwd, address ,delivery_address, shipping_address, postal_code, city, delivery_postal_code, delivery_city, shipping_postal_code, \n\t\t\tshipping_city) VALUES(:r_firstname, :r_lastname, :r_birthday, :r_mail, :r_phone, :r_pwd, :r_address, :r_address, :r_address, :r_postal, \n\t\t\t:r_city, :r_postal, :r_city, :r_postal, :r_city)");
        $stmt->execute(array('r_lastname' => ucfirst(strtolower($_POST["lastname"])), 'r_firstname' => ucfirst(strtolower($_POST["firstname"])), 'r_birthday' => $_POST["birthday"], 'r_phone' => $_POST["phone"], 'r_address' => $_POST["address"], 'r_postal' => $_POST["postal"], 'r_city' => $_POST["city"], 'r_mail' => $_POST['email'], 'r_pwd' => md5($_POST['pwd'])));
        $stmt->closeCursor();
        $stmt = $conn->prepare("SELECT id_customer, firstname_customer FROM gc_customers WHERE mail = :r_mail");
        $stmt->execute(array('r_mail' => $_POST['email']));
        $res = $stmt->fetch();
        $stmt2 = $conn->prepare("INSERT INTO gc_cards (firstname_customer, lastname_customer, card_type, id_customer) \n\t\t\t\t\tVALUES('','','',:r_customer)");
        $stmt2->execute(array('r_customer' => $res['id_customer']));
        $_SESSION['id_customer'] = $res['id_customer'];
        $_SESSION['firstname_customer'] = $res['firstname_customer'];
        header('Location: ../view/index.php');
        $stmt2->closeCursor();
        $stmt->closeCursor();
    } else {
        echo '<script>alert("' . utf8_decode("Ce compte existe déja!") . '")</script>';
        header('Refresh: 0; URL=../view/login.php');
    }
} else {
    header('Location: ../view/login.php');
}