inaddnews.inc.php 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu2();
  4. $info=pdo_get('zhtc_news',array('id'=>$_GPC['id']));
  5. $city=pdo_getall('zhtc_hotcity',array('uniacid'=>$_W['uniacid']),array(),'','time ASC');
  6. //var_dump($info);die;
  7. if(checksubmit('submit')){
  8. $data['title']=$_GPC['title'];
  9. $data['num']=$_GPC['num'];
  10. //$data['img']=$_GPC['img'];
  11. $data['state']=$_GPC['state'];
  12. $data['type']=$_GPC['type'];
  13. $data['cityname']=$_COOKIE["cityname"];
  14. $data['details']=html_entity_decode($_GPC['details']);
  15. $data['time']=time();
  16. $data['uniacid']=$_W['uniacid'];
  17. if($_GPC['id']==''){
  18. $res=pdo_insert('zhtc_news',$data);
  19. if($res){
  20. message('添加成功!', $this->createWebUrl('innews'), 'success');
  21. }else{
  22. message('添加失败!','','error');
  23. }
  24. }else{
  25. $res=pdo_update('zhtc_news',$data,array('id'=>$_GPC['id']));
  26. if($res){
  27. message('编辑成功!', $this->createWebUrl('innews'), 'success');
  28. }else{
  29. message('编辑失败!','','error');
  30. }
  31. }
  32. }
  33. include $this->template('web/inaddnews');