break; case 0: $db->query("insert into clicklog(`contentid`,`openid`,`shareopenid`,`ip`,`msg`,`isvalid`) values(" . $contentinfo['id'] . ",'" . $clickOpenid . "','" . $shareOpenid . "','" . $_SERVER['REMOTE_ADDR'] . "','位置不在分钱范围内','0')"); $msg = array('result' => false, 'msg' => '位置不在分钱范围内'); echo json_encode($msg); exit; break; case -2: $db->query("insert into clicklog(`contentid`,`openid`,`shareopenid`,`ip`,`msg`,`isvalid`) values(" . $contentinfo['id'] . ",'" . $clickOpenid . "','" . $shareOpenid . "','" . $_SERVER['REMOTE_ADDR'] . "','数据插入错误','0')"); $msg = array('result' => false, 'msg' => '数据插入错误'); echo json_encode($msg); exit; break; case 1: $db->query("insert into clicklog(`contentid`,`openid`,`shareopenid`,`ip`,`msg`,`isvalid`) values(" . $contentinfo['id'] . ",'" . $clickOpenid . "','" . $shareOpenid . "','" . $_SERVER['REMOTE_ADDR'] . "','点击有效','1')"); $msg = array('result' => true, 'msg' => '本次阅读为你的好友增加¥' . $clickprice); echo json_encode($msg); exit; break; default: $msg = array('result' => false, 'msg' => '服务器异常错误'); echo json_encode($msg); exit; } } else { SystemTool::systemLog($db, '点击统计错误', '参数错误或缺少参数', $_SERVER['REMOTE_ADDR'] . print_r($_POST, true)); $db->query("insert into clicklog(`contentid`,`openid`,`shareopenid`,`ip`,`msg`,`isvalid`) values(" . $contentinfo['id'] . ",'" . $clickOpenid . "','" . $shareOpenid . "','" . $_SERVER['REMOTE_ADDR'] . "','数据异常','0')"); } echo '0'; exit; }
<?php /** * content.php 详细页面 */ ini_set('display_errors', 1); require_once './config.inc.php'; $contentid = intval($_GET['id']); //share openid if (isset($_GET['shareopenid']) && !empty($_GET['shareopenid'])) { $shareopenid = $_GET['shareopenid']; } //用户openid if (empty($_SESSION['openid'])) { SystemTool::systemLog($db, 'content.php', 'empty session openid', 'check openid'); $redirecturl = SITE_DOMAIN . 'content.php?id=' . $contentid; if (!empty($shareopenid)) { $redirecturl .= '&shareopenid=' . $shareopenid; } $redirecturl .= '#' . time(); SystemTool::checkOpenid($db, 'snsapi_userinfo', $redirecturl); exit; } $content = ContentClass::getArticle($db, $contentid); if (empty($content)) { echo '内容不存在或者已删除'; exit; } if (!empty($shareopenid)) { $isclicked = ClickCount::checkisClicked($db, $contentid, $_SESSION['openid'], $shareopenid); }