Exemplo n.º 1
0
function logFile($interface, $info)
{
    date_default_timezone_set('prc');
    $datetime = date("Y-m-d H:i:s");
    $date = date("Ymd");
    $RootDir = $_SERVER['DOCUMENT_ROOT'];
    $logFile = $RootDir . "_logs/log_" . $interface . "_" . $date . ".log";
    $ip = $_SERVER["REMOTE_ADDR"];
    if ($ip == '127.0.0.1') {
        $country = '本地';
        $province = '本地';
        $city = '本地';
    } else {
        $country = iconv('UTF-8', 'GBK//IGNORE', GetIpLookup($_SERVER["REMOTE_ADDR"])['country']);
        $province = iconv('UTF-8', 'GBK//IGNORE', GetIpLookup($_SERVER["REMOTE_ADDR"])['province']);
        $city = iconv('UTF-8', 'GBK//IGNORE', GetIpLookup($_SERVER["REMOTE_ADDR"])['city']);
    }
    $url = "http://" . $_SERVER['SERVER_NAME'] . "" . $_SERVER['REQUEST_URI'];
    $addrs = mysql_query("INSERT INTO logs VALUES(NULL,'{$datetime}','{$ip}','{$country}','{$province}','{$city}','{$url}','{$info}')");
    if ($addrs) {
        return true;
    } else {
        #echo "INSERT INTO logs VALUES(NULL,'$datetime','$ip','$url','$info')";
        return false;
    }
    //$logf = fopen($logFile, "w");
    //file_put_contents($logFile,$datetime." - ".$ip." - ".$url." - ".$info."\r\n",FILE_APPEND);
    //$myfile = fopen($logFile, "a");
    //fwrite($myfile, $datetime." - ".$ip." - ".$url." - ".$info."\r\n");
    //fclose();
}
Exemplo n.º 2
0
    $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename($this->table_log) . " WHERE uniacid= :uniacid  {$Where} AND ip = :ip order by `ip` desc ", array(':uniacid' => $uniacid, ':ip' => $v['ip']));
    $tvtotal[$v[ip]] .= $total;
}
arsort($tvtotal);
$html .= '统计情况' . "\t ,";
$html .= '排行' . "\t ,";
$html .= '相同IP' . "\t ,";
$html .= '地区' . "\t ,";
$html .= '投票次数' . "\t ,";
$html .= "\n";
$n = 0;
foreach ($tvtotal as $mid => $t) {
    if ($n == 15) {
        break;
    }
    $ip = GetIpLookup($mid);
    $ip = $ip['country'] . '  ' . $ip['province'] . '  ' . $ip['city'] . '  ' . $ip['district'] . '  ' . $ip['ist'];
    $html .= '' . "\t ,";
    $html .= $n + 1 . "\t ,";
    $html .= $mid . "\t ,";
    $html .= $ip . "\t ,";
    $html .= $t . '次' . "\t ,";
    $html .= "\n";
    $n++;
}
$now = date('Y-m-d H:i:s', time());
if ($keyword) {
    $k = $keyword . ' 的';
}
$filename = $k . '投票记录情况' . '_' . $rid . '_' . $now;
header("Content-type:text/csv");
Exemplo n.º 3
0
 function getiparr($ip)
 {
     $ip = GetIpLookup($row['ip']);
     $iparr = array();
     $iparr['country'] .= $ip['country'];
     $iparr['province'] .= $ip['province'];
     $iparr['city'] .= $ip['city'];
     $iparr['district'] .= $ip['district'];
     $iparr['ist'] .= $ip['ist'];
     $iparr = iserializer($iparr);
     return $iparr;
 }
Exemplo n.º 4
0
 public function goods_type()
 {
     /* templet2专用数据设置start */
     //下拉导航
     $isindex = 'Y';
     /* templet2专用数据设置end */
     //最新商品
     $new_shop = $this->db->GetOne("select * from `@#_shoplist` where `pos` = '1' and `q_uid` is null ORDER BY `id` DESC LIMIT 4");
     //分区云购下面的奢侈品 cat_id=5
     $new_goods = $this->db->GetList("select * from `@#_shoplist` where `q_uid` is null and `cateid`=5 and `goods_type`=3 ORDER BY `id` ASC LIMIT 8");
     //精品电器cateid=13
     $electrical_goods = $this->db->GetList("select * from `@#_shoplist` where `q_uid` is null and `cateid`=13 and `goods_type`=3 ORDER BY `id` DESC LIMIT 6");
     //汽车配件cateid=6
     $car_goods = $this->db->GetList("select * from `@#_shoplist` where `q_uid` is null and `cateid`=6 and `goods_type`=3 ORDER BY `id` DESC LIMIT 6");
     //服饰百货 cateid=12
     $cloth_goods = $this->db->GetList("select * from `@#_shoplist` where `q_uid` is null and `cateid`=12 and `goods_type`=3 ORDER BY `id` DESC LIMIT 6");
     //母婴美妆 cateid=14
     $mother_goods = $this->db->GetList("select * from `@#_shoplist` where `q_uid` is null and `cateid`=14 and `goods_type`=3 ORDER BY `id` DESC LIMIT 6");
     //生活用品 cateid=17
     $life_goods = $this->db->GetList("select * from `@#_shoplist` where `q_uid` is null and `cateid`=17 and `goods_type`=3 ORDER BY `id` DESC LIMIT 6");
     //即将揭晓
     $shoplist = $this->db->GetList("select * from `@#_shoplist` where `q_uid` is null ORDER BY `shenyurenshu` ASC LIMIT 8");
     //人气商品
     $shoplistrenqi = $this->db->GetList("select * from `@#_shoplist` where `renqi`='1' and `q_uid` is null ORDER BY id DESC LIMIT 6");
     $max_renqi_qishu = 1;
     $max_renqi_qishu_id = 1;
     if (!empty($shoplistrenqi)) {
         foreach ($shoplistrenqi as $renqikey => $renqiinfo) {
             if ($renqiinfo['qishu'] >= $max_renqi_qishu) {
                 $max_renqi_qishu = $renqiinfo['qishu'];
                 $max_renqi_qishu_id = $renqikey;
             }
         }
         $shoplistrenqi[$max_renqi_qishu_id]['t_max_qishu'] = 1;
     }
     $this_time = time();
     if (count($shoplistrenqi) > 1) {
         if ($shoplistrenqi[0]['time'] > $this_time - 86400 * 3) {
             $shoplistrenqi[0]['t_new_goods'] = 1;
         }
     }
     //他们正在云购
     $go_record = $this->db->GetList("select `@#_member`.uid,`@#_member`.username,`@#_member`.email,`@#_member`.mobile,`@#_member`.img,`@#_member_go_record`.shopname,`@#_member_go_record`.shopid from `@#_member_go_record`,`@#_member` where `@#_member`.uid = `@#_member_go_record`.uid and `@#_member_go_record`.`status` LIKE '%已付款%'  ORDER BY `@#_member_go_record`.time DESC LIMIT 0,10");
     //最新揭晓
     $shopqishu = $this->db->GetList("select qishu,id,sid,thumb,title,q_uid,q_user from `@#_shoplist` where `q_end_time` is not null and `q_showtime` = 'N' ORDER BY `q_end_time` DESC LIMIT 4");
     //云购动态
     $tiezi = $this->db->GetList("select * from `@#_quanzi_tiezi` where `qzid` = '1' order by `time` DESC LIMIT 5");
     //晒单分享
     $shaidan = $this->db->GetList("select * from `@#_shaidan` order by `sd_id` DESC LIMIT 2");
     $shaidan_two = $this->db->GetList("select * from `@#_shaidan` order by `sd_id` DESC LIMIT 2,6");
     //获取IP
     $info = GetIpLookup('123.125.114.144');
     $city = $info['city'];
     //分区云购“分配标志”
     $flag = 3;
     include templates("index", "area");
 }