コード例 #1
0
 public function update()
 {
     if (!isset($_POST['id']) || empty($_POST['id'])) {
         $this->error('请选择要编辑的数据');
     }
     $ex_order_mod = D('exchange_order');
     $id = intval($_POST['id']);
     if (false === ($data = $ex_order_mod->create())) {
         $this->error($ex_order_mod->error());
     }
     /* 
     发送站内信
     array(to_user,form_user,title,content,date)
     您在本站使用积分兑换的商品订单[STATE]。
     */
     //0未发货 1部分发货 2全部发货 3部分退货 4全部退货
     switch ($_POST['goods_status']) {
         case 0:
             $state = "未发货";
             break;
         case 1:
             $state = "部分发货";
             break;
         case 2:
             $state = "全部发货";
             break;
         case 3:
             $state = "部分退货";
             break;
         case 4:
             $state = "全部退货";
             break;
     }
     $map['key'] = 'msg_dhjifen';
     $msgtitle = "积分兑换短信";
     $content = M("user_setmsg")->where($map)->find();
     $msgcontent = str_replace("[STATE]", $state, $content['val']);
     $sendmsg = array("to_user" => "{$_POST['to_user']}", "form_user" => "{$_SESSION['admin_info']['user_name']}", "title" => "{$msgtitle}", "content" => "{$msgcontent['val']}", "date" => time());
     parent::sendMsg($sendmsg);
     $result = $ex_order_mod->where("id='{$id}'")->save($data);
     if (false !== $result) {
         $this->success(L('operation_success'));
     } else {
         $this->error(L('operation_failure'));
     }
 }
コード例 #2
0
 function register()
 {
     if (isset($_POST)) {
         $_POST = setHtmlspecialchars(setFormString($_POST));
     }
     if ($this->check_login()) {
         header('location:' . u('index/index'));
     }
     //引入配置文件、类库
     $this->require_uc();
     if (isset($_POST['dosubmit'])) {
         if ($this->setting['ucenterlogin']) {
             //检查UCENTER中是否有此用户
             $ucresult = uc_user_checkname(trim($_POST['name']));
             if ($ucresult == -1) {
                 $this->assign('err', array('err' => 0, 'msg' => '用户名不合法!'));
             } elseif ($ucresult == -2) {
                 $this->assign('err', array('err' => 0, 'msg' => '包含要允许注册的词语!'));
             } elseif ($ucresult == -3) {
                 $this->assign('err', array('err' => 0, 'msg' => '用户名已经存在!'));
             }
         }
         $data = $this->user_mod->create();
         $this->assign('data', $data);
         $flag = true;
         if ($_SESSION['verify'] == md5(trim($_POST['verify']))) {
             if ($this->user_mod->where("name='" . trim($data['name']) . "'")->count()) {
                 $this->assign('err', array('err' => 0, 'msg' => '昵称已存在!'));
                 $flag = false;
             } else {
                 if (strlen(trim($data['email'])) > 0) {
                     if ($this->user_mod->where("email='" . trim($data['email']) . "'")->count()) {
                         $this->assign('err', array('err' => 0, 'msg' => '邮箱已经存在!'));
                         $flag = false;
                     }
                 }
             }
         } else {
             $this->assign('err', array('err' => 0, 'msg' => '验证码不正确!'));
             $flag = false;
         }
         if ($flag) {
             if ($this->setting['ucenterlogin']) {
                 $uid = uc_user_register($_POST['name'], $_POST['passwd'], $_POST['email']);
             }
             $data['ip'] = $_SERVER['REMOTE_ADDR'];
             $data['add_time'] = time();
             $data['passwd'] = md5(trim($data['passwd']));
             $data['user_info']['sex'] = $_POST['sex'];
             $data['user_info']['integral'] = $this->setting['user_register_score'];
             if ($this->setting['ucenterlogin']) {
                 if ($uid <= 0) {
                     if ($uid == -1) {
                         $this->assign('err', array('err' => 0, 'msg' => '用户名不合法!'));
                     } elseif ($uid == -2) {
                         $this->assign('err', array('err' => 0, 'msg' => '包含要允许注册的词语!'));
                     } elseif ($uid == -3) {
                         $this->assign('err', array('err' => 0, 'msg' => '用户名已经存在!'));
                     } elseif ($uid == -4) {
                         $this->assign('err', array('err' => 0, 'msg' => 'Email 格式有误!'));
                     } elseif ($uid == -5) {
                         $this->assign('err', array('err' => 0, 'msg' => 'Email 不允许注册'));
                     } elseif ($uid == -6) {
                         $this->assign('err', array('err' => 0, 'msg' => '该 Email 已经被注册'));
                     } else {
                         $this->assign('err', array('err' => 0, 'msg' => '未定义'));
                     }
                 } else {
                     $id = $this->user_mod->relation('user_info')->add($data);
                     //用户登陆成功,设置 Cookie,加密直接用 uc_authcode 函数,用户使用自己的函数
                     setcookie('Ucenter_auth', uc_authcode($uid . "\t" . $data['name'], 'ENCODE'));
                 }
             } else {
                 $id = $this->user_mod->relation('user_info')->add($data);
             }
             //$_SESSION['user_id']=$id;   //注册以后同步dengl
             /* 
             发送站内信
             array(to_user,form_user,title,content,date)
             注册短信:尊敬的[name]您好:欢迎注册[WEBTITLE],凡是通过[WEBTITLE]提供的链接去淘宝购物进行购物,
             都将享受到1%到50%成交额的返现,推广其他用户,即可获取被推广用户返现额的[tg]%的推广佣金,
             推广越多挣钱越轻松。祝您购物愉快!也欢迎您把我们的网站告诉更多的淘宝买家,谢谢!
             注册送积分:恭喜您,您获得本站注册赠送积分[ZSJIFEN]。
             */
             $patterns[0] = "/\\[name\\]/";
             $patterns[1] = "/\\[WEBTITLE\\]/";
             $patterns[2] = "/\\[tg\\]/";
             $replacements[2] = $data['name'];
             $replacements[1] = $this->setting['site_name'];
             $replacements[0] = $this->setting["cashback_rate"];
             $map['key'] = 'msg_zhuce';
             $msgtitle = "用户注册短信";
             $fromUser = getAdminUserName();
             $content = M("user_setmsg")->where($map)->find();
             $msgcontent = preg_replace($patterns, $replacements, $content);
             $sendmsg = array("to_user" => "{$data['name']}", "from_user" => "{$fromUser}", "title" => "{$msgtitle}", "content" => "{$msgcontent['val']}", "date" => time());
             parent::sendMsg($sendmsg);
             //送积分
             $map['key'] = 'msg_zsjifen';
             $msgtitle = "赠送积分短信";
             $jifen = M('setting')->where("name='user_register_score'")->find();
             $content = M("user_setmsg")->where($map)->find();
             $msgcontent = str_replace("[ZSJIFEN]", $jifen['data'], $content);
             $sendmsg = array("to_user" => "{$data['name']}", "from_user" => "{$fromUser}", "title" => "{$msgtitle}", "content" => "{$msgcontent['val']}", "date" => time());
             parent::sendMsg($sendmsg);
             //				$last_time=$data['add_time'];
             //				$key=md5($id.$data['name'].$last_time);
             //				cookie('user[id]',$id);
             //				cookie('user[name]',$data['name']);
             //				cookie('user[login_time]',$last_time);
             //				cookie('user[key]',$key);
             //
             //设置本程序cookie
             $last_time = time();
             $key = md5($id . $data['name'] . $last_time);
             cookie('user[id]', $id, 3600 * 24 * 7);
             cookie('user[name]', $data['name'], 3600 * 24 * 7);
             cookie('user[login_time]', $last_time, 3600 * 24 * 7);
             cookie('user[key]', $key, 3600 * 24 * 7);
             //				if($this->setting['ucenterlogin']){
             //                   echo $ucsynlogin = uc_user_synlogin($uid);	  //生成同步登录的代码
             //                }
             //如果购买商品的时候跳转过来的则跳转回购买商品页面
             if (isset($_GET['item_id']) && intval($_GET['item_id']) != '') {
                 $item_id = intval($_GET['item_id']);
                 header('location:' . u('item/index', array('id' => $item_id)));
             } else {
                 header('location:' . u('uc/index'));
             }
         }
     }
     $this->display();
 }
コード例 #3
0
 public function ok_update()
 {
     if (!isset($_POST['id']) || empty($_POST['id'])) {
         $this->error('请选择要编辑的数据');
     }
     $type = $_REQUEST['type'];
     //判断是集分宝还是其他的提现
     $user_tixian_mod = D('user_tixian');
     if (false === ($data = $user_tixian_mod->create())) {
         $this->error($user_tixian_mod->error());
     }
     $result = $user_tixian_mod->save($data);
     /* 
     发送站内信
     array(to_user,form_user,title,content,date)
     尊敬的[ddusername],您好:您的提现申请已经受理完毕!
     本次提现金额[txje]已经支付到您提供的账户,查看明细进入“我的账户明细”![addition]
     */
     //0未审核 1提现成功 2提现失败
     $patterns[0] = "/\\[ddusername\\]/";
     $patterns[1] = "/\\[txje\\]/";
     $patterns[2] = "/\\[addition\\]/";
     $replacements[0] = $_POST['uname'];
     if ($type == 2) {
         //2表示集分宝提现
         if ($this->setting['cashback_type'] == 1) {
             $replacements[1] = $_POST['jifenbao'] . $this->setting['tb_fanxian_unit'] . '集分宝';
         } else {
             $replacements[1] = $_POST['jifenbao'] . $this->setting['tb_fanxian_unit'] . $this->setting['tb_fanxian_name'];
         }
     } else {
         $replacements[1] = $_POST['money'] . '元';
     }
     $replacements[2] = $_POST['reply'];
     $map['key'] = 'msg_tixianok';
     $msgtitle = "提现成功短信";
     $fromUser = $_SESSION['admin_info']['user_name'];
     $content = M("user_setmsg")->where($map)->find();
     $msgcontent = preg_replace($patterns, $replacements, $content);
     $sendmsg = array("to_user" => "{$data['uname']}", "from_user" => "{$fromUser}", "title" => "{$msgtitle}", "content" => "{$msgcontent['val']}", "date" => time());
     parent::sendMsg($sendmsg);
     if (false !== $result) {
         $this->success(L('operation_success'));
     } else {
         $this->error(L('operation_failure'));
     }
 }