add moe api log

master
IoTcat 5 years ago
parent f5346da898
commit 417ac8f4d1
  1. 2
      server/cn/home/www/api/www-api/moe/index.php
  2. 20
      server/cn/home/www/functions.php

@ -10,7 +10,6 @@ $n_loli = 120;
$n_normal = 149; $n_normal = 149;
$n_star = 10; $n_star = 10;
$r = $_REQUEST['i']; $r = $_REQUEST['i'];
if(isset($_REQUEST['i'])) $r = $_REQUEST['i']; if(isset($_REQUEST['i'])) $r = $_REQUEST['i'];
@ -70,6 +69,7 @@ if(!isset($_REQUEST['k'])){
} }
} }
yimian__log("log_api", array("api" => "moe", "timestamp" => date('Y-m-d H:i:s', time()), "ip" => ip2long(get_ip()), "_from" => get_from(), "content" => $r."/".$id));
die(); die();

@ -365,9 +365,18 @@ function db__antisql($str)
} }
/*****log******/
function yimian__log($table, $val){
db__pushData(db__connect("log"), $table, $val);
}
/***tools***/ /***tools***/
//fnct of get usr ip::()::(ip) //fnct of get usr ip::()::(ip)
function getip() function get_ip()
{ {
if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
{ {
@ -395,6 +404,15 @@ function getip()
return ($ip); return ($ip);
} }
/** get from address **/
function get_from(){
if($_SERVER['remote_addr']) return $_SERVER['remote_addr'];
elseif($_SERVER['HTTP_HOST']) return $_SERVER['HTTP_HOST'];
elseif($_SERVER['HTTP_REFERER']) return $_SERVER['HTTP_REFERER'];
elseif($_REQUEST['from']) return $_REQUEST['from'];
}
/**functions for aplayer**/ /**functions for aplayer**/
//put this function to where you want the aplayer to dispaly //put this function to where you want the aplayer to dispaly

Loading…
Cancel
Save