ad.inc.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu();
  4. $pageindex = max(1, intval($_GPC['page']));
  5. $pagesize=10;
  6. $where=" where uniacid=:uniacid";
  7. $data[':uniacid']=$_W['uniacid'];
  8. $type_id=$_GPC['type_id'];
  9. if($_GPC['type_id']>0){
  10. $where.=" and type=:type";
  11. $data[':type']=$type_id;
  12. }
  13. $sql="select * from".tablename('zhtc_ad').$where." ORDER BY orderby ASC";
  14. $total=pdo_fetchcolumn("select count(*) from".tablename('zhtc_ad').$where,$data);
  15. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  16. $list=pdo_fetchall($select_sql,$data);
  17. $pager = pagination($total, $pageindex, $pagesize);
  18. //$list=pdo_getall('zhtc_ad',array('uniacid'=>$_W['uniacid']),array(),'','orderby ASC');
  19. if($_GPC['op']=='delete'){
  20. $res=pdo_delete('zhtc_ad',array('id'=>$_GPC['id']));
  21. if($res){
  22. message('删除成功!', $this->createWebUrl('ad'), 'success');
  23. }else{
  24. message('删除失败!','','error');
  25. }
  26. }
  27. if($_GPC['status']){
  28. $data2['status']=$_GPC['status'];
  29. $res=pdo_update('zhtc_ad',$data2,array('id'=>$_GPC['id']));
  30. if($res){
  31. message('编辑成功!', $this->createWebUrl('ad',array('type_id'=>$type_id)), 'success');
  32. }else{
  33. message('编辑失败!','','error');
  34. }
  35. }
  36. include $this->template('web/ad');