Example #1
0
 static function hitscounter($id, $title, $url)
 {
     $timeout = self::$_timeout;
     $requestime = $_SERVER['REQUEST_TIME'];
     $cookiename = strtoupper(md5($title));
     if (empty($_COOKIE[$cookiename])) {
         setcookie($cookiename, $requestime);
     } else {
         if ($_COOKIE[$cookiename] + $timeout > $requestime) {
             return false;
         }
     }
     $addate = COMCommon::sysTime();
     $stat = new Traffic_statistics();
     $one = $stat->getOne("box_id=? and title=?", array($id, $title));
     if ($one) {
         $one->hitscount = $one->hitscount + 1;
         $one->status = 1;
         $flag = $one->save();
     } else {
         $flag = $stat->add($id, $title, $url, 1, 1, $addate);
     }
     return $flag;
 }
Example #2
0
    public function userCreateTitle($value)
    {
        if ($value) {
            $title = COMCommon::titleString(stripcslashes($value[1]), 55);
            $text = '<a href="?do=/prms/adduser&userId=' . $value[0] . '" ' . $title . '>' . COMCommon::cutSubstr(stripcslashes($value[1]), 0, 55, '') . '</a>&nbsp;&nbsp;
			<a href="?do=/prms/userrole&userId=' . $value[0] . '" >角色</a>';
        }
        return $text;
    }
Example #3
0
 /**
  * 功能号:1029
  * 设置回退版本
  * */
 public function set_pullback_ajax()
 {
     COMFilter::$_jump = false;
     $code = Core::$_dataFilter->valueCheck(Core::get("code"), "Require,Limit", "code不能为空,code非法", false, 13);
     $modules = COMCommon::scriptFilter(Core::get("modules"));
     if ($modules) {
         $modules = rtrim($modules, ',');
     }
     if (!Core::checkcode($code)) {
         Core::json_error('code 不合法');
     }
     $addate = time();
     $channel = Channels::getOne("code = ?", array($code));
     if ($channel) {
         $channel->pullback = $modules;
         $channel->edate = $addate;
         $flag = $channel->save();
     }
     if ($flag) {
         Core::json_result('', 'ok');
     } else {
         Core::json_error('设置码率失败');
     }
 }
Example #4
0
    /**
     * 功能号:12083
     * 短信状态回调接口
     * */
    public function sms_status_notify()
    {
        COMFilter::$_jump = false;
        $xmlstring = <<<EDT
<?xml version="1.0" encoding="GBK" ?>
<reports>
<report>
<corp_id>test</corp_id>
<mobile>13810000001</mobile>
<sub_seq>0</sub_seq>
<msg_id>12345asd</msg_id>
<err>2</err>
<fail_desc>undeliver</fail_desc>
<report_time>2010-07-02 00:00:00</report_time>
</report>
<report>
<corp_id>test</corp_id>
<mobile>13810000002</mobile>
<sub_seq>0</sub_seq>
<msg_id>12345asd123</msg_id>
<err>2</err>
<fail_desc>undeliver</fail_desc>
<report_time>2010-07-02 00:00:00</report_time>
</report>
</reports>
EDT;
        $xml = simplexml_load_string($xmlstring);
        if (is_object($xml->report)) {
            foreach ($xml->report as $a) {
                print iconv("UTF-8", "GBK", $a->msg_id) . '<br/>';
            }
        }
        $ordersn = Core::$_dataFilter->valueCheck(Core::get("sn"), "Require,Limit", "订单号不能为空,code非法", false, 17);
        $ip = Core::get_client_ip();
        if (!Core::checkcode($ordersn)) {
            //	Core::json_error('code 不合法');
        }
        $paydate = COMCommon::sysTime();
        /* $user = new Users();
        		$one = $user->getOne('user_name=?',$phone);
        		if(empty($one)){
                           $id = $user->add($phone, $addate);
                        }else{
                           $id = $one->id;
                        }*/
        $order = self::getOne("order_sn=?", $ordersn, "pay_time desc");
        if (empty($order)) {
            Core::print_result("FAIL");
        } else {
            if ($order->status == 1) {
                //   Core::print_result("SUCCESS");
            } else {
                $userid = $order->user_id;
                $order->status = 1;
                $order->pay_time = $paydate;
                $flag = $order->save();
                if ($flag) {
                    $addate = time();
                    $tokenid = md5($order->order_sn);
                    $etime = $addate + $this->_effective_time * 3600;
                    $token = new Users_token();
                    $one = $token->getOne("id = ?", $userid);
                    print_r($one);
                    if ($one) {
                        $flag = $token->edit(1, $order->order_sn, $tokenid, $addate, $etime, 1, $userid);
                    } else {
                        $flag = $token->add($userid, 1, $order->order_sn, $tokenid, $addate, $etime, 1);
                    }
                    Core::print_result("SUCCESS");
                } else {
                    Core::print_result("FAIL");
                }
            }
        }
    }