I'm curious about how the website was tampered with. Which of the following experts said that the website statistics were tampered?

Source: Internet
Author: User
I'm curious, how did I tamper with it, the website statistics were tampered with. at last, the post was edited by xjl756213616 from 2013 to 10-3650. The total number of statistics was changed to more than 50 by. The Post was changed by this morning, it seems that the IP address code in Guangdong and Shenzhen is as follows & lt ;? Php $ file_name $ _ REQUEST [name]; $ file _ I'm curious about how the website was tampered with. who said the website statistics were tampered?

This post was last edited by xjl756213616 at 09:16:19, January 22 ,.

The number of statistics has been changed.
Originally, more than 3650 million
It was changed to more than 50. it was changed at this morning. it looks like the IP address in Guangdong and Shenzhen.




The code is as follows:
 $ File_name = $ _ REQUEST ['name'];
$ File_name = iconv ("UTF-8", "gb2312", $ file_name );
$ File_dir = "./download /";
If (! File_exists ($ file_dir. $ file_name ))
{
Echo "file not found! ";
Exit;
}
Else
{
Header ("Content-Type: text/plain ");
Header ("Accept-Ranges: bytes ");
Header ("Content-Disposition: attachment; filename =". $ file_name );
$ File = fopen ($ file_dir. $ file_name, "r ");
Echo fread ($ file, filesize ($ file_dir. $ file_name ));
Fclose ($ file );
$ Num = file_get_contents ("./num. dat ");
$ Num = (int) ($ num) + 1;
File_put_contents ("./num. dat", $ num );
Exit;
}
?>

Share:


------ Solution --------------------
1. programs can be used to download arbitrary files.

2. text counters. after reading the data, you may write data first from modifying the data to writing data, which leads to inaccurate data.
------ Solution --------------------
$ Num = file_get_contents ("./num. dat ");
$ Num = (int) ($ num) + 1;
File_put_contents ("./num. dat", $ num );

Do I need to lock the Write file? Data will inevitably be lost due to concurrency
------ Solution --------------------
Use a database. More accurate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.