Add logging functionality to SHOPEX with PHP

  • 2020-03-31 20:50:49
  • OfStack

In particular, like know which spiders to the site to visit, visit the frequency, pages, general site statistics are unable to solve.

Although I know little about PHP, but with the development of. NET experience, with the help of baidu is still very quickly completed, although simple, we don't laugh.

 
//Insert the SHOPEX home page index. PHP code block
//It's easy to look at variables in PHP
//One function, phpinfo(), is enough to see
$fp = fopen("log.txt","a+"); 
fwrite($fp,date("Y-m-d H:i:s")); 
fwrite($fp,"t"); 
fwrite($fp,$_SERVER['REMOTE_ADDR']); 
fwrite($fp,"t"); 
fwrite($fp,$_SERVER['HTTP_X_REWRITE_URL']); 
fwrite($fp,"t"); 
fwrite($fp,$_SERVER['HTTP_USER_AGENT']); 
fwrite($fp,"t"); 
fwrite($fp,$_SERVER["HTTP_REFERER"]); 
fwrite($fp,"n"); 
fclose($fp); 

Related articles: