page.ctrl.php 1.1 KB

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. $dos = array('getnum', 'addnum', 'index');
  8. $do = in_array($do, $dos) ? $do : 'index';
  9. $id = intval($_GPC['id']);
  10. if($do == 'getnum'){
  11. $goodnum = pdo_get('site_page', array('id' => $id), array('goodnum'));
  12. message(error('0', array('goodnum' => $goodnum['goodnum'])), '', 'ajax');
  13. } elseif($do == 'addnum'){
  14. if(!isset($_GPC['__havegood']) || (!empty($_GPC['__havegood']) && !in_array($id, $_GPC['__havegood']))) {
  15. $goodnum = pdo_get('site_page', array('id' => $id), array('goodnum'));
  16. if(!empty($goodnum)){
  17. $updatesql = pdo_update('site_page', array('goodnum' => $goodnum['goodnum'] + 1), array('id' => $id));
  18. if(!empty($updatesql)) {
  19. isetcookie('__havegood['.$id.']', $id, 86400*30*12);
  20. message(error('0', ''), '', 'ajax');
  21. }else {
  22. message(error('1', ''), '', 'ajax');
  23. }
  24. }
  25. }
  26. } else {
  27. $footer_off = true;
  28. template_page($id);
  29. }