function add_before(act $act) { front::$post['userid']=$act->view->user['userid']; front::$post['username']=$act->view->user['username']; front::$post['checked']=1; front::$post['adddate']=date('Y-m-d H:i:s'); front::$post['ip']=front::ip(); }
function settle_action() { $this->_view_user = new user; if (front::post('submit') &&$this->manage->vaild()) { $this->manage->filter($this->Exc); $this->manage->edit_before(); $this->manage->save_before(); $union_payarr = array(); $union_payarr['expendamount'] = front::$post['settleexpendamount'] = round(floatval(front::$post['settleexpendamount']),2); $union_payarr['amount'] = front::$post['settleamount'] = round(front::$post['settleexpendamount']*front::$post['profitmargin']/100,2); $union_payarr['userid'] = front::$post['userid']=front::get('id'); $union_payarr['inputer'] = front::$post['inputer']=$this->view->user['username']; $union_payarr['addtime'] = front::$post['addtime']=time(); $union_payarr['ip'] = front::$post['ip']=front::ip(); $union_payarr['payaccount'] = front::$post['payaccount']; $union_payarr['profitmargin'] = front::$post['profitmargin']; $union_pay = new union_pay(); $insert = $union_pay->rec_insert($union_payarr); $unionarr = array(); $unionarr['totalexpendamount']='[totalexpendamount+'.front::$post['settleexpendamount'].']'; $unionarr['totalpayamount']='[totalpayamount+'.front::$post['settleamount'].']'; $unionarr['lastpayamount']=front::$post['settleamount']; $unionarr['lastpaytime']=time(); $unionarr['settleexpendamount']='[settleexpendamount-'.front::$post['settleexpendamount'].']'; $this->_table->rec_update($unionarr,front::get('id')); $this->_view_user->rec_update(array('point'=>'[point-'.front::$post['settleexpendamount'].']'),front::get('id')); front::flash("{$this->tname}完成操作!"); front::redirect(url::modify('act/list/table/'.$this->table)); } $userunion = $this->_view_user->getrow(array('userid'=>front::get('id'))); $this->_table1 = new union(); $this->_view_table=$this->_table1->getrow(array('userid'=>front::get('id'))); $this->_view_table=$this->_view_table+$userunion; }
function __construct() { if (ADMIN_DIR!=config::get('admin_dir')) { config::modify(array('admin_dir'=>ADMIN_DIR)); front::flash('后台目录更改成功!'); } front::$rewrite=false; parent::__construct(); $servip = gethostbyname($_SERVER['SERVER_NAME']); //if($this instanceof file_admin && in_array(front::get('act'), array('updialog','upfile','upfilesave','netfile','netfilesave','swfsave'))) return; if($servip==front::ip()&&front::get('ishtml')==1) return; $this->check_admin(); }
public static function pointadd($username,$num,$note) { $user = new user(); $num = intval($num); $note = $note; $userarr = array(); $userarr['username'] = $username; $user->rec_update(array('point'=>'[point+'.$num.']'),$userarr); $pay_exchange = new pay_exchange(); $userarr['username'] = $username; $userarr['type'] = 'point'; $userarr['value'] = $num; $userarr['note'] = $note; $userarr['addtime'] = time(); $userarr['ip'] = front::ip(); $pay_exchange->rec_insert($userarr); }
function get_code($order,$payment) { require_once ("tenpay/PayRequestHandler.class.php"); $strReq = date("His") . rand(1000, 9999); $transaction_id = $payment['tenpay_account'] . date("Ymd") . $strReq; $reqHandler = new PayRequestHandler(); $reqHandler->init(); $reqHandler->setKey($payment['tenpay_key']); $reqHandler->setParameter("bargainor_id", $payment['tenpay_account']); //商户号 $reqHandler->setParameter("sp_billno",$order['ordersn']); //商户订单号 $reqHandler->setParameter("transaction_id", $transaction_id); //财付通交易单号 $reqHandler->setParameter("total_fee", $order['orderamount']*100); //商品总金额,以分为单位 $reqHandler->setParameter("return_url", pay::url(basename(__FILE__,'.php'))); //返回处理地址 $reqHandler->setParameter("desc", $order['ordersn']); //商品名称 $reqHandler->setParameter("spbill_create_ip", front::ip()); $reqUrl = $reqHandler->getRequestURL(); $button = '<div style="text-align:center"><input type="button" onclick="window.open(\''.$reqUrl.'\')" value="财付通网上支付" /></div>'; return $button; }
function consult_action() { if(front::post('submit')) { if(front::post('content') == ''){ echo '<script>alert("请填写你要咨询的内容!");history.go(-1);</script>'; return false; } if(front::post('u_mobile') == ''){ echo '<script>alert("请填写你的手机号码!");history.go(-1);</script>'; return false; } $user=''; if(cookie::get('login_username') &&cookie::get('login_password')) { $user=new user(); $user=$user->getrow(array('username'=>cookie::get('login_username'))); } if($user['username'] == ''){ $user['username'] = '******'; } $smtpemailto = config::get('email'); $title = '游客'.front::ip().'在'.date('Y-m-d H:i:s').'留言'; $code = $user['username'].'('.front::post('u_mobile').')在'.date('Y-m-d H:i:s').'说'.front::post('content'); if($smtpemailto) { $this->sendmail($smtpemailto,$title,$code); } if(config::get('sms_on') && config::get('sms_consult_admin_on') && $mobile = config::get('site_mobile')){ sendMsg($mobile,$user['username'].'('.front::post('u_mobile').')在'.date('Y-m-d H:i:s').'说'.front::post('content')); $f = fopen('data/message/'.date('Ymd').'.txt','ab'); fwrite($f,$user['username']."\t".front::post('u_mobile')."\t".date('Y-m-d H:i:s')."\t".front::post('content')."\r\n"); fclose($f); echo '<script>alert("咨询信息发送成功!");history.go(-1);</script>'; return false; } echo '<script>alert("咨询信息发送失败!");history.go(-1);</script>'; return false; } }
static function log($action,$remark){ $user = new user(); $username = cookie::get('login_username'); $row = $user->getrow(array('username'=>$username)); $uid = $row['userid']; $action = lang($action);$remark = lang($remark); $ip = front::ip(); $addtime = time(); $sql = "INSERT INTO `".config::get('database', 'prefix')."event` VALUES (null,'$uid','$username','$ip','$addtime','$action','$remark')"; $event = new event; $event->query($sql); }
function orders_action() { $this->view->aid = trim(front::get('aid')); if (front::post('submit')) { $this->orders = new orders(); $row = $this->orders->getrow("","adddate DESC"); //var_dump(time()); if($row['adddate'] && time() - $row['adddate'] <= intval(config::get('order_time'))){ alerterror('操作频繁,请稍后再试'); return; } if (front::$post['telphone'] == '') { alerterror('联系电话为必填!'); return; } front::$post['mid'] = $this->view->user['userid'] ? $this->view->user['userid'] : 0; front::$post['adddate'] = time(); front::$post['ip'] = front::ip(); if (isset(front::$post['aid'])) { $aidarr = front::$post['aid']; unset(front::$post['aid']); foreach ($aidarr as $val) { front::$post['aid'].=$val . ','; front::$post['pnums'].=front::$post['thisnum'][$val] . ','; } } else { front::$post['aid'] = $this->view->aid; } if (!isset(front::$post['logisticsid'])) front::$post['logisticsid'] = 0; front::$post['oid'] = date('YmdHis') . '-' . front::$post['logisticsid'] . '-' . front::$post['mid'] . '-' . front::$post['payname']; $insert = $this->orders->rec_insert(front::$post); if ($insert < 1) { front::flash($this->tname . lang('添加失败!')); } else { if (config::get('sms_on') && config::get('sms_order_on')) { sendMsg(front::$post['telphone'], config::get('sms_order')); } if (config::get('sms_on') && config::get('sms_order_admin_on') && $mobile = config::get('site_mobile')) { sendMsg($mobile, '网站在' . date('Y-m-d H:i:s') . '有新订单了'); //echo 11; } $user = $this->view->user; if(config::get('email_order_send_cust') && $user['e_mail']){ $title = "您在".config::get('sitename')."的订单".front::get('oid')."已提交"; $this->sendmail($user['e_mail'], $title, $title); } if(config::get('email_order_send_admin') && config::get('email')){ $title = '网站在' . date('Y-m-d H:i:s') . '有新订单了'; $this->sendmail(config::get('email'), $title, $title); } if (front::$post['payname'] && front::$post['payname'] != 'nopay') { echo '<script type="text/javascript">alert("' . lang('orderssuccess') . ' ' . lang('现在转入支付页面') . '");window.location.href="' . url('archive/payorders/oid/' . front::$post['oid'], true) . '";</script>'; } echo '<script type="text/javascript">alert("' . lang('orderssuccess') . '");window.location.href="' . url('archive/orders/oid/' . front::$post['oid'], true) . '";</script>'; } } elseif (front::get('oid')) { preg_match_all("/-(.*)-(.*)-(.*)/isu", front::get('oid'), $oidout); $this->view->paytype = $oidout[3][0]; if($oidout[2][0] != $this->view->user['userid']){ alertinfo('查看订单失败', url::create('index/index')); } $where = array(); $where['oid'] = front::get('oid'); $this->view->orders = orders::getInstance()->getrow($where); $this->view->statusnum = $data['status'] = $this->view->orders['status']; switch ($data['status']) { case 1: $data['status'] = lang('完成'); break; case 2: $data['status'] = lang('处理中'); break; case 3: $data['status'] = lang('已发货'); break; case 4: $data['status'] = lang('客户已付款,待审核'); break; case 5: $data['status'] = lang('已核实客户支付'); break; default: $data['status'] = lang('新订单'); break; } $this->view->orders['status'] = $data['status']; if ($this->view->paytype) { $this->view->gotopaygateway = '<a href="' . url('archive/payorders/oid/' . front::get('oid'), true) . '">进入支付页面</a>'; } //var_dump($this->view->user);var_dump($_SESSION);exit(); $this->out('message/orderssuccess.html'); } elseif (front::get('aid')) { $this->view->archive = archive::getInstance()->getrow(front::get('aid')); $this->view->categorys = category::getpositionlink2($this->view->archive['catid']); $this->view->paylist = pay::getInstance()->getrows('', 50); $this->view->logisticslist = logistics::getInstance()->getrows('', 50); $prices = getPrices($this->view->archive['attr2']); $this->view->archive['attr2'] = $prices['price']; if (!is_array($this->view->archive)) $this->out('message/error.html'); if ($this->view->archive['checked'] < 1) exit(lang('未审核!')); if (!rank::arcget(front::get('aid'), $this->view->usergroupid)) { $this->out('message/error.html'); } } else { $oreders_c = cookie::get('ce_orders_cookie'); if(preg_match('/union/i', $oreders_c)){ alerterror("非法字符"); } $oreders_c = stripslashes(htmlspecialchars_decode($oreders_c)); $aid = !empty($oreders_c) ? unserialize($oreders_c) : 0; if ($aid) { foreach ($aid as $key => $val) { $archive = archive::getInstance()->getrow(intval($val['aid'])); $val['title'] = $archive['title']; $prices = getPrices($archive['attr2']); $val['attr2'] = $prices['price']; $aid[$key] = $val; } $this->view->orderaidlist = $aid; $this->view->paylist = pay::getInstance()->getrows('', 50); $this->view->logisticslist = logistics::getInstance()->getrows('', 50); } else { if (isset(front::$get['oid'])) { //echo '<script type="text/javascript">alert("' . lang('请输入订单编号!') . '");'; if ($_SERVER['HTTP_REFERER']) { front::refresh($_SERVER['HTTP_REFERER']); //echo 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '";'; } else { front::refresh(url('index')); //echo 'window.location.href="' . url('index') . '";'; } //echo '</script>'; exit; } echo '<script type="text/javascript">alert("' . lang('购物车暂无商品!') . '");'; if ($_SERVER['HTTP_REFERER']) { //front::refresh($_SERVER['HTTP_REFERER']); echo 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '";'; } else { //front::refresh(url('index')); echo 'window.location.href="' . url('index') . '";'; } echo '</script>'; } } }
function guestadd_action() { if($this->view->guestuser) { echo '<script type="text/javascript"> alert("'.lang('你已经登录,自动跳转到会员发布页面!').'"); window.location.href="'.url::create('/manage/add/manage/archive').'"; </script>'; } if(front::post('submit') &&$this->manage->vaild()) { $this->manage->filter(); $this->manage->save_before(); //front::$post['title']=addslashes(front::$post['title']); front::$post['checked']=0; front::$post['userid']='-999'; front::$post['username']='******'; front::$post['author']='guest'; front::$post['adddate']=date('Y-m-d H:i:s'); front::$post['ip']=front::ip(); $data=array(); $fieldlimit=$this->_table->getcols(front::$act=='list'?'user_manage':'user_modify'); $fieldlimits=explode(',',$fieldlimit); foreach(front::$post as $key=>$value) { if(in_array($key,$fieldlimits)) $data[$key]=$value; } $data=array_merge($data,front::$post); $insert=$this->_table->rec_insert($data); if($insert<1) { front::flash(lang('记录添加失败!')); } else { front::flash(lang('记录添加成功!')); if($this->table== 'archive') front::redirect(url::create('/manage/guestlist/manage/archive/needcheck/1/guest/1')); } } $this->_view_table=$this->_table->getrow(null,0,null,$this->_table->getcols('user_modify')); $this->_view_table['data']=array(); }
function make_list_action() { $servip = gethostbyname($_SERVER['SERVER_NAME']); if($servip==front::ip()&&front::get('ishtml')==1){ }else{ chkpw('cache_category'); } header('Cache-control: private, must-revalidate'); @set_time_limit(0); if (!front::post('submit')) return; $case = 'archive'; $act = 'list'; $_GET = array('case' => $case, 'act' => $act); $front = new front(); front::$admin = false; front::$html = true; front::$rewrite = false; $case = $case . '_act'; $case = new $case(); $case->init(); $method = $act . '_action'; $totalpage = 100; $time_start = time::getTime(); $category = category::getInstance(); $categories = $category->sons(front::post('catid')); $categories[] = front::post('catid'); $cpage = 0; $archive_all = new archive(); foreach ($categories as $key => $catid) { $new_categories = $category->sons($catid); $new_categories[] = $catid; $archive_num[$catid] = $archive_all->rec_count('catid in(' . implode(',', $new_categories) . ') and checked=1 and `state`=1'); } $i = 0; foreach ($categories as $catid) { if ($catid == 0) continue; if (!category::getishtml($catid)) continue; front::$get['catid'] = $catid; $case->view->categories = category::getpositionlink2($catid); $_categories = $category->sons($catid); $_categories[] = $catid; $case->view->ifson = category::hasson($catid); for (front::$get['page'] = 1;; front::$get['page']++) { $view = $case->view; $_catpage = category::categorypages($catid); if ($_catpage) { $pagesize = $_catpage; } else { $pagesize = config::get('list_pagesize'); } $limit = ((front::$get['page'] - 1) * $pagesize) . ',' . $pagesize; $archive = new archive(); $tops = array(); $tops = $archive->getrows("checked=1 AND state=1 AND toppost!=0",0,'toppost DESC,listorder=0,listorder ASC,aid DESC'); if (@$category->category[$catid]['includecatarchives']) { $case->view->archives = $archive->getrows('catid in(' . implode(',', $_categories) . ') and checked=1 and `state`=1', $limit, 'listorder=0,`listorder` asc,`adddate` DESC'); } else { $case->view->archives = $archive->getrows("catid=$catid and checked=1 and `state`=1", $limit, 'listorder=0,`listorder` asc,`adddate` DESC'); } $case->view->page = front::$get['page']; if(is_array($tops) && !empty($tops)){ foreach($tops as $order => $arc){ if($arc['toppost'] == 3){ $tops[$order]['title'] = "[全站置顶]".$arc['title']; } if($arc['toppost'] == 2){ $subcatids = $category->sons($arc['catid']); if($arc['catid'] != front::get('catid') && !in_array(front::get('catid'), $subcatids)){ unset($tops[$order]); }else{ $tops[$order]['title'] = "[栏目置顶]".$arc['title']; } } } $case->view->archives = array_merge($tops , $case->view->archives); } foreach ($case->view->archives as $order => $arc) { $articles = $arc; if (!$arc['introduce']) $arc['introduce'] = cut($arc['content'], 200); $articles['url'] = archive::url($arc); $articles['catname'] = category::name($arc['catid']); $articles['caturl'] = category::url($arc['catid']); $articles['image'] = @strstr($arc['image'], "http://") ? $arc['image'] : config::get('base_url') . '/' . $arc['image']; $articles['strgrade'] = archive::getgrade($arc['grade']); $articles['adddate'] = sdate($arc['adddate']); $articles['buyurl'] = url('archive/orders/aid/' . $arc['aid']); $articles['stitle'] = strip_tags($arc['title']); if(strtolower(substr($arc['thumb'],0,7)) == 'http://'){ $articles['sthumb'] = $arc['thumb']; }else{ $articles['sthumb'] = config::get('base_url').'/'.$arc['thumb']; } if($arc['strong']) { $articles['title'] = '<strong>'.$arc['title'].'</strong>'; } if($arc['color']) { $articles['title'] = '<font style="color:'.$arc['color'].';">'.$articles['title'].'</font>'; } $case->view->archives[$order] = $articles; } if (!isset($page_count)) { front::$record_count = $case->view->record_count = $archive_num[$catid]; $case->view->page_count = ceil($case->view->record_count / $pagesize); $page_count = $case->view->page_count; } $case->view->catid = $catid; $case->view->topid = category::gettopparent($catid); $case->view->parentid = $category->getparent($catid); $case->view->pages = @$category->category[$catid]['ispages']; if (front::get('page') > 1 && front::get('page') > $case->view->page_count) { $page_count = null; break; } if (front::get('page') > 1 && !@$category->category[$catid]['ispages']) { $page_count = null; break; } $template = @$category->category[$catid]['template']; if ($template && file_exists(TEMPLATE . '/' . $case->view->_style . '/' . $template)) $tpl = $template; else $tpl = category::gettemplate($case->view->catid); $content = $case->fetch($tpl); $path = ROOT . category::url($catid, front::$get['page'] > 1 ? front::$get['page'] : null, true); if (!preg_match('/\.[a-zA-Z]+$/', $path)) $path = rtrim(rtrim($path, '/'), '\\') . '/index.html'; $path = rtrim($path, '/'); $path = rtrim($path, '\\'); $path = str_replace('//', '/', $path); tool::mkdir(dirname($path)); file_put_contents($path, $content); $indexpath = dirname($path) . '/index.html'; if (front::$get['page'] == 1 && $indexpath != ROOT . '/index.html') { file_put_contents($indexpath, $content); $cpage++; } $cpage++; $case->view = $view; $case->view->archives = null; } $i++; } if ($cpage > 0) front::flash("成功生成html <b>$cpage</b> 页!"); else front::flash("没有生成html!"); front::$admin = true; }
function register_action() { if(front::post('submit')) { if(!config::get('reg_on')) { front::flash(lang('网站已经关闭注册!')); return; } if(config::get('verifycode')) { if(!session::get('verify') ||front::post('verify')<>session::get('verify')) { front::flash(lang('验证码错误!')); return; } } if(front::post('username') != strip_tags(front::post('username')) ||front::post('username') != htmlspecialchars(front::post('username')) ) { front::flash(lang('用户名不规范!')); return; } if(strlen(front::post('username'))<4) { front::flash(lang('用户名太短!')); return; } if(strlen(front::post('e_mail'))<1) { front::flash(lang('请填写邮箱!')); return; } if(strlen(front::post('tel'))<1) { front::flash(lang('请填写手机号码!')); return; } if(front::post('username') &&front::post('password')) { $username=front::post('username'); $password=md5(front::post('password')); $e_mail=front::post('e_mail'); $tel=front::post('tel'); if(!preg_match('/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/', front::ip())&&!preg_match('@^\s*((([0-9A-Fa-f]{1,4}:){7}(([0-9A-Fa-f]{1,4})|:))|(([0-9A-Fa-f]{1,4}:){6}(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}:){5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){4}(:[0-9A-Fa-f]{1,4}){0,1}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){3}(:[0-9A-Fa-f]{1,4}){0,2}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:){2}(:[0-9A-Fa-f]{1,4}){0,3}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}:)(:[0-9A-Fa-f]{1,4}){0,4}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(:(:[0-9A-Fa-f]{1,4}){0,5}((:((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))(%.+)?\s*$@', front::ip())){ exit('来源非法'); } $data=array( 'username'=>$username, 'password'=>$password, 'e_mail'=>$e_mail, 'tel'=>$tel, 'groupid'=>101, 'userip'=>front::ip() ); //phpox 2011-06-10 foreach($this->view->field as $f){ $name=$f['name']; if(!preg_match('/^my_/',$name)) { unset($field[$name]); continue; } if(!setting::$var['user'][$name]['showinreg']) { continue; } $data[$name] = front::post($name); } if($this->_user->getrow(array('username'=>$username))) { front::flash(lang('该用户名已被注册!')); return; } $insert=$this->_user->rec_insert($data); $_userid = $this->_user->insert_id(); if($insert){ if(config::get('sms_on') && config::get('sms_reg_on')){ sendMsg($tel,config::get('sms_reg')); } $cmsname = config::get('sitename'); if(config::get('email_reg_on')){ $this->sendmail($e_mail,"欢迎注册 $cmsname !",lang('尊敬的').$username.', '.lang('您好!欢迎你注册'.$cmsname.'!')); } front::flash(lang('注册成功!')); }else { front::flash(lang('注册失败!')); return; } if(union::getconfig('enabled')) { $union_visitid = intval(cookie::get('union_visitid')); $union_userid = intval(cookie::get('union_userid')); if($union_visitid &&$union_userid) { $union_reg = new union(); $r = $union_reg->getrow(array('userid'=>$union_userid)); if($r) { $union_reg->rec_update(array('registers'=>'[registers+1]'),array('userid'=>$union_userid)); if($union_reg->affected_rows()) { $union_visit_reg = new union_visit(); $union_visit_reg->rec_update(array('regusername'=>front::post('username'),'regtime'=>time()),array('visitid'=>$union_visitid)); $this->_user->rec_update(array('introducer'=>$union_userid),array('userid'=>$_userid)); $regrewardtype = union::getconfig('regrewardtype'); $regrewardnumber = union::getconfig('regrewardnumber'); switch($regrewardtype) { case 'point': union::pointadd($r['username'],$regrewardnumber,'union'); break; } } } } } $user=$data; cookie::set('login_username',$user['username']); cookie::set('login_password',front::cookie_encode($user['password'])); session::set('username',$user['username']); front::redirect(url::create('user')); exit; } else { front::flash(lang('注册失败!')); return; } } }
function add_action() { if(front::$post['submit']) { if(config::get('verifycode')) { if(!session::get('verify') ||front::post('verify')<>session::get('verify')) { alerterror(lang('验证码错误!')); $this->render(@setting::$var[$this->table]['myform']['template']); $this->end=false; return; } } front::$post['checked']=0; front::$post['userid']=$this->view->user['userid']; front::$post['username']=$this->view->user['username']; front::$post['author']=$this->view->user['username']; front::$post['adddate']=date('Y-m-d H:i:s'); front::$post['ip']=front::ip(); foreach(front::$post as $k=>$p) { if( is_array($p)) front::$post[$k]=implode(',',$p); } $data=front::$post; $insert=$this->_table->rec_insert($data); if($insert<1) { front::flash(lang('表单提交失败!')); } else { if(is_array(front::$post) &&!empty(front::$post)) { foreach(front::$post as $k =>$v) { if(preg_match('/^my_.*?mail$/i',$k) &&strstr($v,'@')) { $email = front::$post[$k]; break; } } foreach(front::$post as $k =>$v) { if(preg_match('/^my_.*?tel$/i',$k) &&strstr($v,'@')) { $tel = front::$post[$k]; break; } } } $code = ''; foreach ($this->view->field as $k =>$v) { $cname = setting::$var[$this->table][$k]['cname']; $val = front::$post[$k]; $code .= $cname.": ".$val."<br>"; } $smtpemailto = config::get('email'); $title = setting::$var[$this->table]['myform']['cname'].lang('的结果'); if(config::get('email_form_on') && $email) { $this->sendmail($email,$title,$code); } if(config::get('email_form_on') && $smtpemailto) { $this->sendmail($smtpemailto,$title,$code); } if($tel) { if(config::get('sms_on') && config::get('sms_form_on')){ sendMsg($tel,config::get('sms_form')); } if(config::get('sms_on') && config::get('sms_form_admin_on') && $mobile = config::get('site_mobile')){ sendMsg($mobile,front::$post['username'].'在'.date('Y-m-d H:i:s').'提交了表单'); } } if(front::$post['aid']){ echo "<script>alert('表单提交成功!');window.location.href='".url::create('/archive/show/aid/'.front::$post['aid'])."'</script>"; //front::redirect(); }else{ front::redirect(url::create('/form/message')); } } } $this->render(@setting::$var[$this->table]['myform']['template']); $this->end=false; }
function register_action() { $r = $this->_union->getrow(array('userid'=>$this->view->data['userid'])); if($r) { echo '<script type="text/javascript">alert("'.lang('你已经申请,转入联盟页面!').'")</script>'; front::refresh(url::create('union/stats')); } if(front::post('submit')) { if(!config::get('reg_on')) { front::flash(lang('网站已经关闭注册!')); return; } if(config::get('verifycode')) { if(!session::get('verify') ||front::post('verify')<>session::get('verify')) { front::flash(lang('验证码错误!')); return; } } if(front::post('nickname') != strip_tags(front::post('nickname')) ||front::post('nickname') != htmlspecialchars(front::post('nickname')) ) { front::flash(lang('姓名不规范!')); return; } if(strlen(front::post('nickname'))<4) { front::flash(lang('请填写认真填写真实姓名!')); return; } if(strlen(front::post('payaccount'))<1) { front::flash(lang('请填写支付账号!')); return; } if(strlen(front::post('tel'))<1) { front::flash(lang('请填写联系电话!')); return; } if(strlen(front::post('address'))<1) { front::flash(lang('请填写联系地址!')); return; } if(strlen(front::post('website'))<1) { front::flash(lang('请填写网站地址!')); return; } /*if(strlen(front::post('e_mail'))<1) { front::flash(lang('请填写邮箱!')); return; }*/ if(is_array($_POST)){ foreach ($_POST as $v){ if(preg_match('/(select|load_file|\[|password)/i', $v)){ exit('not access'); } } } $userarr = array(); $userarr['nickname'] = front::$post['nickname']; $userarr['tel'] = front::$post['tel']; $userarr['address'] = front::$post['address']; //$userarr['e_mail'] = front::$post['e_mail']; $unionarr = array(); $unionarr['userid'] = $this->view->data['userid']; $unionarr['username'] = $this->view->data['username']; $unionarr['payaccount'] = front::$post['payaccount']; $unionarr['website'] = front::$post['website']; $unionarr['profitmargin'] = union::getconfig('profitmargin'); $unionarr['regtime'] = time(); $unionarr['regip'] = front::ip(); $unionarr['passed'] = 1; if(front::post('nickname') &&$this->view->data['userid']) { $insert=$this->_user->rec_update($userarr,'userid='.$this->view->user['userid']); $insert1 = $this->_union->rec_insert($unionarr); if($insert &&$insert1) front::flash(lang('申请成功!')); else { front::flash(lang('申请失败!')); return; } front::redirect(url::create('union/stats')); exit; } else { front::flash(lang('申请失败!')); return; } } }
function index_action() { $this->list_action(); if(front::post('submit')) { if(!front::post('guesttel')) { front::flash(lang('请填写联系电话!')); return false; } if(!front::post('title')) { front::flash(lang('请填写标题!')); return false; } if(!front::post('content')) { front::flash(lang('请选择内容!')); return false; } if(config::get('verifycode')) { if(front::post('verify')<>session::get('verify')) { front::flash(lang('验证码错误!')); return false; } } front::$post['checked']=0; if(empty($this->view->user)) { front::$post['userid']=0; front::$post['username']='******'.front::$post['nickname']; }else { front::$post['userid']=$this->view->user['userid']; front::$post['username']=$this->view->user['username']; } front::$post['adddate']=date('Y-m-d H:i:s'); front::$post['ip']=front::ip(); if (!get_magic_quotes_gpc()) { front::$post['content'] = front::$post['content']; } front::$post['title']=strip_tags(front::$post['title']); $data=front::$post; $insert=$this->_table->rec_insert($data); if($insert<1) { front::flash(lang('留言失败!')); } else { if(config::get('email_gust_send_cust') && front::$post['guestemail']){ $title = "您在".config::get('sitename')."的留言已提交"; $this->sendmail(front::$post['guestemail'], $title, $title); } if(config::get('email_guest_send_admin') && config::get('email')){ $title = '网站在' . date('Y-m-d H:i:s') . '有新留言了'; $this->sendmail(config::get('email'), $title, $title); } if(config::get('sms_on') && config::get('sms_guestbook_on')){ sendMsg(front::$post['guesttel'],config::get('sms_guestbook')); } if(config::get('sms_on') && config::get('sms_guestbook_admin_on') && $mobile = config::get('site_mobile')){ sendMsg($mobile,front::$post['username'].'在'.date('Y-m-d H:i:s').'留言了'); } front::flash(lang('留言成功!')); $this->view->submit_success=true; if(front::get('t') == 'wap'){ front::redirect(url::create('guestbook/index/t/wap/success/'.time())); }else{ front::redirect(url::create('guestbook/index/success/'.time())); } } } }