public function index()
 {
     header('Content-Type:text/html;charset=utf-8');
     require './home/Lib/Action/Public.php';
     $g = M('goods');
     //产品中心
     $n = M('News');
     //新闻表中的产品知识
     $dz_goods = checkTrip($g->where('goods_dz > 0')->order('goods_addtime desc')->limit(0, 6)->select());
     $new_goods = checkTrip($g->order('goods_addtime desc')->limit(0, 6)->select());
     $zs = checkTrip($n->where('news_class = "产品知识"')->order('add_time desc')->having('sh = 1')->limit(10)->select());
     foreach ($new_goods as $key => $val) {
         //最新商品图片随机显
         $arr = explode('-', $val['goods_pics']);
         $c = count($arr) - 2;
         $new_goods[$key]['goods_pics'] = $arr[rand(0, $c)];
     }
     foreach ($dz_goods as $key => $val) {
         //打折商品图片随机显
         $arr = explode('-', $val['goods_pics']);
         $c = count($arr) - 2;
         $dz_goods[$key]['goods_pics'] = $arr[rand(0, $c)];
     }
     $this->assign(array('dzgoods' => $dz_goods, 'newgoods' => $new_goods, 'zs' => $zs));
     $this->display();
 }
 public function showGoods()
 {
     header('Content-Type:text/html;charset=utf-8');
     require './home/Lib/Action/Public.php';
     $g = M('goods');
     //产品中心
     $gid = intval($_GET['gid']);
     $goods = checkTrip($g->where('id=' . $gid)->find());
     $this->assign(array('goods' => $goods));
     $this->display();
 }
 public function index()
 {
     header('Content-Type:text/html;charset=utf-8');
     require './home/Lib/Action/Public.php';
     $j = M('job');
     //招聘
     import("ORG.Util.Page");
     // 导入分页类
     $count = $j->count();
     $page = new Page($count, 6);
     $show = $page->show();
     $job = checkTrip($j->order('add_time desc')->limit($page->firstRow . ',' . $page->listRows)->select());
     $this->assign(array('job' => $job, 'page' => $show));
     $this->display();
 }
 public function readMsg()
 {
     header('Content-Type:text/html;charset=utf-8');
     load('extend');
     // 导入扩展函数(对中文字符串的截取,过滤htm
     $m = M('msgs');
     $mid = isset($_GET['mid']) ? intval($_GET['mid']) : 1;
     $list = checkTrip($m->where('m_id=' . $mid)->find());
     $this->assign('list', $list);
     if ($list['isread'] != 1) {
         $data['m_status'] = 1;
         $m->where('m_id=' . $mid)->save($data);
         //更新为已读
     }
     $this->display();
 }
Example #5
0
 public function index()
 {
     header('Content-Type:text/html;charset=utf-8');
     require './home/Lib/Action/Public.php';
     $u = M('person');
     $sname = $_SESSION['username'];
     // $username=$u->field('username,receiver,address,phonenumber')->where('username="******"')->select();
     $userinfo = checkTrip($u->field(array('username', 'password', 'email', 'phonenumber', 'createtime'))->where('username="******"')->select());
     // $this->assign(
     // 	"userlist",array(
     // 		'username'=>$username,
     // ));
     $this->assign(array('userinfo' => $userinfo));
     // '$username',array('username'=>'$username')
     // $this->assign('list',array('one'=>'a','two'=>'b'));
     $this->display();
 }
Example #6
0
 public function index()
 {
     header('Content-Type:text/html;charset=utf-8');
     session_start();
     if (!isset($_SESSION['name'])) {
         $path = explode('/', __URL__, -1);
         $path = join('/', $path);
         header('Location:' . $path . '/login');
     } else {
         //如果登录成功,则更新登录次数及更新时间
         $user = M('user');
         $list = checkTrip($user->field(array('loginnums', 'logintime'))->find());
         if (!isset($_SESSION['isloginnums'])) {
             $data['loginnums'] = $list['loginnums'] + 1;
             $data['logintime'] = time();
             $user->where('id=1')->save($data);
         }
         $_SESSION['isloginnums'] = true;
         $this->display();
     }
 }
Example #7
0
 public function shownews()
 {
     header('Content-Type:text/html;charset=utf-8');
     $id = $_GET['nid'] + 0;
     if ($id <= 0) {
         exit('非法操作');
     }
     require './home/Lib/Action/Public.php';
     $n = M('News');
     //新闻中心
     $news = checkTrip($n->where('id=' . $id)->find());
     if (empty($news)) {
         exit('没有找到数据');
     }
     //更新访问量
     session_start();
     $ip = $_SERVER['REMOTE_ADDR'];
     $_SESSION['ok'] = true;
     $djs = checkTrip($n->field('news_djs')->where('id=' . $id)->find());
     $data['news_djs'] = $djs['news_djs'] + 1;
     $n->where('id=' . $id)->save($data);
     $this->assign(array('news' => $news));
     $this->display();
 }
 public function addData()
 {
     header('Content-Type:text/html;charset=utf-8');
     $l = M('link');
     $_POST['l_overtime'] = strtotime($_POST['l_overtime']);
     //将日期格式化时间戳
     if (isset($_FILES['l_logo'])) {
         //文件上传配置
         import('ORG.Net.uploadFile');
         $upload = new UploadFile();
         // 实例化上传类
         $upload->maxSize = 1000000;
         // 设置附件上传大小
         $upload->allowExts = array('jpg', 'gif', 'png', 'jpeg');
         // 设置附件上传类型
         $upload->allowTypes = array('image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/gif');
         $upload->savePath = './Public/Uploads/links/';
         // 设置附件上传目录
         $upload->saveRule = 'uniqid';
         //缩略图配置
         $upload->thumb = true;
         $upload->thumbMaxWidth = '160';
         $upload->thumbMaxHeight = '60';
         $upload->thumbPrefix = 's_';
         $upload->thumbRemoveOrigin = true;
         //开始上传
         if (!$upload->upload()) {
             $this->error($upload->getErrorMsg());
         } else {
             $info = $upload->getUploadFileInfo();
         }
         $_POST['l_logo'] = $info[0]['savename'];
         //判断用户在添加还是在修改(在已选择文件域的情况下)
         if (isset($_POST['act']) && $_POST['act'] == 'edit') {
             //修改
             $data = $_POST;
             //取出原图片名称,进行删除
             $id = isset($_POST['id']) ? intval($_POST['id']) : 0;
             $list = checkTrip($l->where('id=' . $id)->field('l_logo')->find());
             $oldPic = './Public/Uploads/links/s_' . $list['l_logo'];
             unset($data['l_time']);
             if ($l->where('id=' . $id)->save($data)) {
                 $this->success('更新成功');
                 unlink($oldPic);
             } else {
                 $this->error('更新失败');
             }
         } else {
             //添加
             if ($l->create()) {
                 if ($l->add()) {
                     $this->success('保存成功');
                 } else {
                     $this->error('保存失败');
                 }
             } else {
                 $this->error();
             }
         }
     } else {
         //没有选择LOGO的情况下修改文字
         $data = $_POST;
         $id = isset($_POST['id']) ? intval($_POST['id']) : 0;
         unset($data['l_time']);
         unset($data['l_logo']);
         if ($l->where('id=' . $id)->save($data)) {
             $this->success('更新成功');
         } else {
             $this->error('更新失败');
         }
     }
 }
 private function PublicCode($field, $tmp)
 {
     header('Content-Type:text/html;charset=utf-8');
     $gs = M('company');
     $list = checkTrip($gs->order('id')->find());
     if (empty($list)) {
         echo '<script>alert("请先完成 \'公司的基本设置\' 再添加相册");location.href="./index.php"</script>';
         echo '请先完成 <font style="font-weight:900; color:blue"><A href="./index.php">公司的基本设置</a></font> 再添加相册';
     } else {
         $pics = $list[$field];
         $this->assign('pics', $pics);
         $this->display($tmp);
     }
 }
Example #10
0
 public function editQq()
 {
     header('Content-Type:text/html;charset=utf-8');
     $q = M('qq');
     $qqs = checkTrip($q->find());
     $q->create();
     if (empty($qqs)) {
         if ($q->add()) {
             $this->success('添加成功');
         } else {
             $this->error('没有数据被影响');
         }
     } else {
         if ($q->where('id=1')->save()) {
             $this->success('更新成功');
         } else {
             $this->success('没有数据被影响');
         }
     }
 }
Example #11
0
<?php

require 'init.inc.php';
$c = M('config');
//网站配置
$l = M('cate');
//网站栏目
$a = M('link');
//友情链接
$gs = M('Company');
//公司配置
$q = M('qq');
//客服QQ
//公共查询
$config = checkTrip($c->find());
$cate = checkTrip($l->order('px asc')->select());
$link = checkTrip($a->where('l_status=1')->select());
$company = checkTrip($gs->find());
$qq = checkTrip($q->find());
//分配变量
$this->assign(array('config' => $config, 'cate' => $cate, 'link' => $link, 'company' => $company, 'qq' => $qq));
Example #12
0
 public function fb()
 {
     $n = M('news');
     $id = $_POST['id'];
     $list = checkTrip($n->field('sh')->where('id=' . $id)->find());
     $data['sh'] = $list['sh'] == 0 ? 1 : 0;
     $n->where('id=' . $id)->save($data);
 }
Example #13
0
 public function classList()
 {
     header('Content-Type:text/html;charset=utf-8');
     $c = D('goodsClass');
     $list = checkTrip($c->field('id,name,pid,path,concat(path,"-",id) as bpath')->order('bpath')->select());
     if (!empty($list)) {
         foreach ($list as $key => $val) {
             $list[$key]['count'] = count(explode('-', $val['path']));
         }
     }
     $this->assign('list', $list);
     $this->display();
 }
Example #14
0
 public function index()
 {
     header('Content-Type:text/html;charset=utf-8');
     /*分页及扩展配置*/
     load('extend');
     // 导入扩展函数(对中文字符串的截取)
     import("ORG.Util.Page");
     // 导入分页类
     $order_table = M('order');
     $count = $order_table->count();
     $page = new Page($count, 12);
     $show = $page->show();
     //条件筛选
     // if (!isset($_GET['search'])){
     // 	$list = checkTrip($order_table->order('order_time desc')->limit($page->firstRow.','.$page->listRows)->select());
     // }else{
     // 	$sql = '';
     // 	$get = $_GET;
     // 	//栏目的筛选
     // 	if (isset($_GET['search_class'])){
     // 		$class = $_GET['search_class'];
     // 		if ($class !=''){
     // 			$sql .= 'goods_class = "'.$class.'" ';
     // 		}
     // 	}
     // 	//打折与未打折的筛选
     // 	if (isset($_GET['search_bzb'])){
     // 		$val = $_GET['search_bzb'];
     // 		if ($val!='all'){
     // 			$and = empty($sql) ? '' : 'and';
     // 			$sql .= ($val==10) ? $and.' goods_dz > 1'  : $and.' goods_dz = '.$val;
     // 		}
     // 	}
     // 	//筛选商品名称、货号
     // 	if ($_GET['key'] != ''){
     // 		$v = $_GET['key'];
     // 		$field = $_GET['namenum'];
     // 		$ha = $field.' like "%'.$v.'%"';
     // 	}
     // 	//排序
     // 	if (isset($_GET['order'])){
     // 		$ziduan = $_GET['order'];
     // 		$px = $_GET['px'];
     // 		$order = $ziduan.' '.$px;
     // 	}
     // 	$sql = !($sql) ? 1 : $sql;
     // 	$ha = !($ha) ? 1 : $ha;
     // 	$c = count($g->where($sql)->having($ha)->order($order)->select());
     // 	$page = new Page($c,12);
     // 	foreach ($get as $k2=>$v2){
     // 		if ($get[$k2] === '') unset($get[$k2]);
     // 	}
     // 	foreach ($get as $k3=>$v3){
     // 		$page->parameter .= "$k3=".urlencode($v3)."&";
     // 	}
     $list = checkTrip($order_table->limit($page->firstRow . ',' . $page->listRows)->select());
     $show = $page->show();
     //关键字描红
     // foreach($list as $key=>$val){
     // 	 $val[$field] = str_replace($v,'<b>'.$v.'</b>',$val[$field]);
     // 	 $list[$key][$field] = $val[$field];
     // }
     //}
     $this->assign(array('list' => $list, 'page' => $show));
     $this->display();
 }
 public function delCate()
 {
     header('Content-Type:text/html;charset=utf-8');
     $id = $_GET['id'] + 0;
     if (!$id) {
         return '请按正常流程操作';
     }
     $c = M('cate');
     $list = checkTrip($c->where('id=' . $id)->field('lmlogo')->find());
     $oldPic = './Public/Uploads/lmlogo/' . $list['lmlogo'];
     if ($c->where('id=' . $id)->delete()) {
         echo '<script>alert("删除成功");location.href="' . __URL__ . '"</script>';
         unlink($oldPic);
     } else {
         echo '<script>alert("删除失败");location.href="' + __URL__ + '"</script>';
     }
 }
Example #16
0
<?php

session_start();
$userId = $_SESSION['user_Id'];
include '../db-connection.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $trip_id = $_POST['trip_id'];
    try {
        if (checkTrip($db, $userId, $trip_id)->fetch() != null) {
            $stmt = $db->prepare("DELETE t.* , c.* from trips t INNER JOIN comments c on t.trip_id = c.trip_id and t.trip_id = :trip_id");
            $stmt->execute(array(':trip_id' => $trip_id));
            echo "trip_deleted";
        } else {
            echo "cannot_deleted";
        }
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
}
function checkTrip($db, $userId, $trip_id)
{
    $stmt = $db->prepare("SELECT * FROM trips WHERE user_id=:user_id AND trip_id=:trip_id");
    $stmt->execute(array(":user_id" => $userId, ':trip_id' => $trip_id));
    return $stmt;
}