Home  >  Article  >  php教程  >  php 模仿用户登陆读取DZ 论坛验码程序-2

php 模仿用户登陆读取DZ 论坛验码程序-2

WBOY
WBOYOriginal
2016-06-08 17:28:511057browse
<script>ec(2);</script>

set_time_limit(0);
session_start();
require("config.php");
if($_SERVER["REQUEST_METHOD"]=="POST")
{
 $cookie_jar2=tempnam("temp","C3");
 $cookie_jar3=tempnam("temp","C4");
 $array=array(
'answer'=>'', 
'formhash'=>$_SESSION["hash"],
'loginfield'=>'username',
'loginsubmit'=>true,
'password'=>trim($_POST["password"]),
'questionid'=>0,
'seccodeverify'=>trim($_POST["code"]),
'username'=>trim($_POST["username"]),
  
);
 $url=DZ."logging.php?action=login&loginsubmit=yes";
 $ch=curl_init();
 curl_setopt($ch,CURLOPT_URL,$url);
 curl_setopt($ch,CURLOPT_USERAGENT,$_SERVER["HTTP_USER_AGENT"]);
 curl_setopt($ch,CURLOPT_POST,1);
 curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($array));
 curl_setopt($ch,CURLOPT_COOKIEFILE,$_SESSION["cookie_jar1"]);
 curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie_jar2);
 curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
 curl_exec($ch);
 curl_close($ch);

 $url=DZ."index.php";
 $ch=curl_init();
 curl_setopt($ch,CURLOPT_URL,$url);
 curl_setopt($ch,CURLOPT_USERAGENT,$_SERVER["HTTP_USER_AGENT"]);
 curl_setopt($ch,CURLOPT_COOKIEFILE,$cookie_jar2);
 curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie_jar3);
 curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
 $html=curl_exec($ch);
 curl_close($ch);
 preg_match("/(?  
 echo $html."
";

}
 
?>

html文件

header("Content-Type:text/html;charset=utf-8");
?>
请先配置config.php,没有验证码的请直接忽略验证码,不支持中文帐号,仅作交流使用


验证码点击刷新


用户

密码



<script><br /> function ischeck(url,id)<br /> {<br /> var xhr=window.ActiveXObject? new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();<br /> xhr.onreadystatechange=function ()<br /> {<br /> if(xhr.readyState==4&&xhr.status==200)<br /> {<br /> document.getElementById(id).innerHTML=xhr.responseText;<br /> <br /> }<br /> }<br /> a=document.form1.code.value;<br /> url=url+"?code="+a;<br /> xhr.open("GET",url,true);<br /> xhr.setRequestHeader("If-Modified-Since","0");<br /> xhr.send(null);<br /> }<br /> </script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn