📄 membercontroller.php
字号:
exit($this->_View->render('member/index'));
}
}
/*
修改登陆密码
*/
public function modifypassAction(){
if ($this->_Request->isPost()){
$member = new MemberModel();
$POST = $this->_Request->getPOST();
$POST['uid'] = $this->uid;
if ($member->modfypass($POST)===false){
message($member->error, 'history.back()');
}else{
message(_('修改成功!'), 'history.back()');
}
exit;
}
$this->_View->rightBody = $this->_View->render('member/modifypass');
exit($this->_View->render('member/index'));
}
//**/
public function paymentAction(){
$case = new CaseModel();
$step = (int)$this->_Request->getParam('step');
$this->_View->payvia = (int)$this->_Request->getParam('payvia') ? (int)$this->_Request->getParam('payvia'): 1;
$this->_View->payvias = array(
'1' => '银行卡支付',
'2' => '声讯电话支付',
'3' => '互联星空支付',
'4' => '手机短信注册',
'5' => '腾讯财付通支付',
'6' => '腾讯Q币支付',
'7' => '神州行充值卡支付',
'8' => '盛大游戏点卡支付',
'9' => '支付宝支付',
'10' => '手机银行支付',
'11' => '北京宽带支付',
'12' => '联通充值卡支付',
); //支付的全部途径
if ($step == 2){ //提交支付页面
$id = (int)$this->_Request->getPost('id'); //购买商品ID
$this->_View->shopinfo = $case->getRow($id);
$group = unserialize(Easy_Cache::get('usergroup'));
$this->_View->shopinfo['groupname'] = $group[$this->_View->shopinfo['usergroup']]['title'];
//生成订单
$this->_View->shopinfo['orderno'] = date('YmdHis');
$this->_View->shopinfo['username'] = $this->_View->user['username'];
$numeric = $case->makeOrder($this->_View->shopinfo); //生成订单返回订单号码
$this->_View->shopinfo['inserid'] = $numeric;
$this->_View->receive_url = $this->receive_url;
$this->_View->payvia = $this->_Request->getPost('payvia') ? $this->_Request->getPost('payvia') : 1;
//$this->_View->paymode='testmode';
$this->_View->ymd = date('Ymd');
$this->_View->reg_key = $this->config['reg_key'];
$this->_View->custom1 = $numeric;
$this->_View->custom2 = md5($numeric.$this->_View->reg_key);
//拼凑串里尽量不要使用中文字符,目前MD5在ASP、asp.net、java等环境下对中文处理可能有偏差现象
//拼凑串为:商户编号+amount+ymd+receive_url+billno+custom1+custom2+payvia+商户密钥+paymode
$post_key = $this->config['reg_userid'].($this->_View->shopinfo['money']*100).
$this->_View->ymd.$this->_View->receive_url.$this->_View->shopinfo['orderno'].
$this->_View->custom1.$this->_View->custom2.$this->_View->payvia.
$this->_View->reg_key.$this->_View->paymode;
//strtoupper函数是将字符转换为大写
//贺喜支付平台支付接口对MD5值只认大写字符串,所以小写的MD5值得转换为大写
//echo $post_key;
$this->_View->post_md5info=strtoupper(md5($post_key));
if ($this->_View->shopinfo['usertype'] == 1){
$this->_View->shopinfo['services'] = _('购买'.$this->_View->shopinfo['days'].'天'.$this->_View->shopinfo['groupname'].'会员');
}else{
$this->_View->shopinfo['services'] = _('购买'.$this->_View->shopinfo['point'].'点'.$this->_View->shopinfo['groupname'].'会员');
}
$this->_View->rightBody = $this->_View->render('member/sendpay');
exit($this->_View->render('member/index'));
}
$this->_View->shop = $case->getAll();
$this->_View->rightBody = $this->_View->render('member/payment');
exit($this->_View->render('member/index'));
}
/*支付成功后验证接受开通*/
public function receiveAction(){
$v_orderid=$_REQUEST['v_orderid']; //贺喜支付平台反馈的定单号
$v_orderdate=$_REQUEST['v_orderdate']; //定单成交时间
$v_price=$_REQUEST['v_price']; //定单成交价格,以分为单位
$v_billno=$_REQUEST['v_billno']; //商户订单号
$v_custom1=$_REQUEST['v_custom1']; //自定义字段1
$v_custom2=$_REQUEST['v_custom2']; //自定义字段2
$v_mobileno=$_REQUEST['v_mobileno']; //用户支付的手机号码,仅手机短信注册时有效
$v_servicename=$_REQUEST['v_servicename']; //支付订单的服务名称
$v_payvia=$_REQUEST['v_payvia']; //用户选择的支付途径,1:银行卡在线支付;2:声讯电话支付;3:互联星空支付;4:手机短信注册;5:腾讯财付通支付;6:腾讯Q币支付;7:神州行充值卡支付;8,盛大游戏点卡支付;9,支付宝支付;10,手机银行支付;11,北京宽带支付;12,联通充值卡支付
$v_payviastr=$_REQUEST['v_payviastr']; //用户选择的支付途径中文名称
$v_md5=$_REQUEST['v_md5']; //返回的加密字符串
$v_pstatus=$_REQUEST['v_pstatus']; //定单成功反馈的字符串,有1和0两种情况。主要用于验证是否属正常反馈。1为成功。
$v_pstring=$_REQUEST['v_pstring']; //定单支付状态说明。
$v_paymode=$_REQUEST['v_paymode']; //当前定单运行模式,仅启用测试模式时有效,值为testmode。
$v_server=$_REQUEST['v_server']; //当前定单通知的模式,1为服务器端通知。
$v_custom2 = md5($v_custom1.$this->config['reg_key']);
$encrypt_string=strtoupper(md5($v_orderid.$v_billno.$v_custom1.$v_custom2.$v_price.$v_payvia.$this->config['reg_userid'].$v_pstatus.$this->config['reg_key'].$v_paymode));
//echo $post_key;
if ((int)$v_pstatus == 1){ //返回状态为成功时
if ($encrypt_string != $v_md5){
//echo '<br>'.$v_md5;
exit('签名验证失败!');
}else{
$case = new CaseModel();
$case->v_payvia = $v_payviastr;
$case->changeState($v_custom1);
echo _('订单支付完成,请到用户用户核对订单!');
}
}
exit();
}
/*影卡*/
public function carAction(){
if ($this->_Request->isPost()){
$car = new CarModel();
if ($car->changeState($this->_Request->getPost())===false){
$this->_View->message = '<script>alert("'.$car->error.'");</script>';
}else{
$this->_View->message = '<script>alert("'._('充值成功!').'");</script>';
}
}
$this->_View->rightBody = $this->_View->render('member/car');
exit($this->_View->render('member/index'));
}
/*orderfromAction*/
public function orderfromAction(){
$case = new CaseModel();
$orderby = $this->_Request->getParam('by') ? $this->_Request->getParam('by') : 'a.id';
$state = $this->_Request->getParam('state');
$where = "a.username='".$this->_View->user['username']."'";
if (isset($state)){
$where.= ' AND a.state='.$state;
}
$this->_View->rows = $case->getCase($where, $orderby);
$this->_View->printPage = $case->printPage;
$this->_View->rightBody = $this->_View->render('member/orderfrom');
exit($this->_View->render('member/index'));
}
/*playlogAction*/
public function playlogAction(){
$play = new PlaylogModel();
$where = "a.username='".$this->_View->user['username']."'";
$this->_View->rows = $play->getAll($where);
$this->_View->printpage = $play->printPage;
$this->_View->rightBody = $this->_View->render('member/playlog');
exit($this->_View->render('member/index'));
}
public function validateAction(){
if( $this->_Request->getCookie('uid') ) {
message('您已经是登陆状态了', 'location.href=\''.$this->config['basedir'].'\'');
exit;
}
if (base64_decode($this->_Request->getParam('uri'))){
$this->_View->uri = $this->_Request->getParam('uri');
}else{
$uri = $_SERVER['HTTP_REFERER'];
if (stripos($uri, 'login')!==false){
$uri = INSTALLDIR;
}
$this->_View->uri = base64_encode($uri);
}
exit($this->_View->render('public/validate'));
}
public function lostpassAction(){
if($this->_Request->isPost()){
$userid = $this->_Request->getPost('userid');
if (stripos($userid,'@') !==false){
$row = $this->_User->getRow(array('email'=> $userid));
}else{
$row = $this->_User->getRow(array('username'=> $userid));
}
if (!$row['uid']){
$this->_View->message = _('用户名或者邮箱地址不存在!');
}else{
$message = file_get_contents(ROOT.'Config/lostpass.htm');
$message = str_replace('[email]', $row['email'] , $message);
$message = str_replace('[username]', $row['username'], $message);
$message = str_replace('[lastime]', date('Y-m-d H:i:s', $row['lastime']), $message);
$key = md5($row['uid'].$row['password'].$row['email'].$row['username']);
$uri = 'http://'.$_SERVER['HTTP_HOST'].INSTALLDIR.'?mod=member&action=resetpass&uid='.$row['uid'].'&auth='.$key;
$message = str_replace('[resetpass]', $uri, $message);
$subject = _('密码找回服务');
$email = $row['email'];
$mail = new Mail();
if ( $mail->sendMail($email, $subject, $message)){
$this->_View->message = _('密码重设信息已经发送到您的邮箱'.$email.'请进入邮箱后立即重设密码!');
}else{
echo $this->_View->message = _('邮件发送失败!您可能没有配置有效的邮件发送服务器');
}
}
$this->_View->rightBody = $this->_View->render('public/lostpass2');
}else{
$this->_View->rightBody = $this->_View->render('public/lostpass1');
}
exit($this->_View->render('public/lostpass'));
}
/*重设用户密码*/
public function resetpassAction(){
if ($this->_Request->isPost()){ //提交修改设置
$uid = (int)$this->_Request->getPost('uid');
$auth = $this->_Request->getPost('auth');
$pass1 = $this->_Request->getPost('pass1');
$pass2 = $this->_Request->getPost('pass2');
if ($pass1 != $pass2){
message(_('两次密码不一致!两次输入的密码必须一致!'), 'hiatory.back();');
exit;
}
if ( strlen($pass1) <= 5 ){
message(_('新密码长度必须大于5位数!'), 'hiatory.back();');
exit;
}
if ($uid > 0){
$row = $this->_User->getRow(array('uid'=> $this->_View->uid));
$key = md5($uid.$row['password'].$row['email'].$row['username']);
if ( $key !== $this->_View->auth){ //验证加密字符串是否正确
$array = array();
$array['uid'] = $uid;
$array['password'] = trim($pass2);
if ( $this->_User->modify($array) ){
echo '<a href="'.INSTALLDIR.'">密码重设密码成功!您的新密码是'.$pass2.'。点击这里返回首页</a>';
}else{
echo '重设密码失败!您的密码未做任何变动!';
}
unset($array);
}else{
exit('<a href="'.INSTALLDIR.'">'._('重设密码连接已经过期,点击返回首页').'</a>');
}
exit;
}else{
$this->_View->redirect('');
}
}else{ //显示修改页面
$uid = '';
$this->_View->uid = intval($this->_Request->getParam('uid'));
$this->_View->auth = $this->_Request->getParam('auth');
$row = $this->_User->getRow(array('uid'=> $this->_View->uid));
$this->_View->username = $row['username'];
if ($this->_View->uid > 0){
$key = md5($uid.$row['password'].$row['email'].$row['username']);
if ( $key !== $this->_View->auth){ //验证加密字符串是否正确
exit($this->_View->render('public/resetpass'));
}else{
exit('<a href="'.INSTALLDIR.'">'._('重设密码连接已经过期,点击返回首页').'</a>');
}
}else{
exit($this->_View->redirect(''));
}
}
}
/*更新用户在线*/
public function onlineAction(){
header('Content-type: application/x-javascript');
$sid = $this->_Request->getCookie('online');
if ($sid){
$Session = new PlaylogModel();
$Session->upSession($sid);
}
exit;
}
}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -