Javascript 而(1)JSON注入
我读了这篇文章 可以帮助什么样的php脚本呢 我试着Javascript 而(1)JSON注入,javascript,php,ajax,json,Javascript,Php,Ajax,Json,我读了这篇文章 可以帮助什么样的php脚本呢 我试着 $time=time(); $hash=md5(mt_rand(1,200000)); $arr = array('time' => $time, 'hash' => $hash); while(1);json_encode($arr); 我的回答有错误 致命错误:第6行的C:\xampp\htdocs\foo\1.php中超过了30秒的最大执行时间非常感谢Girish 作品: 1.php <?php $time=tim
$time=time();
$hash=md5(mt_rand(1,200000));
$arr = array('time' => $time, 'hash' => $hash);
while(1);json_encode($arr);
我的回答有错误
致命错误:第6行的C:\xampp\htdocs\foo\1.php中超过了30秒的最大执行时间
非常感谢Girish 作品: 1.php
<?php
$time=time();
$hash=md5(mt_rand(1,200000));
$arr = array('time' => $time, 'hash' => $hash);
echo "while(1);".json_encode($arr);
它正在执行一个无限循环并对$arr进行编码,为什么要这样做?您应该将JSON字符串数据
echo“while(1);”作为字符串附加。JSON_encode($arr)
@Girish yesp,发出请求的客户端应在(1)时去除代码>在解析JSON响应之前。的可能重复项
responseText=req.responseText.substring(9);
var obj=JSON.parse(responseText);
statusElem.innerHTML = obj.hash