function shoppingsn($data = array())
 {
     $rt = $this->App->find("SELECT * FROM `{$this->App->prefix()}shipping_name`");
     $this->set('rt', $rt);
     //分页
     $page = isset($_GET['page']) ? $_GET['page'] : 1;
     if (empty($page)) {
         $page = 1;
     }
     $list = 20;
     $start = ($page - 1) * $list;
     $comd = array();
     $w = "";
     if (isset($_GET['sid']) && $_GET['sid'] > 0) {
         $comd[] = "tb1.shipping_id = '" . intval($_GET['sid']) . "'";
     }
     if (isset($_GET['keyword']) && !empty($_GET['keyword'])) {
         $comd[] = "tb1.shipping_sn LIKE '%" . trim($_GET['keyword']) . "%'";
     }
     if (!empty($comd)) {
         $w = "WHERE " . implode(' AND ', $comd);
     }
     $sql = "SELECT COUNT(tb1.id) FROM `{$this->App->prefix()}shipping_sn` AS tb1 LEFT JOIN `{$this->App->prefix()}shipping_name` AS tb2 ON tb1.shipping_id = tb2.shipping_id {$w}";
     $tt = $this->App->findvar($sql);
     $rts['pages'] = Import::basic()->getpage($tt, $list, $page, '?page=', true);
     $sql = "SELECT tb1.*,tb2.shipping_name FROM `{$this->App->prefix()}shipping_sn` AS tb1 LEFT JOIN `{$this->App->prefix()}shipping_name` AS tb2 ON tb1.shipping_id = tb2.shipping_id {$w} ORDER BY tb1.id DESC LIMIT {$start},{$list}";
     $rts['lists'] = $this->App->find($sql);
     $this->set('rts', $rts);
     $this->template('shoppingsn');
 }
Exemple #2
0
 function connect($params = array())
 {
     if (!isset($this->status)) {
         $obj = new Ecshop_smtp($params);
         if ($obj->connect()) {
             $obj->status = SMTP_STATUS_CONNECTED;
         }
         return $obj;
     } else {
         if (!empty($GLOBALS['LANG']['smtp_ssl'])) {
             $this->host = "ssl://" . $this->host;
         }
         $this->connection = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);
         if ($this->connection === false) {
             $this->errors[] = 'Access is denied.';
             return false;
         }
         @socket_set_timeout($this->connection, 0, 250000);
         $greeting = $this->get_data();
         if (is_resource($this->connection)) {
             $this->status = 2;
             return $this->auth ? $this->ehlo() : $this->helo();
         } else {
             Import::basic()->log_write($errstr, __FILE__, __LINE__);
             //记录错误信息
             $this->errors[] = 'Failed to connect to server: ' . $errstr;
             return false;
         }
     }
 }
 function ajax_select_goods($maxattr = 0, $page = 1)
 {
     $cid = isset($_COOKIE['GZ_cid']) ? $_COOKIE['GZ_cid'] : 0;
     $subcid = array();
     if ($cid > 0) {
         $subcid = $this->action('catalog', 'get_goods_sub_cat_ids', $cid);
     }
     //分类
     ///
     isset($_COOKIE['GZ_bid']) && intval($_COOKIE['GZ_bid']) > 0 ? $comd[] = "b.brand_id = '" . intval($_COOKIE['GZ_bid']) . "'" : 0;
     //品牌
     if ($maxattr > 0) {
         for ($i = 0; $i < $maxattr; $i++) {
             isset($_COOKIE['GZ_' . $i]) && !empty($_COOKIE['GZ_' . $i]) ? $comd[] = "ga.attr_value = '" . $_COOKIE['GZ_' . $i] . "'" : 0;
             //属性
         }
     }
     if (!empty($subcid)) {
         $comd[] = "gc.cat_id " . db_create_in($subcid);
     }
     $w = !empty($comd) ? " WHERE " . implode(' AND ', $comd) : "";
     $tt = $this->__get_user_goods_select_count($w);
     $rt['count'] = $tt;
     $list = 12;
     $rt['goodslist'] = $this->__get_user_goods_select($w, $page, $list);
     $rt['goodspage'] = Import::basic()->ajax_page($tt, $list, $page, 'get_select_goods_page');
     $this->set('rt', $rt);
     $con = $this->fetch('ajax_user_goods_select', true);
     die($con);
 }
 function index($page = 1)
 {
     $rt = $this->Cache->read(3600);
     if (is_null($rt)) {
         if (!isset($_GET['type'])) {
             //推荐商品
             $rt['tuijian'] = $this->tuijian_goods(10);
             //热卖前10个商品
             $rt['top10'] = $this->action('catalog', 'top10', 0, 5);
             //全站banner
             $rt['quanzhan'] = $this->action('banner', 'quanzhan');
             //热门评论商品
             $sql = "SELECT g.goods_id,g.goods_name,g.market_price,g.shop_price,g.promote_price,g.goods_thumb,g.promote_start_date, g.promote_end_date,g.is_promote,g.sale_count,COUNT(c.comment_id) AS comment_count FROM `{$this->App->prefix()}goods` AS g LEFT JOIN `{$this->App->prefix()}comment` AS c ON g.goods_id=c.id_value WHERE c.status = '1' AND (g.goods_id IS NOT NULL AND g.goods_id!='') GROUP BY c.id_value ORDER BY comment_count DESC LIMIT 4";
             $hotcommentgoods = $this->App->find($sql);
             $rt['hotcommentgoods'] = array();
             if (!empty($hotcommentgoods)) {
                 foreach ($hotcommentgoods as $k => $row) {
                     $rt['hotcommentgoods'][$k] = $row;
                     $rt['hotcommentgoods'][$k]['goods_thumb'] = SITE_URL . $row['goods_thumb'];
                     $rt['hotcommentgoods'][$k]['goods_img'] = SITE_URL . $row['goods_img'];
                     $rt['hotcommentgoods'][$k]['url'] = get_url($row['goods_name'], $row['goods_id'], SITE_URL . 'product.php?id=' . $row['goods_id'], 'goods', array('product', 'index', $row['goods_id']));
                     if ($row['is_promote'] == '1') {
                         //促销 价格
                         if ($row['promote_start_date'] < mktime() && $row['promote_end_date'] > mktime()) {
                             $row['promote_price'] = format_price($row['promote_price']);
                         } else {
                             $row['promote_price'] = "0.00";
                         }
                     } else {
                         $row['promote_price'] = "0.00";
                     }
                     $rt['hotcommentgoods'][$k]['promote_price'] = $row['promote_price'];
                 }
                 unset($hotcommentgoods);
             }
         }
         $list = 15;
         $page = !$page ? 1 : $page;
         $start = ($page - 1) * $list;
         $tt = $this->action('product', 'get_comment_count');
         $rt['pagelink'] = Import::basic()->gethtmlpage($tt, $list, $page, SITE_URL . 'comment/p%d/');
         $rt['commentlist'] = $this->action('product', 'get_comment_list', 0, $start, $list);
         $this->Cache->write($rt);
     }
     $this->set('rt', $rt);
     if (isset($_GET['type']) && $_GET['type'] == 'ajax') {
         echo $this->fetch('ajax_jifen_goods', true);
         exit;
     }
     //设置页面meta
     $title = '评论中心-用户评论';
     $this->title($title . ' - ' . $GLOBALS['LANG']['site_name']);
     $this->meta("title", $title);
     $this->meta("keywords", $title);
     $this->meta("description", $title);
     $this->template('comment_index');
 }
 function find_password($rt = array())
 {
     $datanew['name'] = '亲爱的' . $rt['user_name'];
     $datanew['email'] = $rt['email'];
     $datanew['subject'] = '密码找回,请查收!';
     $this->set('rt', $rt);
     $datanew['content'] = $this->fetch('email_tpl/find_password', true);
     $datanew['type'] = 1;
     $datanew['notification'] = false;
     Import::basic()->ecshop_sendemail($datanew);
     unset($datanew);
 }
 function index($page = 1, $type = "")
 {
     $rt = $this->Cache->read(3600);
     if (is_null($rt)) {
         $rt['tuijian'] = $this->tuijian_goods(5);
         $list = 20;
         //$page = (!isset($_GET['page']) || intval($_GET['page'])<1) ? 1 : intval($_GET['page']);
         $page = empty($page) || !($page > 0) ? 1 : $page;
         $start = ($page - 1) * $list;
         $tt = $this->App->findvar("SELECT COUNT(goods_id) FROM `{$this->App->prefix()}goods` WHERE is_on_sale='1' AND is_alone_sale='1' AND is_jifen='1'");
         $rt['jifengoodspage'] = Import::basic()->ajax_page($tt, $list, $page, 'get_jifen_page');
         //分页
         $sql = "SELECT goods_id,goods_name,market_price,shop_price,promote_price,goods_thumb,goods_img,is_jifen,need_jifen FROM `{$this->App->prefix()}goods` WHERE is_on_sale='1' AND is_alone_sale='1' AND is_jifen='1' ORDER BY sort_order ASC, goods_id DESC LIMIT {$start},{$list}";
         $jifengoods = $this->App->find($sql);
         $rt['jifengoods'] = array();
         if (!empty($jifengoods)) {
             foreach ($jifengoods as $k => $row) {
                 $rt['jifengoods'][$k] = $row;
                 $rt['jifengoods'][$k]['goods_thumb'] = SITE_URL . $row['goods_thumb'];
                 $rt['jifengoods'][$k]['goods_img'] = SITE_URL . $row['goods_img'];
                 $rt['jifengoods'][$k]['url'] = get_url($row['goods_name'], $row['goods_id'], 'product.php?id=' . $row['goods_id'], 'goods', array('product', 'index', $row['goods_id']));
             }
             unset($jifengoods);
         }
         //不是AJAX请求
         if (empty($_GET['type'])) {
             $sql = "SELECT a.article_id,a.article_title,a.article_img,a.content FROM `{$this->App->prefix()}article` AS a LEFT JOIN `{$this->App->prefix()}article_cate` AS ac ON a.cat_id=ac.cat_id WHERE ac.type='customer'";
             $this->App->fieldkey('article_id');
             $rt['jifenart'] = $this->App->find($sql);
             //积分换取banner
             $rt['jifenbanner'] = $this->action('banner', 'index_hot_banner', '积分换取');
             //积分换取banner
             $rt['jifenyoubanner'] = $this->action('banner', 'index_hot_banner', '积分右侧');
         }
         $this->Cache->write($rt);
     }
     $this->set('rt', $rt);
     if (!empty($_GET['type']) && $_GET['type'] == 'ajax') {
         echo $this->fetch('ajax_jifen_goods', true);
         //ajax请求
         exit;
     }
     //设置页面meta
     $title = '积分换取、积分获得、礼品相送';
     $this->title($title . ' - ' . $GLOBALS['LANG']['site_name']);
     $this->meta("title", $title);
     //$this->meta("keywords",htmlspecialchars($rt['goodsinfo']['meta_keys']));
     //$this->meta("description",htmlspecialchars($rt['goodsinfo']['meta_desc']));
     $this->template('jifen_index');
 }
 function add_edit($type = 'add', $id = 0)
 {
     $rt = array();
     if ($type == 'edit') {
         if (empty($id) || !Import::basic()->int_preg($id)) {
             $this->jump('friendlink.php?type=list');
             exit;
         }
         $sql = "SELECT * FROM `{$this->App->prefix()}friend_link` WHERE link_id='{$id}'";
         $rt = $this->App->findrow($sql);
     }
     $this->set('rt', $rt);
     $this->set('type', $type);
     $this->template('friendlink_edit');
 }
 function index()
 {
     //分页
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     if (empty($page)) {
         $page = 1;
     }
     $list = 10;
     $start = ($page - 1) * $list;
     $sql = "SELECT COUNT(group_id) FROM `{$this->App->prefix()}goods_groupbuy`";
     $tt = $this->App->findvar($sql);
     $pagelink = Import::basic()->getpage($tt, $list, $page, '?page=', true);
     $this->set("pagelink", $pagelink);
     $sql = "SELECT tb1.*,tb2.goods_name,tb2.is_delete,tb2.is_on_sale FROM `{$this->App->prefix()}goods_groupbuy` AS tb1 LEFT JOIN `{$this->App->prefix()}goods` AS tb2 ON tb1.goods_id=tb2.goods_id ORDER BY tb1.group_id DESC LIMIT {$start},{$list}";
     $this->set('rt', $this->App->find($sql));
     $this->template('groupbuy_index');
 }
 function index()
 {
     $id = isset($_GET['id']) && intval($_GET['id']) > 0 ? intval($_GET['id']) : 0;
     if ($id > 0) {
         //删除
         $sql = "SELECT * FROM `{$this->App->prefix()}topic` WHERE topic_id='{$id}'";
         $rows = $this->App->findrow($sql);
         if (empty($rows)) {
             $this->jump(ADMIN_URL . 'topic.php?type=list');
             exit;
         }
         $topic_img = SYS_PATH . $rows['topic_img'];
         $topic_flash = SYS_PATH . $rows['topic_flash '];
         if (file_exists($topic_img) && is_file($topic_img)) {
             Import::fileop()->delete_file($topic_img);
         }
         if (file_exists($topic_flash) && is_file($topic_img)) {
             Import::fileop()->delete_file($topic_flash);
         }
         //删除数据库内容
         $this->App->delete('topic', 'topic_id', $id);
         $this->jump(ADMIN_URL . 'topic.php?type=list');
         exit;
     }
     //分页
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     if (empty($page)) {
         $page = 1;
     }
     $start = ($page - 1) * $list;
     $list = 10;
     $sql = "SELECT COUNT(topic_id) FROM `{$this->App->prefix()}topic`";
     $tt = $this->App->findvar($sql);
     $pagelink = Import::basic()->getpage($tt, $list, $page, '?page=', true);
     $this->set("pagelink", $pagelink);
     $sql = "SELECT * FROM `{$this->App->prefix()}topic` ORDER BY topic_id DESC LIMIT {$start},{$list}";
     $rt = $this->App->find($sql);
     $this->set('rt', $rt);
     $this->template('topiclist');
 }
    if (empty($value)) {
        return $value;
    } else {
        return is_array($value) ? array_map('addslashes_deep', $value) : addslashes($value);
    }
}
/* 对用户传入的变量进行转义操作。*/
if (!get_magic_quotes_gpc()) {
    if (!empty($_GET)) {
        $_GET = addslashes_deep($_GET);
    }
    if (!empty($_POST)) {
        $_POST = addslashes_deep($_POST);
    }
    $_COOKIE = addslashes_deep($_COOKIE);
    $_REQUEST = addslashes_deep($_REQUEST);
}
/*if(in_array($_SERVER['HTTP_HOST'],array('127.0.0.1','127.0.0.1:8080','localhost','localhost:8080','192.168.1.189:8080'))){
    define('SITE_URL', 'http://'.$_SERVER['HTTP_HOST'].'/chaoshi/');
}else{
    define('SITE_URL', Import::basic()->siteurl());
} 
define('SITE_JS', SITE_URL.'js/');

$re = Import::route(); //入口
*/
define('SITE_URL', Import::basic()->siteurl());
//标识:相对网站根目录链接
define('ROOT_URL', SITE_URL);
//标识:运行根目录链接
$re = Import::route();
Exemple #11
0
 function ajax_user_mymoney()
 {
     $page = isset($_POST['page']) && intval($_POST['page']) > 0 ? intval($_POST['page']) : 1;
     if (empty($page)) {
         $page = 1;
     }
     $uid = $_POST['uid'];
     $list = 5;
     //每页显示多少个
     $start = ($page - 1) * $list;
     $tt = $this->App->findvar("SELECT COUNT(cid) FROM `{$this->App->prefix()}user_money_change` WHERE uid='{$uid}'");
     $rt['usermoneypage'] = Import::basic()->ajax_page($tt, $list, $page, 'get_usermoney_page_list', array($uid));
     $sql = "SELECT * FROM `{$this->App->prefix()}user_money_change` WHERE uid='{$uid}' ORDER BY time DESC LIMIT {$start},{$list}";
     $rt['usermoneylist'] = $this->App->find($sql);
     $this->set('rt', $rt);
     echo $this->fetch('ajax_user_money', true);
     exit;
 }
				<div class="gehang">&nbsp;</div>
					  <div class="li_list" style="min-height:200px;">
						  <h4>相关文章</h4>
						  <ul>
						  <?php 
if (!empty($rt['rand_list']) && is_array($rt['rand_list'])) {
    foreach ($rt['rand_list'] as $row) {
        ?>
							  <li><a href="<?php 
        echo $row['url'];
        ?>
" title="<?php 
        echo $row['article_title'];
        ?>
"><?php 
        echo Import::basic()->wordcut($row['article_title'], 40);
        ?>
</a></li>
						  <?php 
    }
}
?>
						  </ul>
					  </div>
					  
					  <div class="gehang">&nbsp;</div>
					  <div class="li_list_goods li_list">
						  <h4>推荐商品</h4>
						  <?php 
if (!empty($rt['tuijian'])) {
    foreach ($rt['tuijian'] as $row) {
 function __category_goods_where($data = array())
 {
     if (empty($data)) {
         return "";
     }
     $cid = isset($data['cid']) && intval($data['cid']) > 0 ? intval($data['cid']) : 0;
     $bid = isset($data['bid']) && intval($data['bid']) > 0 ? intval($data['bid']) : 0;
     $price = isset($data['price']) ? $data['price'] : "";
     $keyword = isset($data['keyword']) ? $data['keyword'] : "";
     $comd[] = "g.is_on_sale = '1' AND g.is_delete = '0' AND g.is_alone_sale='1'";
     $bid > 0 ? $comd[] = "b.brand_id='{$bid}'" : "";
     //品牌
     if (!empty($price)) {
         //价格
         $p_ar = @explode('-', $price);
         if (count($p_ar) == 2) {
             if (empty($p_ar[1])) {
                 $p_ar[1] = 10000;
             }
             sort($p_ar);
             $price1 = intval(trim($p_ar[0]));
             $price2 = intval(trim($p_ar[1]));
             if ($price1 >= 0 && $price2 > 0) {
                 $comd[] = "(g.pifa_price between {$price1} and {$price2})";
             }
         }
     }
     $subsql = "";
     if ($cid > 0) {
         //子分类
         $sub_cid = $this->get_goods_sub_cat_ids_model($cid);
         //子分类id
         $comd[] = "(g.cat_id" . db_create_in($sub_cid) . " OR csg.cat_id='{$cid}')";
     }
     if (!empty($keyword)) {
         $act = array('is_best', 'is_new', 'is_hot', 'is_promote', 'is_qianggou');
         if (in_array($keyword, $act)) {
             switch ($keyword) {
                 case 'is_best':
                     $comd[] = "g.is_best='1'";
                     break;
                 case 'is_new':
                     $comd[] = "g.is_new='1'";
                     break;
                 case 'is_hot':
                     $comd[] = "g.is_hot='1'";
                     break;
                 case 'is_promote':
                     $time = mktime();
                     //	$comd[] = "AND g.is_promote = '1' AND g.promote_start_date <= '$time' AND g.promote_end_date >= '$time'";   look注释
                     $comd[] = "g.is_promote = '1' AND g.promote_start_date <= '{$time}' AND g.promote_end_date >= '{$time}'";
                     // look添加
                     break;
                 case 'is_qianggou':
                     $time = mktime();
                     //	$comd[] = "AND g.is_qianggou = '1' AND g.qianggou_start_date <= '$time' AND g.qianggou_end_date >= '$time'";
                     $comd[] = "g.is_qianggou = '1' AND g.qianggou_start_date <= '{$time}' AND g.qianggou_end_date >= '{$time}'";
                     break;
             }
         } else {
             $comd[] = "(gc.cat_name LIKE '%{$keyword}%' OR g.goods_name LIKE '%{$keyword}%' OR g.goods_bianhao LIKE '%{$keyword}%')";
             if (!isset($data['count_where'])) {
                 //如果是通过搜索进来的,那么将关键字添加到数据库表中
                 $keyid = $this->findvar("SELECT key_id FROM `{$this->prefix()}stats_keywords` WHERE keyword='{$keyword}' LIMIT 1");
                 if (empty($keyid)) {
                     //插入
                     $dd = array();
                     $n = Import::basic()->Pinyin($keyword);
                     $dd['tag_n'] = !empty($n) ? ucwords(substr($n, 0, 1)) : "NAL";
                     $dd['keyword'] = $keyword;
                     $dd['date'] = date('Y-m-d', mktime());
                     $dd['count'] = 1;
                     $this->insert('stats_keywords', $dd);
                     unset($dd);
                 } else {
                     //数量增加1
                     $sd = "UPDATE `{$this->prefix()}stats_keywords` SET `date` = '" . date('Y-m-d', mktime()) . "',`count`=`count`+1 WHERE `key_id` = '{$keyid}' LIMIT 1";
                     $this->query($sd);
                 }
             }
         }
     }
     $w = "";
     if (!empty($comd)) {
         $w = "WHERE " . implode(' AND ', $comd);
     }
     return $w;
 }
 function ajax_getcategoodslist($w = array())
 {
     $err = 0;
     $json = Import::json();
     $result = array('error' => $err, 'message' => '');
     if (empty($w)) {
         $result['error'] = 2;
         $result['message'] = '传送的数据为空!';
         die($json->encode($result));
     }
     $wobj = $json->decode($w);
     //反json ,返回值为对象
     $page = $wobj->page;
     if (!$page) {
         $page = 1;
     }
     $cid = $wobj->cid;
     if (!$cid) {
         $cid = 0;
     }
     $bid = $wobj->bid;
     if (!$bid) {
         $bid = 0;
     }
     $price = $wobj->price;
     if (!$price) {
         $price = "";
     }
     $order_type = $wobj->order;
     if (!$order_type) {
         $order_type = "goods_id";
     }
     $keyword = $wobj->keyword;
     if (!$keyword) {
         $keyword = "";
     }
     $sort_type = $wobj->sorts;
     if (empty($sort_type)) {
         $sort_type = "DESC";
     }
     $list = $wobj->limit;
     if (!$list) {
         $list = 40;
     }
     if (!empty($keyword) && !(preg_match('/^.*$/u', $keyword) > 0)) {
         $keyword = Import::gz_iconv()->ec_iconv('GB2312', 'UTF8', $keyword);
         //编码转换
     }
     $rt['thiscid'] = $cid;
     $rt['thisbid'] = $bid;
     $rt['price'] = $price;
     $rt['page'] = $page;
     $rt['sort'] = $sort_type;
     $rt['order'] = $order_type;
     $rt['limit'] = $list;
     //当前分类的基本信息
     if ($cid > 0) {
         $sql = "SELECT * FROM `{$this->App->prefix()}goods_cate` WHERE cat_id='{$cid}' LIMIT 1";
         $rt['cateinfo'] = $this->App->findrow($sql);
     } else {
         $rt['cateinfo'] = array();
         //查找时没有cid
     }
     //品牌信息
     if ($bid > 0) {
         $sql = "SELECT brand_name FROM `{$this->App->prefix()}brand` WHERE brand_id='{$bid}' LIMIT 1";
         $rt['brandinfo']['brand_name'] = $this->App->findvar($sql);
     } else {
         $rt['brandinfo']['brand_name'] = "";
     }
     //显示方式
     if (!isset($_COOKIE['DISPLAY_TYPE']) || empty($_COOKIE['DISPLAY_TYPE']) || !in_array($_COOKIE['DISPLAY_TYPE'], array('list', 'text'))) {
         $rt['display'] = 'text';
     } else {
         $rt['display'] = $_COOKIE['DISPLAY_TYPE'];
     }
     //start 当前位置
     $rt['hear'] = array();
     $perend_id = 0;
     $hear[] = '<a href="' . SITE_URL . '">首页</a>';
     $hear[] = '<a href="' . get_url('商品中心', 0, SITE_URL . "costume.php", 'goodscate', array('catalog', 'index')) . '">商品中心</a>';
     if ($cid > 0) {
         $rts_ = $this->get_goods_parent_cats($cid);
         //父类ID
         $rts = Import::basic()->array_sort($rts_, 'cat_id');
         //根据cat_id排序
         if (!empty($rts)) {
             $perend_id = $rts[count($rts) - 1]['cat_id'];
             foreach ($rts as $rows) {
                 $hear[] = '<a href="' . get_url($rows['cat_name'], $rows['cat_id'], "costume.php?cid=" . $rows["cat_id"], 'goodscate', array('catalog', 'index', $row['cat_id'])) . '">' . $rows['cat_name'] . '</a>';
             }
         }
         unset($rts, $rts_);
     } elseif ($bid > 0) {
         //品牌
         $hear[] = '<a href="' . SITEURL . 'brand/">品牌中心</a>';
         $hear[] = '<a href="' . get_url($rt['brandinfo']['brand_name'], $rt['brandinfo']['brand_id'], "costume.php?bid=" . $rt['brandinfo']['brand_id'], 'brand') . '">' . $rt['brandinfo']['brand_name'] . '</a>';
     } elseif (!empty($keyword)) {
         $perend_id = -1;
         switch ($keyword) {
             case 'is_hot':
                 $hear[] = '<a href="' . SITE_URL . 'hotproduct/">热销商品</a>';
                 break;
             case 'is_new':
                 $hear[] = '<a href="' . SITE_URL . 'newproduct/">新商推荐</a>';
                 break;
             case 'is_best':
                 $hear[] = '<a href="' . SITE_URL . 'bestproduct/">精品推荐</a>';
                 break;
             case 'is_promote':
                 $hear[] = '<a href="' . SITE_URL . 'promote/">促销商品</a>';
                 break;
             default:
                 $hear[] = '<a href="javascript:;">商品查找</a>';
                 $hear[] = '<a href="' . SITE_URL . 'costume.php?keyword=' . $keyword . '">' . $keyword . '</a>';
                 break;
         }
     } elseif (!empty($price)) {
         $perend_id = -1;
         $hear[] = '<a href="javascript:;">价格商品</a>';
     } else {
         $perend_id = -1;
         $hear[] = '<a href="' . get_url('商品中心', 0, SITE_URL . "costume.php", 'goodscate', array('catalog', 'index')) . '">商品分类</a>';
     }
     if (!empty($hear)) {
         $rt['hear'] = implode('&nbsp;&gt;&nbsp;', $hear);
     } else {
         $rt['hear'] = "";
     }
     unset($hear);
     //end 当前位置
     //分类信息
     if (!empty($rt['cateinfo']['cat_name'])) {
         $rt['infoname'] = $pcat_name . $rt['cateinfo']['cat_name'];
     } elseif (!empty($rt['brandinfo']['brand_name'])) {
         $rt['infoname'] = $rt['brandinfo']['brand_name'];
     } elseif (!empty($keyword)) {
         switch ($keyword) {
             case 'is_hot':
                 $rt['infoname'] = "热销商品专区";
                 break;
             case 'is_new':
                 $rt['infoname'] = "新品推荐";
                 break;
             case 'is_best':
                 $rt['infoname'] = "精品推荐";
                 $rt['cateinfo']['cat_title'] = "精选商品-%100满意";
                 break;
             case 'is_promote':
                 $rt['infoname'] = "促销商品专区";
                 break;
             default:
                 $rt['infoname'] = "商品搜索中心:" . $keyword;
                 break;
         }
     } elseif (!empty($price)) {
         $rt['infoname'] = $price . '价格商品';
     } else {
         $rt['infoname'] = '商品中心';
     }
     //条件
     $comd = array('cid' => $cid, 'bid' => $bid, 'price' => $price, 'keyword' => $keyword);
     $orderby = " ORDER BY g.{$order_type} {$sort_type}";
     $start = ($page - 1) * $list;
     $tt = $this->App->__get_goods_count_category($comd);
     //获取商品的数量
     $rt['categoodspage'] = Import::basic()->ajax_page($tt, $list, $page, 'get_categoods_page_list', array($cid, $bid, $price, $order_type, $sort_type, $list));
     $rt['categoodslist'] = $this->App->__get_categoods_list_category($comd, $orderby, $start, $list);
     //商品列表
     $this->set('rt', $rt);
     $con = $this->fetch('ajax_goods_connent', true);
     $result = array('error' => $err, 'message' => $con);
     die($json->encode($result));
 }
 function ajax_del_comment($ids = 0)
 {
     if (empty($ids)) {
         die("非法删除,删除ID为空!");
     }
     $id_arr = @explode('+', $ids);
     foreach ($id_arr as $id) {
         if (Import::basic()->int_preg($id)) {
             $this->App->delete('comment', 'comment_id', $id);
         }
     }
     $this->action('system', 'add_admin_log', '删除商品评论:' . $ids);
 }
 function seo_category_content($data = array(), $type = 'new')
 {
     extract($data);
     switch ($type) {
         case 'new':
             $na = "新闻咨询";
             break;
         case 'customer':
             $na = "客户列表";
             break;
         case 'case':
             $na = "模版案例";
             break;
         case 'web':
             $na = "网站建设";
             break;
     }
     if (!empty($article_id)) {
         if (count($article_id) == count($article_title) && count($meta_keys) == count($meta_desc) && count($meta_desc) == count($article_id)) {
             foreach ($article_id as $k => $cid) {
                 if ($cid <= 0) {
                     continue;
                 }
                 if (isset($sdata)) {
                     unset($sdata);
                 }
                 $sdata = array('article_title' => $article_title[$k], 'meta_keys' => $meta_keys[$k], 'meta_desc' => $meta_desc[$k]);
                 $this->App->update('article', $sdata, 'article_id', $cid);
             }
             $this->action('system', 'add_admin_log', '批量修改' . $na . '内容SEO优化:');
             $this->action('common', 'showdiv', $this->getthisurl());
         }
     }
     unset($data);
     //分页
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     if (empty($page)) {
         $page = 1;
     }
     $list = 10;
     $start = ($page - 1) * $list;
     $sql = "SELECT COUNT(tb1.article_id) FROM `{$this->App->prefix()}article` AS tb1";
     $sql .= " LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2";
     $sql .= " ON tb1.cat_id = tb2.cat_id";
     $sql .= " WHERE tb2.type='{$type}'";
     $tt = $this->App->findvar($sql);
     $pagelink = Import::basic()->getpage($tt, $list, $page, '?page=', true);
     $this->set("pagelink", $pagelink);
     $sql = "SELECT tb1.article_title,tb1.article_id,tb1.meta_keys,tb1.meta_desc,tb2.cat_name FROM `{$this->App->prefix()}article` AS tb1";
     $sql .= " LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2";
     $sql .= " ON tb1.cat_id = tb2.cat_id";
     $sql .= " WHERE tb2.type='{$type}' ORDER BY tb1.article_id DESC LIMIT {$start},{$list}";
     $this->set('articlelist', $this->App->find($sql));
     $this->template('seo_category_content');
 }
			<p style="padding-top:5px; padding-left:10px; font-size:14px;">配送方式:<b>快递免邮</b></p>

			</td>
		</tr>
		</table>
		<div>
			<a href="#" class="btn-buy button ui-btn ui-btn-text-only dddddd"><span class="ui-btn-text">查看订单</span></a>
		</div>
	</div>
</div>
<div class="show_zhuan" style=" display:none;width:100%; height:100%; position:absolute; top:0px; right:0px; z-index:9999999;filter:alpha(opacity=90);-moz-opacity:0.9;opacity:0.9; background:url(<?php 
echo $this->img('gz/121.png');
?>
) right top no-repeat #000;background-size:100% auto;" onclick="$(this).hide();"></div>	
<?php 
$thisurl = Import::basic()->thisurl();
$rr = explode('?', $thisurl);
$t2 = isset($rr[1]) && !empty($rr[1]) ? $rr[1] : "";
$dd = array();
if (!empty($t2)) {
    $rr2 = explode('&', $t2);
    if (!empty($rr2)) {
        foreach ($rr2 as $v) {
            $rr2 = explode('=', $v);
            if ($rr2[0] == 'from' || $rr2[0] == 'isappinstalled' || $rr2[0] == 'code' || $rr2[0] == 'state') {
                continue;
            }
            $dd[] = $v;
        }
    }
}
 function mymes()
 {
     $this->title("欢迎进入用户后台管理中心" . ' - 我的信箱 - ' . $GLOBALS['LANG']['site_name']);
     $uid = $this->check_is_login();
     //if(empty($uid)){ $this->jump(SITE_URL.'user.php?act=login',0,'请先登录!'); exit;}
     //删除
     if (isset($_GET['op']) && $_GET['op'] == 'del' && isset($_GET['id']) && intval($_GET['id']) > 0) {
         $this->App->delete('user_message', 'mes_id', intval($_GET['id']));
         $url = $this->getthisurl();
         $this->jump(str_replace('&op=del&id=' . $_GET['id'], '', $url), 0);
         exit;
     }
     $page = isset($_GET['page']) && $_GET['page'] > 0 ? intval($_GET['page']) : 1;
     $list = 10;
     $start = ($page - 1) * $list;
     $tt = $this->App->findvar("SELECT COUNT(mes_id) FROM `{$this->App->prefix()}user_message` WHERE uid = '{$uid}'");
     $rt['pagelink'] = Import::basic()->getpage($tt, $list, $page, '?page=', true);
     $sql = "SELECT tb1.*,tb2.user_name,tb3.adminname FROM `{$this->App->prefix()}user_message` AS tb1 LEFT JOIN `{$this->App->prefix()}user` AS tb2 ON tb1.uid=tb2.user_id LEFT JOIN `{$this->App->prefix()}admin` AS tb3 ON tb1.adminid=tb3.adminid WHERE tb1.uid = '{$uid}' ORDER BY mes_id DESC LIMIT {$start},{$list}";
     $rt['meslist'] = $this->App->find($sql);
     //商品分类列表
     //$rt['menu'] = $this->action('catalog','get_goods_cate_tree');
     $this->set("rt", $rt);
     $this->template('user_mail');
 }
Exemple #19
0
            if ($rr2[0] == 'from' || $rr2[0] == 'isappinstalled' || $rr2[0] == 'code' || $rr2[0] == 'state') {
                continue;
            }
            $dd[] = $v;
        }
    }
}
$thisurl = $rr[0] . '?' . (!empty($dd) ? implode('&', $dd) : 'tid=0');
?>
<script type="text/javascript">
  function _report(a,c){
		$.post('<?php 
ADMIN_URL;
?>
product.php',{action:'ajax_share',type:a,msg:c,thisurl:'<?php 
echo Import::basic()->thisurl();
?>
',imgurl:'<?php 
echo !empty($lang['site_logo']) ? SITE_URL . $lang['site_logo'] : $this->img('logo4.png');
?>
',title:'<?php 
echo $title;
?>
'},function(data){
		});
  }

<?php 
$t = mktime();
$signature = sha1('jsapi_ticket=' . $lang['jsapi_ticket'] . '&noncestr=' . $lang['nonceStr'] . '&timestamp=' . $t . '&url=' . $thisurl1);
?>
Exemple #20
0
 function ajax_delarticle($data = array())
 {
     $ids = $data['ids'];
     if (empty($ids)) {
         die("非法删除,删除ID为空!");
     }
     $id_arr = @explode('+', $ids);
     $sql = "SELECT article_img FROM `{$this->App->prefix()}wx_article` WHERE article_id IN(" . @implode(',', $id_arr) . ")";
     $imgs = $this->App->findcol($sql);
     if (!empty($imgs)) {
         foreach ($imgs as $img) {
             if (empty($img)) {
                 continue;
             }
             Import::fileop()->delete_file(SYS_PATH . $img);
             //删除图片
             $q = dirname($img);
             $h = basename($img);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
         }
         unset($imgs);
     }
     foreach ($id_arr as $id) {
         if (Import::basic()->int_preg($id)) {
             $this->App->delete('wx_article', 'article_id', $id);
         }
     }
 }
 function message_list($status = 0)
 {
     $w = "";
     if ($status == 1) {
         $w = " WHERE tb1.status='1'";
         $ws = " WHERE status='1'";
     } elseif ($status == 2) {
         $w = " WHERE tb1.status='2'";
         $ws = " WHERE status='1'";
     }
     $orderby = "";
     if (isset($_GET['desc'])) {
         $orderby = ' ORDER BY tb1.`' . $_GET['desc'] . '` DESC';
     } else {
         if (isset($_GET['asc'])) {
             $orderby = ' ORDER BY tb1.`' . $_GET['asc'] . '` ASC';
         } else {
             $orderby = ' ORDER BY tb1.`mes_id` DESC';
         }
     }
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     if (empty($page)) {
         $page = 1;
     }
     $list = 10;
     $start = ($page - 1) * $list;
     $sql = "SELECT COUNT(mes_id) FROM `{$this->App->prefix()}message` {$ws}";
     $tt = $this->App->findvar($sql);
     $pagelink = Import::basic()->getpage($tt, $list, $page, '?page=', true);
     $this->set("pagelink", $pagelink);
     $sql = "SELECT tb1.mes_id,tb1.comment_title,tb1.user_name,tb1.rp_content,tb1.addtime,tb1.ip_from,tb1.status, tb2.user_name AS dbuser_name,tb2.nickname,tb3.goods_name,tb3.goods_id FROM `{$this->App->prefix()}message` AS tb1";
     $sql .= " LEFT JOIN `{$this->App->prefix()}user` AS tb2 ON tb1.user_id=tb2.user_id";
     $sql .= " LEFT JOIN `{$this->App->prefix()}goods` AS tb3 ON tb1.goods_id=tb3.goods_id";
     $sql .= " {$w} {$orderby} LIMIT {$start},{$list}";
     $this->set('meslist', $this->App->find($sql));
     $this->template('mes_list');
 }
Exemple #22
0
 function getcount()
 {
     //新闻
     /*$sql = "SELECT COUNT(article_id) FROM `{$this->App->prefix()}article` AS tb1";
     		$sql .=" LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2 ON tb1.cat_id = tb2.cat_id";
     		$sql .=" WHERE tb2.type='new'";
     		$rt['newcount'] = $this->App->findvar($sql);
     		
     		//客户列表
     		$sql = "SELECT COUNT(article_id) FROM `{$this->App->prefix()}article` AS tb1";
     		$sql .=" LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2 ON tb1.cat_id = tb2.cat_id";
     		$sql .=" WHERE tb2.type='customer'";
     		$rt['customercount'] = $this->App->findvar($sql);
     		
     		//模板
     		$sql = "SELECT COUNT(article_id) FROM `{$this->App->prefix()}article` AS tb1";
     		$sql .=" LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2 ON tb1.cat_id = tb2.cat_id";
     		$sql .=" WHERE tb2.type='case'";
     		$rt['casecount'] = $this->App->findvar($sql);
     		
     		//网站建设文章
     		$sql = "SELECT COUNT(article_id) FROM `{$this->App->prefix()}article` AS tb1";
     		$sql .=" LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2 ON tb1.cat_id = tb2.cat_id";
     		$sql .=" WHERE tb2.type='web'";
     		$rt['webcount'] = $this->App->findvar($sql);
     		*/
     //会员数量
     $sql = "SELECT COUNT(user_id)  FROM `{$this->App->prefix()}user`";
     $rt['usercount']['zcount'] = $this->App->findvar($sql);
     $sql = "SELECT COUNT(user_id) FROM `{$this->App->prefix()}user` WHERE active='1'";
     $rt['usercount']['yescount'] = $this->App->findvar($sql);
     $sql = "SELECT COUNT(user_id)  FROM `{$this->App->prefix()}user` WHERE active='0'";
     $rt['usercount']['nocount'] = $this->App->findvar($sql);
     //留言数
     $sql = "SELECT COUNT(mes_id) AS mescount FROM `{$this->App->prefix()}message` WHERE parent_id='0' GROUP BY status ORDER BY status DESC";
     $rt['mescount'] = $this->App->findcol($sql);
     //评论数
     $sql = "SELECT COUNT(comment_id) AS comcount FROM `{$this->App->prefix()}comment` WHERE parent_id='0' GROUP BY status ORDER BY status DESC";
     $rt['commentcount'] = $this->App->findcol($sql);
     //商品数
     $sql = "SELECT COUNT(goods_id) FROM `{$this->App->prefix()}goods`";
     $rt['goods']['zcount'] = $this->App->findvar($sql);
     $sql = "SELECT COUNT(goods_id) FROM `{$this->App->prefix()}goods` WHERE is_on_sale='1'";
     $rt['goods']['sale'] = $this->App->findvar($sql);
     $sql = "SELECT COUNT(goods_id) FROM `{$this->App->prefix()}goods` WHERE is_on_sale='0'";
     $rt['goods']['no_sale'] = $this->App->findvar($sql);
     $sql = "SELECT COUNT(goods_id) FROM `{$this->App->prefix()}goods` WHERE is_best='1' OR is_hot='1' OR is_new='1'";
     $rt['goods']['promote'] = $this->App->findvar($sql);
     //订单数量
     $sql = "SELECT COUNT(order_id) FROM `{$this->App->prefix()}goods_order_info`";
     $rt['order']['zcount'] = $this->App->findvar($sql);
     $sql = "SELECT COUNT(order_id) FROM `{$this->App->prefix()}goods_order_info` WHERE pay_status='1'";
     $rt['order']['yescount'] = $this->App->findvar($sql);
     $rt['os'] = Import::basic()->get_os();
     $rt['browser'] = Import::basic()->get_user_browser();
     $rt['bsip'] = Import::basic()->getip();
     $rt['ip_from'] = Import::ip()->ipCity($rt['bsip']);
     $rt['csip'] = Import::basic()->serverIP();
     return $rt;
 }
Exemple #23
0
 function ajax_categoods_list($page = 0, $cid = 0)
 {
     if (empty($cid) || !($cid > 0)) {
         die("");
     }
     $cid_arr = $this->action('catalog', 'get_goods_sub_cat_ids', $cid);
     $list = 5;
     $tt = $this->App->__get_categoods_count_goods($cid_arr);
     $rt['categoods_count'] = $tt;
     $args = array($cid);
     if (!$page) {
         $page = 1;
     }
     $start = ($page - 1) * $list;
     $rt['categoodspage'] = Import::basic()->ajax_page($tt, $list, $page, 'get_categoods_page', $args);
     $categoods = $this->App->__get_categoods_list_goods($cid_arr, $start, $list);
     $rt['categoods'] = array();
     if (!empty($categoods)) {
         foreach ($categoods as $k => $row) {
             // if($row['goods_id']==$gid) continue;
             $rt['categoods'][$k] = $row;
             $rt['categoods'][$k]['goods_thumb'] = is_file(SYS_PATH . $row['goods_thumb']) ? SITE_URL . $row['goods_thumb'] : SITE_URL . 'theme/images/no_picture.gif';
             $rt['categoods'][$k]['goods_img'] = is_file(SYS_PATH . $row['goods_img']) ? SITE_URL . $row['goods_img'] : SITE_URL . 'theme/images/no_picture.gif';
             $rt['categoods'][$k]['original_img'] = is_file(SYS_PATH . $row['original_img']) ? SITE_URL . $row['original_img'] : SITE_URL . 'theme/images/no_picture.gif';
             $rt['categoods'][$k]['url'] = get_url($row['goods_name'], $row['goods_id'], 'product.php?id=' . $row['goods_id'], 'goods', array('product', 'index', $row['goods_id']));
             if ($row['is_promote'] == '1') {
                 //促销 价格
                 if ($row['promote_start_date'] < mktime() && $row['promote_end_date'] > mktime()) {
                     $row['promote_price'] = format_price($row['promote_price']);
                 } else {
                     $row['promote_price'] = "0.00";
                 }
             } else {
                 $row['promote_price'] = "0.00";
             }
             $rt[$k]['promote_price'] = $row['promote_price'];
         }
         unset($categoods);
     }
     $this->set('rt', $rt);
     $result = $this->fetch('ajax_categoods', true);
     unset($rt, $categoods);
     die($result);
 }
Exemple #24
0
 function index($cat_id = 0, $page = 0)
 {
     $rt = $this->Cache->read(3600);
     $type = 'about';
     if (is_null($rt)) {
         $parent_id = true;
         if (empty($cat_id)) {
             $cat_id = $this->App->findvar("SELECT cat_id FROM `{$this->App->prefix()}article_cate` WHERE type='{$type}' AND parent_id='0' ORDER BY cat_id ASC");
             $parent_id = false;
         }
         //获取当前分类信息
         $sql = "SELECT * FROM `{$this->App->prefix()}article_cate` WHERE type='{$type}' AND cat_id='{$cat_id}' LIMIT 1";
         $rt['catemes'] = $this->App->findrow($sql);
         if (empty($rt['catemes'])) {
             $this->jump(SITE_URL);
             exit;
         }
         //当前位置
         $thishear = array();
         $rts_ = $this->action('article', 'get_parent_cats', $cat_id);
         $rts = Import::basic()->array_sort($rts_, 'cat_id');
         $thishear[] = '<a href="' . SITE_URL . '">首页</a>';
         if (!empty($rts)) {
             foreach ($rts as $rows) {
                 $urlobj[] = $this->__module;
                 $urlobj[] = 'index';
                 if ($rows['parent_id'] != 0) {
                     $urlobj[] = $rows['cat_id'];
                 }
                 $thishear[] = '&nbsp;&gt;&nbsp;<a href="javascript:;">' . $rows['cat_name'] . '</a>';
                 unset($urlobj);
             }
             unset($rts, $rts_);
         }
         $rt['here'] = implode('', $thishear);
         unset($thishear);
         //文章列表
         $sql = "SELECT tb1.article_title,tb1.article_id,tb2.cat_name,tb2.cat_id FROM `{$this->App->prefix()}article` AS tb1";
         $sql .= " LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2";
         $sql .= " ON tb1.cat_id = tb2.cat_id";
         $sql .= " WHERE tb2.type='{$type}' ORDER BY tb1.vieworder ASC,tb1.article_id DESC";
         $article_list = $this->App->find($sql);
         if (!empty($article_list)) {
             foreach ($article_list as $k => $row) {
                 $dd[] = $this->__module;
                 $dd[] = 'article';
                 $dd[] = $row['article_id'];
                 $rt['article_list'][$row['cat_name']][$k] = $row;
                 $rt['article_list'][$row['cat_name']][$k]['url'] = get_url($row['article_title'], $row['article_id'], SITE_URL . $type . '.php?id=' . $row['article_id'], 'article', array($row['type'], 'article', $row['article_id']));
                 unset($dd);
             }
             unset($article_list);
         }
         //查找一篇文章
         $rt['article_con'] = array();
         $sql = "SELECT tb1.* FROM `{$this->App->prefix()}article` AS tb1";
         $sql .= " LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2";
         $sql .= " ON tb1.cat_id = tb2.cat_id";
         $sql .= " WHERE tb2.type='{$type}' AND tb1.cat_id!='88' ORDER BY tb1.vieworder ASC LIMIT 1";
         $rt['article_con'] = $this->App->findrow($sql);
         $rt['article_con']['article_img'] = !empty($rt['article_con']['article_img']) ? SITE_URL . $rt['article_con']['article_img'] : "";
         $rt['showtmp'] = "article_" . $type;
         $this->Cache->write($rt);
     }
     //页面头信息
     $title = $rt['article_con']['article_title'];
     $this->title($title . ' - ' . $GLOBALS['LANG']['site_name']);
     $this->meta("title", $title);
     $this->meta("keywords", $rt['article_con']['meta_keys']);
     $this->meta("description", $rt['article_con']['meta_desc']);
     $this->set('rt', $rt);
     $this->template($rt['showtmp']);
 }
Exemple #25
0
<?php

define('LOGIN', 1);
require_once 'load.php';
if ($app->action('manager', 'is_login')) {
    Import::basic()->redirect(ADMIN_URL);
    exit;
}
//ajax登录
if (isset($_POST['action']) && $_POST['action'] == "login") {
    $data['adminname'] = $_POST['adminname'];
    $data['password'] = $_POST['password'];
    $data['vifcode'] = $_POST['vifcode'];
    $app->action('manager', 'login', $data);
    exit;
}
$app->action('manager', 'index');
Exemple #26
0
 function restoredblist()
 {
     require_once SYS_PATH . 'lib/class/class.file.php';
     if (class_exists('FileOp')) {
         $filedir = SYS_PATH . 'data' . DS . 'backup';
         $fileobj = new FileOp();
         $ar = $fileobj->list_files($filedir);
         $art_ = array();
         if (!empty($ar)) {
             foreach ($ar as $var) {
                 if (!empty($var)) {
                     $type = substr($var, -4);
                     if ($type != '.sql') {
                         continue;
                     }
                 } else {
                     continue;
                 }
                 $isize = filesize($var);
                 if ($isize < 1000000) {
                     $size = sprintf("%.2f", $isize / 1024) . 'KB';
                 } else {
                     $size = sprintf("%.2f", $isize / 1024 / 1024) . 'MB';
                 }
                 $art_[] = array('filename' => basename($var), 'size' => $size, 'titme' => date('Y-m-d H:i:s', filemtime($var)), 'filedir' => $var);
             }
         }
         unset($ar);
         $art = Import::basic()->array_sort($art_, 'titme', 'desc');
         $this->set('restoredblist', $art);
         unset($art_);
     } else {
         die("请你检查你的文件处理类是否存在!=>FileOp");
     }
     $this->template('database_restore');
 }
 function check_isMobile()
 {
     $site = Basic::thisurl();
     $istrue = Import::basic()->isMobile();
     if ($istrue == true && !strpos($site, 'ajaxfile') && !strpos($site, 'user.php')) {
         $this->jump(SITE_URL . 'm/');
         exit;
     }
 }
Exemple #28
0
 function ajax_user_register($data = array())
 {
     $json = Import::json();
     $result = array('error' => 2, 'message' => '传送的数据为空!');
     if (empty($data['fromAttr'])) {
         die($json->encode($result));
     }
     $fromAttr = $json->decode($data['fromAttr']);
     //反json ,返回值为对象
     unset($data);
     $uid = $this->Session->read('User.uid');
     $wecha_id = $this->Session->read('User.wecha_id');
     if (!($uid > 0)) {
         $sql = "SELECT user_id FROM `{$this->App->prefix()}user` WHERE wecha_id ='{$wecha_id}' LIMIT 1";
         $uid = $this->App->findvar($sql);
         if (!($uid > 0)) {
             die("无法登录代理用户,麻烦通知我们管理员,谢谢");
         }
     }
     //以下字段对应评论的表单页面 一定要一致
     $datas['user_rank'] = $fromAttr->user_rank;
     //用户级别
     $datas['mobile_phone'] = $fromAttr->username;
     //用户名
     if (empty($datas['mobile_phone'])) {
         $result = array('error' => 2, 'message' => '请输入手机号码作为登录帐号!');
         if (empty($data['fromAttr'])) {
             die($json->encode($result));
         }
     }
     if (preg_match("/1[3458]{1}\\d{9}\$/", $datas['mobile_phone'])) {
     } else {
         $result = array('error' => 2, 'message' => '手机号码不合法,请重新输入!');
         if (empty($data['fromAttr'])) {
             die($json->encode($result));
         }
     }
     //检查该手机是否已经使用了
     $mobile_phone = $datas['mobile_phone'];
     $sql = "SELECT user_id FROM `{$this->App->prefix()}user` WHERE user_id !='{$uid}' AND mobile_phone='{$mobile_phone}'";
     $uuid = $this->App->findvar($sql);
     if ($uuid > 0) {
         $result = array('error' => 2, 'message' => '抱歉,该手机号码已经被使用了!');
         if (empty($data['fromAttr'])) {
             die($json->encode($result));
         }
     }
     $datas['password'] = $fromAttr->password;
     if (empty($datas['password'])) {
         $result = array('error' => 2, 'message' => '用户密码不能为空!');
         if (empty($data['fromAttr'])) {
             die($json->encode($result));
         }
     }
     $rp_pass = $fromAttr->rp_pass;
     if ($rp_pass != $datas['password']) {
         $result = array('error' => 2, 'message' => '两次密码不相同!');
         if (empty($data['fromAttr'])) {
             die($json->encode($result));
         }
     }
     $datas['password'] = md5($datas['password']);
     /*if(!($datas['user_rank']>0)) */
     $datas['user_rank'] = 10;
     /*		$yyy = $fromAttr->yyy;
     		$mmm = $fromAttr->mmm;
     		$ddd = $fromAttr->ddd;
     		$datas['birthday'] = $yyy.'-'.$mmm.'-'.$ddd;
     		$datas['sex'] = $fromAttr->sex;*/
     //$regcode = $fromAttr->regcode;
     /*$regcode = '';
     		if(!empty($regcode)){
     			//检查该注册码是否有效
     			$sql = "SELECT tb1.bonus_id FROM `{$this->App->prefix()}user_coupon_list` AS tb1 LEFT JOIN `{$this->App->prefix()}user_coupon_type` AS tb2 ON tb1.type_id = tb2.type_id WHERE tb1.bonus_sn='$regcode' AND tb1.is_used='0' LIMIT 1";
     			$uuid = $this->App->findvar($sql);
     			if($uuid > 0){
     			
     			}else{
     				$result = array('error' => 2, 'message' => '请检查该注册码是否有效!');
     				die($json->encode($result));
     			}
     		 }
     		
     		$emails = '';
     		if(!empty($emails)){
     			$sql = "SELECT email FROM `{$this->App->prefix()}user` WHERE email='$emails' AND user_rank='10'";
     			$dbemail = $this->App->findvar($sql);
     			if(!empty($dbemail)){
     				$result = array('error' => 2, 'message' => '该电子邮箱已经被使用了!');
     				die($json->encode($result));
     			}
     		}*/
     $ip = Import::basic()->getip();
     $reg_ip = $ip ? $ip : '0.0.0.0';
     //$datas['reg_time'] = mktime();
     //$datas['reg_from'] = Import::ip()->ipCity($ip);
     //$datas['last_login'] = mktime();
     $datas['last_ip'] = $reg_ip;
     $datas['active'] = 0;
     if ($this->App->update('user', $datas, 'user_id', $uid)) {
         /*$this->Session->write('Agent.username',$uname);
         		$this->Session->write('User.uid',$uid);
         		$this->Session->write('Agent.active',$datas['active']);
         		$this->Session->write('Agent.rank','10');
         		$this->Session->write('Agent.lasttime',$datas['last_login']);
         		$this->Session->write('Agent.lastip',$datas['last_ip']);
         		
         		//注册码表
         		if(!empty($regcode)){
         		 	$this->App->insert('user_regcode',array('code'=>$regcode,'uid'=>$uid,'addtime'=>mktime()));
         			$this->App->update('user_coupon_list',array('is_used'=>'1','user_id'=>$uid,'used_time'=>mktime()),'bonus_sn',$regcode);
         		}*/
         $result = array('error' => 0, 'message' => '登记成功,正等待管理员审核!');
         unset($datas, $datass);
     } else {
         $result = array('error' => 2, 'message' => '登记失败!');
     }
     die($json->encode($result));
 }
 function ajax_article_list($cid = 0, $page = 1, $type = 'new', $list = 10)
 {
     //下级分类ID
     if (!($cid > 0)) {
         echo "获取数据失败!";
         exit;
     }
     $sourceid = array($cid);
     $get_cid = $this->get_sub_cat_ids($cid, $type);
     if (!empty($get_cid)) {
         $subcid = array_merge($get_cid, $sourceid);
     } else {
         $subcid = $sourceid;
     }
     unset($sourceid, $get_cid);
     //分页
     if (empty($page)) {
         $page = 1;
     }
     if (!($list > 0)) {
         $list = 10;
     }
     $start = ($page - 1) * $list;
     $sql = "SELECT COUNT(article_id) FROM `{$this->App->prefix()}article` WHERE is_show='1' AND cat_id IN(" . @implode(',', $subcid) . ")";
     $tt = $this->App->findvar($sql);
     $rt['categorypage'] = Import::basic()->ajax_page($tt, $list, $page, 'get_cate' . $type . '_page_list', array($cid));
     //获取内容列表
     $sql = "SELECT * FROM `{$this->App->prefix()}article` WHERE is_show='1' AND cat_id IN(" . @implode(',', $subcid) . ") ORDER BY is_top DESC,vieworder ASC,article_id DESC LIMIT {$start},{$list}";
     $rt['catecon'] = $this->App->find($sql);
     if (!empty($rt['catecon'])) {
         foreach ($rt['catecon'] as $k => $row) {
             if (!empty($row['article_img'])) {
                 $pa = dirname($row['article_img']);
                 $thumb = basename($row['article_img']);
                 $rt['catecon'][$k]['thumb_s'] = SITE_URL . $pa . '/thumb_b/' . $thumb;
                 $rt['catecon'][$k]['thumb_b'] = SITE_URL . $pa . '/thumb_b/' . $thumb;
             } else {
                 $rt['catecon'][$k]['thumb_s'] = "";
                 $rt['catecon'][$k]['thumb_b'] = "";
             }
             $rt['catecon'][$k]['url'] = get_url($row['article_title'], $row['article_id'], 'article.php?id=' . $row['article_id'], 'article', array($type, 'article', $row['article_id']));
         }
     } else {
         $rt['catecon'] = array();
     }
     $this->set('rt', $rt);
     $con = $this->fetch('ajax_' . $type . '_connent', true);
     echo $con;
     exit;
 }
 function ajax_show_goods_url($gcid = 0)
 {
     if (!($gcid > 0)) {
         return array();
     }
     $w = "WHERE gcid='{$gcid}'";
     //分页
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     if (empty($page)) {
         $page = 1;
     }
     $list = 12;
     $start = ($page - 1) * $list;
     $sql = "SELECT COUNT(gcuid) FROM `{$this->App->prefix()}goods_cache_url` {$w}";
     $tt = $this->App->findvar($sql);
     $pagelink = Import::basic()->getpage($tt, $list, $page, '?page=', true);
     $rt['pagelink'] = $pagelink;
     $sql = "SELECT * FROM `{$this->App->prefix()}goods_cache_url` {$w} ORDER BY active DESC,gcuid DESC LIMIT {$start},{$list}";
     $rt['list'] = $this->App->find($sql);
     return $rt;
 }