Use PHP to add logging function code to SHOPEX_PHP tutorial

WBOY
Release: 2016-07-21 15:36:26
Original
921 people have browsed it

Especially knowing which spiders have visited this site, the frequency of visits, pages, and ordinary site statistics cannot be solved.

Although I know very little about PHP, with the development experience of .NET and the help of Baidu, I still completed it quickly. Although it is simple, don’t laugh.

Copy the code The code is as follows:

// Insert into the index.php code block on the SHOPEX homepage
/ / Checking variables in PHP is actually quite simple
// Using a function phpinfo() is enough to check
$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);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322111.htmlTechArticleEspecially like knowing which spiders have visited this site, the frequency of visits, pages, and general site statistics. It cannot be solved. Although I know very little about PHP, with the development of .NET...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!