Exemplo n.º 1
0
/**
 * 产生验证码
 *
 * @param string $nchash 哈希数
 * @return string
 */
function uk86_makeSeccode($nchash)
{
    $seccode = uk86_random(6, 1);
    $seccodeunits = '';
    $s = sprintf('%04s', base_convert($seccode, 10, 23));
    $seccodeunits = 'ABCEFGHJKMPRTVXY2346789';
    if ($seccodeunits) {
        $seccode = '';
        for ($i = 0; $i < 4; $i++) {
            $unit = ord($s[$i]);
            $seccode .= $unit >= 0x30 && $unit <= 0x39 ? $seccodeunits[$unit - 0x30] : $seccodeunits[$unit - 0x57];
        }
    }
    uk86_setNcCookie('seccode' . $nchash, uk86_encrypt(strtoupper($seccode) . "\t" . time() . "\t" . $nchash, MD5_KEY), 3600);
    return $seccode;
}
Exemplo n.º 2
0
 /**
  * 绑定邮箱 - 发送邮件
  */
 public function send_bind_emailOp()
 {
     $obj_validate = new Uk86Validate();
     $obj_validate->validateparam = array(array("input" => $_POST["email"], "require" => "true", 'validator' => 'email', "message" => '请正确填写邮箱'));
     $error = $obj_validate->uk86_validate();
     if ($error != '') {
         uk86_showValidateError($error);
     }
     $model_member = Model('member');
     $condition = array();
     $condition['member_email'] = $_POST['email'];
     $condition['member_id'] = array('neq', $_SESSION['member_id']);
     $member_info = $model_member->getMemberInfo($condition, 'member_id');
     if ($member_info) {
         showDialog('该邮箱已被使用');
     }
     $data = array();
     $data['member_email'] = $_POST['email'];
     $data['member_email_bind'] = 0;
     $update = $model_member->editMember(array('member_id' => $_SESSION['member_id']), $data);
     if (!$update) {
         showDialog('系统发生错误,如有疑问请与管理员联系');
     }
     $seed = uk86_random(6);
     $data = array();
     $data['auth_code'] = $seed;
     $data['send_acode_time'] = TIMESTAMP;
     $update = $model_member->editMemberCommon($data, array('member_id' => $_SESSION['member_id']));
     if (!$update) {
         showDialog('系统发生错误,如有疑问请与管理员联系');
     }
     $uid = base64_encode(uk86_encrypt($_SESSION['member_id'] . ' ' . $_POST["email"]));
     $verify_url = SHOP_SITE_URL . '/index.php?act=login&op=bind_email&uid=' . $uid . '&hash=' . md5($seed);
     $model_tpl = Model('mail_templates');
     $tpl_info = $model_tpl->getTplInfo(array('code' => 'bind_email'));
     $param = array();
     $param['site_name'] = C('site_name');
     $param['user_name'] = $_SESSION['member_name'];
     $param['verify_url'] = $verify_url;
     $subject = uk86_ncReplaceText($tpl_info['title'], $param);
     $message = uk86_ncReplaceText($tpl_info['content'], $param);
     $email = new Uk86Email();
     $result = $email->uk86_send_sys_email($_POST["email"], $subject, $message);
     showDialog('验证邮件已经发送至您的邮箱,请于24小时内登录邮箱并完成验证!', 'index.php?act=member_security&op=index', 'succ', '', 5);
 }
Exemplo n.º 3
0
 /**
  * 从第三方取快递信息
  */
 public function ajax_get_expressOp()
 {
     $url = 'http://www.kuaidi100.com/query?type=' . $_GET['e_code'] . '&postid=' . $_GET['shipping_code'] . '&id=1&valicode=&temp=' . uk86_random(4) . '&sessionid=&tmp=' . uk86_random(4);
     uk86_import('function.ftp');
     $content = uk86_dfsockopen($url);
     $content = json_decode($content, true);
     if ($content['status'] != 200) {
         exit(json_encode(false));
     }
     $content['data'] = array_reverse($content['data']);
     $output = array();
     if (is_array($content['data'])) {
         foreach ($content['data'] as $k => $v) {
             if ($v['time'] == '') {
                 continue;
             }
             $output[] = $v['time'] . '&nbsp;&nbsp;' . $v['context'];
         }
     }
     if (empty($output)) {
         exit(json_encode(false));
     }
     echo json_encode($output);
 }
Exemplo n.º 4
0
 /**
  * 找回密码的发邮件处理
  */
 public function find_passwordOp()
 {
     Uk86Language::uk86_read('home_login_register');
     $lang = Uk86Language::uk86_getLangContent();
     $result = uk86_chksubmit(true, true, 'num');
     if ($result !== false) {
         if ($result === -11) {
             showDialog('非法提交');
         } elseif ($result === -12) {
             showDialog('验证码错误');
         }
     }
     if (empty($_POST['email'])) {
         showDialog($lang['login_password_input_email']);
     }
     if (Uk86process::uk86_islock('forget')) {
         showDialog($lang['nc_common_op_repeat'], 'reload');
     }
     $member_model = Model('member');
     $member = $member_model->getMemberInfo(array('member_email' => $_POST['email']));
     if (empty($member) or !is_array($member)) {
         Uk86process::uk86_addprocess('forget');
         showDialog($lang['login_password_email_not_exists'], 'reload');
     }
     // 		if(empty($_POST['email'])){
     // 			showDialog($lang['login_password_input_email'],'reload');
     // 		}
     // 		if(strtoupper($_POST['email'])!=strtoupper($member['member_email'])){
     // 		    Uk86process::uk86_addprocess('forget');
     // 			showDialog($lang['login_password_email_not_exists'],'reload');
     // 		}
     Uk86process::uk86_clear('forget');
     //产生密码
     // 	$new_password	= uk86_random(15);
     // if(!($member_model->editMember(array('member_id'=>$member['member_id']),array('member_passwd'=>md5($new_password))))){
     // 	showDialog($lang['login_password_email_fail'],'reload');
     // }
     $temp = uk86_random(14);
     $_SESSION['temp_identifying_code'] = $temp;
     $_SESSION['temp_identifying_time'] = time();
     //	当然这种机制是有缺陷的,可以扩展uuid等构建缓存等。
     $_SESSION['temp_user_id'] = $member['member_id'];
     $model_tpl = Model('mail_templates');
     $tpl_info = $model_tpl->getTplInfo(array('code' => 'reset_pwd'));
     $param = array();
     $param['site_name'] = C('site_name');
     $param['user_name'] = $member['member_name'];
     $param['site_url'] = SHOP_SITE_URL . '/index.php?act=login&op=forget_password_identify&identity_code=' . $temp;
     $subject = uk86_ncReplaceText($tpl_info['title'], $param);
     $message = uk86_ncReplaceText($tpl_info['content'], $param);
     $email = new Uk86Email();
     $result = $email->uk86_send_sys_email($_POST["email"], $subject, $message);
     showDialog('修改密码链接已经发送至您的邮箱,请在三十分钟内尽快更改密码!', '', 'succ', '', 5);
 }
		alignY: 'bottom',
		offsetX: 5,
		offsetY: 0,
		allowTipHover: false
	});
      var_send = '<?php 
echo date("Y-m-d H:i:s", $output['order_info']['extend_order_common']['shipping_time']);
?>
&nbsp;&nbsp;<?php 
echo $lang['member_show_seller_has_send'];
?>
<br/>';
	$.getJSON('index.php?act=member_order&op=get_express&e_code=<?php 
echo $output['e_code'];
?>
&shipping_code=<?php 
echo $output['order_info']['shipping_code'];
?>
&t=<?php 
echo uk86_random(7);
?>
',function(data){
		if(data){
			data = var_send+data.join('<br/>');
			$('#express_list').html(data).next().css('display','');
		}else{
			$('#express_list').html(var_send);
		}
	});
});
</script>
Exemplo n.º 6
0
 /**
  * 从第三方取快递信息
  *
  */
 public function get_expressOp()
 {
     $url = 'http://www.kuaidi100.com/query?type=' . $_GET['e_code'] . '&postid=' . $_GET['shipping_code'] . '&id=1&valicode=&temp=' . uk86_random(4) . '&sessionid=&tmp=' . uk86_random(4);
     uk86_import('function.ftp');
     $content = uk86_dfsockopen($url);
     $content = json_decode($content, true);
     if ($content['status'] != 200) {
         exit(json_encode(false));
     }
     $content['data'] = array_reverse($content['data']);
     $output = '';
     if (is_array($content['data'])) {
         foreach ($content['data'] as $k => $v) {
             if ($v['time'] == '') {
                 continue;
             }
             $output .= '<li>' . $v['time'] . '&nbsp;&nbsp;' . $v['context'] . '</li>';
         }
     }
     if ($output == '') {
         exit(json_encode(false));
     }
     if (strtoupper(CHARSET) == 'GBK') {
         $output = Uk86Language::uk86_getUTF8($output);
         //网站GBK使用编码时,转换为UTF-8,防止json输出汉字问题
     }
     echo json_encode($output);
 }
Exemplo n.º 7
0
 /**
  * 生成兑换码
  * 长度 =3位 + 4位 + 2位 + 3位  + 1位 + 5位随机  = 18位
  * @param string $perfix 前缀
  * @param int $store_id
  * @param int $member_id
  * @param unknown $num
  * @return multitype:string
  */
 private function _makeVrCode($perfix, $store_id, $member_id, $num)
 {
     $perfix .= sprintf('%04d', (int) $store_id * $member_id % 10000) . sprintf('%02d', (int) $member_id % 100) . sprintf('%03d', (double) microtime() * 1000);
     $code_list = array();
     for ($i = 0; $i < $num; $i++) {
         $code_list[$i] = $perfix . sprintf('%01d', (int) $i % 10) . uk86_random(5, 1);
     }
     return $code_list;
 }