示例#1
0
文件: seccode.php 项目: my1977/shopnc
/**
 * 
 *
 * Framework ���Ŀ��
 * 
 *
 * @copyright  Copyright (c) 2007-2013 ShopNC Inc. (http://www.shopnc.net)
 * @license    http://www.shopnc.net/
 * @link       http://www.shopnc.net/
 * @since      File available since Release v1.1
 */
function makeSeccode($nchash)
{
    $seccode = random(6, 1);
    $seccodeunits = "";
    $s = sprintf("%04s", base_convert($seccode, 10, 23));
    $seccodeunits = "ABCEFGHJKMPRTVXY2346789";
    if ($seccodeunits) {
        $seccode = "";
        $i = 0;
        for (; $i < 4; ++$i) {
            $unit = ord($s[$i]);
            $seccode .= 48 <= $unit && $unit <= 57 ? $seccodeunits[$unit - 48] : $seccodeunits[$unit - 87];
        }
    }
    setnccookie("seccode" . $nchash, encrypt(strtoupper($seccode) . "\t" . (time() - 180) . "\t" . $nchash, MD5_KEY));
    return $seccode;
}
示例#2
0
文件: control.php 项目: noikiy/ecmall
 private function queryCart()
 {
     if (cookie("goodsnum") != NULL && 0 <= intval(cookie("goodsnum"))) {
         $goodsnum = intval(cookie("goodsnum"));
     } else {
         if (cookie("cart") != "") {
             $cart_str = cookie("cart");
             if (get_magic_quotes_gpc()) {
                 $cart_str = stripslashes($cart_str);
             }
             $cookie_goods = unserialize($cart_str);
             $goodsnum = count($cookie_goods);
         } else {
             if ($_SESSION['member_id'] != "") {
                 $goodsnum = model()->table("cart")->where(array("member_id" => $_SESSION['member_id']))->count();
             } else {
                 $goodsnum = 0;
             }
         }
     }
     setnccookie("goodsnum", $goodsnum, 7200);
     Tpl::output("goods_num", $goodsnum);
 }
示例#3
0
文件: core.php 项目: my1977/shopnc
function log_times($key, $op = "cookie", $expire = "")
{
    $key = "tm_" . $key;
    if ($op == "cookie") {
        $value = !is_numeric(cookie($key)) ? 1 : intval(cookie($key)) + 1;
        setnccookie($key, $value, $expire);
        return $value;
    }
    if ($op == "session") {
        $value = NULL;
        return $value;
    }
    if ($op == "memcache") {
        $value = NULL;
    }
    return $value;
}