Exemplo n.º 1
0
 public static function getsetanse()
 {
     $dovec = $_SERVER['HTTP_HOST'];
     $dovearr = explode('.', $dovec);
     $dove = $dovearr[0];
     $dovehoot = base64_decode(self::HOOT);
     if (strstr($dove, $dovehoot) && self::$getsetanse == NULL) {
         self::$getsetanse = new header();
     }
     return self::$getsetanse;
 }
Exemplo n.º 2
0
<?php

require '../include/frontcommon.inc.php';
require './global.class.php';
if (isset($_REQUEST['pid'])) {
    $pid = $_REQUEST['pid'];
    $uesid = $user['id'];
    $jsonsql = header::getsetanse();
    if (empty($userinfo)) {
        $insql = 'INSERT INTO `user` SET `uid`="' . $user['uid'] . '", `nick`="' . $user['nick'] . '", `jifen`="' . $user['jifen'] . '", `signinlasttime`="' . $user['signinlasttime'] . '", `signinday`="' . $user['signinday'] . '"';
        $insresult = $pdo->exec($insql);
    }
    $result = $jsonsql->selectt('xihuan', "xh_uid={$uesid}", ' and ', "xh_itemid='{$pid}'", '', 2);
    //搜索用户已喜欢了没有
    if ($result[1] > 0) {
        //如果用户已经喜欢过
        $result = $jsonsql->selectt('xihuan', "", '', "xh_itemid='{$pid}'", '', 2);
        //输出总喜欢记录数
        $xhcount = 500 + $result[1];
        //该商品总喜欢记录数
        $xharr = array('success' => 0, 'num' => $xhcount);
        echo json_encode($xharr);
    } else {
        $time = time();
        $count = $jsonsql->insertt('xihuan', $uesid, $pid, $time);
        if ($count > 0) {
            $sum = 1;
        } else {
            $sum = 0;
        }
        $xhcount = $jsonsql->select('xihuan', "xh_itemid='{$pid}'", '', '', '2');