PHP prevents spoofed data from being submitted from URL methods.
In the case of spoofed data being submitted from a URL, the first one is to check the following code from the previous page source:
/*PHP prevents data from being submitted outside the station */function checkurl () {$servername=$_server [' server_name '$sub _from=$_server["Http_referer"$sub _len =strlen($servername$checkfrom=substr($sub _ from, 7,$sub _lenif($checkfrom! =$servername) die ("Warning! You are submitting data from outside! Please terminate immediately! "); }? >
This method only prevents URLs that are entered manually on the browse bar.
In fact, as long as a hyperlink to the URL is constructed on the server (www.jbxue.com), such as when a hyperlink is added to a post, and then clicked, this check will not work at all.
At present, it is more reliable to transmit important data by post method.
You can insert some hidden text into the form to pass the data.
Or, use Ajax to submit data from the client to the server using the following method.
/*Create a Xhr object*/functioncreatexhr () {if(Window.XMLHttpRequest) {varOhttp =NewXMLHttpRequest ();returnOhttp;} Www.jbxue.comElse if(Window.ActiveXObject) {varversions = ["msxml2.xmlhttp.6.0", "msxml2.xmlhttp.3.0"]; for(vari = 0; i < versions.length; i++){Try {varOhttp =NewActiveXObject (Versions[i]);returnOhttp;} Catch(Error) {} }}Throw NewError ("Your browser does not support ajax! ");}/*using AJAX to pass data to page pages*/functionAjaxpost (url,query_string= "){varXHR;XHR=createxhr (); XHR. Open (' POST ', url,false); XHR. setRequestHeader ("Content-type", "application/x-www-form-urlencoded; charset=gb2312 "); XHR. onreadystatechange =function(){if(Xhr.readystate = = 4)if(Xhr.status! = 200)return;} XHR.Send (query_string);}
http://www.bkjia.com/PHPjc/819110.html www.bkjia.com true http://www.bkjia.com/PHPjc/819110.html techarticle PHP prevents spoofed data from being submitted from URL methods. In the case of spoofed data being submitted from a URL, the first is a check of the following code from the previous page source:? /* PHP prevents data from being submitted outside the station ...