before data processing and saving, first determine how the browser gets the page. Using $_server
["Request_method"] variable to get the browser to get the page way. Check to see if it is "POST". In the
A session is used in the script to record whether the user has passed the normal path (that is, the page that filled the submission) could be free
data. or use $_server["http_referer"] to detect, but this is not recommended. Because part of the Bangs
Referer is not set, some firewalls will also block referer. In addition, we also want to submit
Check to see if there is duplicate content in the database. Take the message book as an example, use the session to determine:
fill in the content of the page, we added at the front end:
$_session["Allowgbookpost"]=time ();//time when registration is completed
on the page where the message is received and saved we also use the session before we can process data
the following processing:
if (Strtoupper ($_server["Request_method"])! = "POST") {die ("error: Do not outside
submitted by the Ministry. "); } Check if the page Get method is post
if (!isset ($_session["Allowgbookpost"]) or
(Time ()-$_session["Allowgbookpost"] < 10)) {Die ("error: do not submit externally.
"); } Check the time when the message was filled out
if (isset ($_session["Gbookposttime"]) and
(Time ()-$_session["Gbookposttime"] < 120)) {Die ("error: two times to submit a message
not less than 2 minutes apart. "); } Check the message interval
unset ($_session["Allowgbookpost"]);//unregister allowgbookpost variable to prevent one-step
submit in the Fill page multiple times
$_session["Gbookposttime"]=time ();//Register the time to send messages to prevent flooding or malicious attacks
...
data processing and preservation
...
The above on the introduction of PHP to prevent brush screen, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.