/** * 用户登录 * @param string $username 用户名 * @param string $passwd 明文密码 * @param array $result 错误信息 * @return multitype:Array|NULL 用户信息 */ public function Login($username, $passwd, array &$result) { $passwd = $this->EncrptPasswd($passwd); $w = array('username' => $username, 'passwd' => $passwd, 'flag' => 1); $one = $this->GetOne($w); if (!$one) { //不存在此用户 MsgInfoConst::GetMsg(1001, $result); return array(); } $result['result'] = 'SUCCESS'; $one['passwd'] = null; //缓存判别登录状态 $memcache = XMemCache::GetInstance(); $memcache->Set('Cur_X_User', 'isLogin'); $this->SetSessionInfo($one); return $one; }
/** * 更新游戏信息 */ public function gupdateAction() { $id = reqnum('id', 0); $ispost = reqnum('ispost', 0); $m = new Psys_ResModel(); if ($ispost == 1) { $appname = reqstr('appname'); $appcol = reqstr('appcol'); $appid = reqstr('appid', ''); $appid = $appid ? $appid : $this->getmaxappidAction($appcol); $price = reqstr('price', 0); $downcount = reqstr('downcount', 0); $logourl = reqstr('logourl'); $appurl = reqstr('appurl'); $ver = reqstr('ver', 0); $vernum = reqstr('vernum'); $filesize = reqstr('filesize'); $apppackage = reqstr('package'); $apptype = reqstr('apptype'); $lang = reqstr('lang'); $iftj = reqstr('iftj'); $flag = reqstr('flag'); $adesc = reqstr('adesc'); $adetail = reqstr('adetail'); $typeinfo = reqstr('typeinfo'); $develop = reqstr('develop'); $sig = reqstr('sig'); $pptfilenames = reqstr('pptfilenames'); $pptiosnames = reqstr('pptios'); $sortid = reqnum('sortid', 0); //return array('result'=>$pptfilenames); //转ppt文件名连接成的字符串为数组 if (!empty($pptfilenames)) { $ppt = explode(';', $pptfilenames); } else { $ppt = array(); } if (!empty($pptiosnames)) { $pptios = explode(';', $pptiosnames); } else { $pptios = array(); } //$ext = strrchr($logourl,'.'); $ext = '.png'; $data = array('appname' => $appname, 'appid' => $appid, 'price' => $price, 'downcount' => $downcount, 'sortid' => $sortid, 'imgurl' => 'logo' . $ext, 'appurl' => $appurl, 'ver' => $ver, 'vernum' => $vernum, 'filesize' => $filesize, 'package' => $apppackage, 'appcol' => $appcol, 'apptype' => $apptype, 'lang' => $lang, 'iftj' => $iftj, 'flag' => $flag, 'adesc' => $adesc, 'adetail' => $adetail, 'signature' => $sig, 'ctime' => time(), 'utime' => time(), 'typeinfo' => $typeinfo, 'develop' => $develop); $result = array('result' => 'ERROR'); if ($logourl == '') { MsgInfoConst::GetMsg(1041, $result); return $result; } /* * // 判断APP是否存在 $where = array ( 'appid' => $appid ); $isexit = $m->GetOneGame ( $where ); if ($isexit || count ( $isexit ) > 0) { MsgInfoConst::GetMsg ( 1043, $result ); return $result; } */ if ($id == 0) { $m->AddGame($data); if ($apptype == 2) { $ppt = $pptios; } if (!empty($ppt)) { for ($i = 0; $i < count($ppt); $i++) { // APP对应PPT //$ext = '.png'; //$ext = strrchr($ppt[$i],'.'); $appimg = array('appid' => $appid, 'imgurl' => $ppt[$i], 'ctime' => time()); if (empty($appimg['imgurl'])) { break; } $res = $m->AddGamePPT($appimg); $m->Record($appimg, $res, 'db-rht_sync', 'appimg', 'rhs_downsync'); } } // start 写操作日志 $log = array('logtype' => 71, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip()); $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[添加]APP" . $appname; $m->admin_syslog($log); $result['result'] = 'SUCCESS'; } else { $w = array('id' => $id); $data['utime'] = time(); //------------------------物理文件更新开始 //获取更新前数据信息 $oldData = $m->GetOneGame($w, 'imgurl,appurl'); if ($data['appcol'] == 1) { $dir = GAME_PATH; } else { $dir = APP_PATH; } $imgurlPath = $dir . '/' . $data['appid'] . '/' . $oldData['imgurl']; $appurlPath = $dir . '/' . $data['appid'] . '/' . $oldData['appurl']; if (file_exists($imgurlPath) && $data['imgurl'] != $oldData['imgurl']) { unlink($imgurlPath); } if (file_exists($appurlPath) && $data['appurl'] != $oldData['appurl']) { unlink($appurlPath); } //------------------------物理文件更新结束 $m->UpdateGame($data, $w); // 先删除PPT表里等于APPID的PPT $w = array('appid' => $appid); $m->DelOneGamePPT($w); for ($i = 0; $i < count($ppt); $i++) { // APP对应PPT //$ext = strrchr($ppt[$i],'.'); //$ext = '.png'; $appimg = array('appid' => $appid, 'imgurl' => $ppt[$i], 'ctime' => time()); if (empty($appimg['imgurl'])) { break; } $res = $m->AddGamePPT($appimg); $m->Record($appimg, $res, 'db-rht_sync', 'appimg', 'rhs_downsync'); } // start 写操作日志 $log = array('logtype' => 71, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip()); $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[编辑]APP信息" . $appname; $m->admin_syslog($log); // end 日志 $result['result'] = 'SUCCESS'; } return $result; } }
/** * 更新广告位信息 */ public function updatefulladsAction() { $id = reqnum('id', 0); $ispost = reqnum('ispost', 0); $model = new Psys_AdsModel(); if ($ispost == 1) { //广告名 $adname = reqstr('adname'); //名称缩写 $adsname = reqstr('adsname'); //显示位置 $colid = reqstr('colid'); //图片路径 $imgurl = reqstr('imgurl', ''); //访问路径 $actionurl = reqstr('actionurl'); $subpage = reqnum('subpage'); $flag = reqnum('flag'); $data = array('adname' => $adname, 'adsname' => $adsname, 'colid' => $colid, 'flag' => $flag, 'imgurl' => $imgurl, 'actionurl' => $actionurl, 'subpage' => $subpage, 'ctime' => time(), 'station' => '1'); $result = array('result' => 'ERROR'); if ($imgurl == '') { MsgInfoConst::GetMsg(1041, $result); return $result; } if ($id == 0) { $nt = new Psys_AdsModel(); $where = array('adname' => $adname); $info = $nt->GetOne($where, "id,adname,subpage,imgurl,actionurl,colid,flag"); if ($info) { $result = array('result' => 'ADNAME'); } $returnid = $model->AddOne($data); // start 写操作日志 $log = array('logtype' => 72, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip()); $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[添加]广告位" . $adname; $model->admin_syslog($log); // end 日志 $result['result'] = 'SUCCESS'; } else { $w = array('id' => $id); $returnid = $model->UpdateOne($data, $w); // start 写操作日志 $log = array('logtype' => 72, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip()); $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[编辑]广告位" . $adname; $model->admin_syslog($log); // end 日志 $result['result'] = 'SUCCESS'; } if ($result['result'] == 'SUCCESS') { $file = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/temp.txt'; $fp = fopen($file, 'w'); fwrite($fp, '1'); fclose($fp); } return $result; } }
/** * ajax提交 */ public function loginAction() { $ispost = reqnum('ispost', 0); if ($ispost == 1) { $curcode = reqnum('code'); $beforcode = XSession::Get("AdminLoginVcode"); if ($curcode != $beforcode) { MsgInfoConst::GetMsg(1006, $result); return $result; } $registerName = reqstr('username', ''); $password = reqstr('passwd', ''); $result = array('result' => 'ERROR'); if ($registerName == '' || $password == '') { MsgInfoConst::GetMsg(1000, $result); return $result; } $memModel = new Psys_AdminUserModel(); $userone = $memModel->Login($registerName, $password, $result); return $result; } $this->forward = "login"; }
public function tasksAction() { $appkey = reqstr('appkey', ''); $username = reqstr('username', ''); $taskid = reqstr('taskid', ''); $indate = reqstr('indate', 0); $todate = reqstr('todate', 0); $where = '1=1 '; if (!empty($appkey)) { $where .= " and appkey='" . $appkey . "'"; } if (!empty($taskid)) { $where .= ' and taskid=' . $taskid; } if (!empty($username)) { $where .= " and username='******'"; } if ($todate > 0) { $where .= ' and ctime > ' . strtotime($indate); } if ($indate > 0) { $where .= ' and ctime <= ' . strtotime($todate); } $page = reqnum("page", 1); $pagesize = reqnum("pagesize", 10); $applist = array('61' => '开心消消乐', '49' => '消灭星星2015', '47' => '萌宠泡泡龙', '68' => '凤凰视频', '69' => '哪吒看书', '70' => '微看点'); $m = new Psys_UserModel(); $list = $m->GetList($where, 'id DESC', $page, $pagesize, "*", 'rhi_usertask'); foreach ($list['allrow'] as $key => &$var) { MsgInfoConst::GetAppKey($var['appkey'], $err); $var['appkey'] = $err['msg']; $var['taskid'] = $applist[$var['taskid']]; } $s_arr = $arr_xip_fw[$appkey]; self::inidate($list['allnum'], $page, $pagesize, count($list['allrow'])); $this->smarty->assign('appkeys', MsgInfoConst::$appkey_arr); //站点列表 $this->smarty->assign('tasks', $applist); //站点列表 $this->smarty->assign('list', $list['allrow']); $this->smarty->assign('psys_base_url', PSYS_BASE_URL); $this->forward = "tasks"; }
public function run($prj = '') { $mod = ''; $act = ''; UrlParse($prj, $mod, $act); $isnologinerr = false; global $G_X; $noyz = @$G_X['allow_project'][$prj]['nologin'][$mod]; if (!is_array($noyz)) { $noyz = array(); } $actstr = $act == '' ? 'index' : $act; $actstr .= "Action"; //echo $G_X['modstr']."<br />"; $session = XSession::Get("TA_user"); //开发阶段取消验证 //if(!in_array($act, $noyz)) if (!in_array($act, $noyz)) { //进行权限校验 $session = XSession::Get("TA_user"); if ($session) { $app_array = $session['app_array']; $session['app_array'] = $app_array == 'All' ? 'All' : eval("return {$app_array};"); if ($session['app_array'] != 'All') { $session['app_array'] = array_merge($session['app_array'], $G_X["allow_project"][$prj]["filter"]); } } if ($session == null) { if ($mod == 'admin') { header("Location:" . PUC_BASE_URL . "admin/login"); return; } if ($prj == 'psys') { header("Location:" . PSYS_BASE_URL . "index/login"); return; } if (empty($prj)) { $prj = "pweb"; } $mod = "index"; $act = "index"; $isnologinerr = true; } elseif (!ckAccess($session['app_array'], $prj, $mod, $act, $G_X['all_privilege']['url'])) { if (substr($actstr, 0, 4) == "ajax" || req("ajax")) { exit(json_encode(array('result' => 'ERROR', 'msg' => MsgInfoConst::GetMsg(2004, 'en'), 'msgcode' => 2004))); } echo "<script>window.location.href='/jump/index?type=errors&message=privilege';</script>"; return; } } $G_X['modstr'] = $mod; $G_X['actstr'] = $act; $G_X['prjstr'] = $prj; $actstr = $act . "Action"; $modstr = $mod . "Controller"; $file = constant(strtoupper($prj) . "_PATH") . "controller" . DIRECTORY_SEPARATOR . $modstr . ".php"; if (file_exists($file)) { require_once $file; } else { header('HTTP/1.1 404 Not Found'); //header("status: 404 Not Found"); exit; //print_r($G_X); //exit("文件不存在---->".$file); } $modobj = new $modstr(); if ($modobj->isajax) { //判断访问为ajax请求 try { if ($isnologinerr) { $return = array('result' => 'ERROR', 'msg' => MsgInfoConst::GetMsg(2005, $modobj->culture), 'msgcode' => 2005); } else { $return = $modobj->{$actstr}(); } } catch (Exception $e) { $return['result'] = 'ERROR'; //SUCCESS表示成功 $return['msg'] = $e->getMessage(); } header('Content-type: application/json'); exit(json_encode($return)); } else { try { $modobj->{$actstr}(); } catch (Exception $e) { exit($e->getMessage()); } } if (in_array($modobj->forward, array("msg", "msg_nologin", "ajaxmsg"))) { $modobj->smarty->display($modobj->forward . ".html"); } else { $html = $mod . DIRECTORY_SEPARATOR . $modobj->forward . ".html"; $modobj->smarty->display($html); } }
/** * 添加 */ public function addAction() { $traintype = array('K' => '快速', 'Z' => '直达特快', '' => '其他', 'T' => '空调特快', 'D' => '动车组', 'G' => '高速动车'); $id = reqnum('id', 0); $ispost = reqnum('ispost', 0); $trainModel = new Psys_TrainModel(); $one = array(); if ($ispost == 1) { $rtn = array('result' => 'ERROR'); $one['trainno'] = reqstr('checi', ''); if ($one['trainno'] == '') { MsgInfoConst::GetMsg(2001, $rtn); return $rtn; } else { $one['trainno'] = str_ireplace("/", ",", trim($one['trainno'], ',')); $one['trainno'] = ',' . $one['trainno'] . ','; } $one['traintype'] = reqstr('leixin', ''); $one['bstation'] = reqstr('b_station', ''); $one['btime'] = str_ireplace(':', ':', reqstr('btime_station', '')); $one['estation'] = reqstr('e_station', ''); $one['etime'] = str_ireplace(':', ':', reqstr('etime_station', '')); $one['runtime'] = str_ireplace(':', ':', reqstr('runtime', '')); $one['price'] = reqstr('price', ''); $one['mileage'] = reqstr('mileage', ''); if ($id > 0) { $w = array('id' => $id); $res = $trainModel->UpdateOne($one, $w); $m = new Psys_ResModel(); $m->Record($one, $res, 'db-rht_sync', 'trainno', 'rhs_downsync'); } else { $res = $trainModel->AddOne($one); $m = new Psys_ResModel(); $m->Record($one, $res, 'db-rht_sync', 'trainno', 'rhs_downsync'); } $rtn['result'] = 'SUCCESS'; MsgInfoConst::GetMsg(2002, $rtn); return $rtn; } else { $one['trainno'] = ''; $one['traintype'] = ''; $one['bstation'] = ''; $one['btime'] = ''; $one['estation'] = ''; $one['etime'] = ''; $one['runtime'] = ''; $one['price'] = ''; $one['mileage'] = ''; } if ($id > 0) { $one = $trainModel->GetOne(array('id' => $id)); if (!$one) { $id = 0; } else { $one['trainno'] = str_ireplace(",", "/", trim($one['trainno'], ',')); } } $this->smarty->assign('one', $one); $this->smarty->assign('id', $id); $this->smarty->assign('traintype', $traintype); $this->forward = "add"; }