原来的网页版脚本不能用了,今天找到了大佬提供的 php 多用户版本,大家请食用。
1.把下面脚本保存为.php
文件放在服务器内
- <?php
- $useList = array(
- //用户名/密码可添加多行
- ‘username’=>‘passwd’,
- ‘username’=>‘passwd’,
- ‘username’=>‘passwd’,
- );
- header(“Content-Type: text/html; charset=utf-8”);
- foreach($useList as $k=>$v){
- locSign($k,$v);
- }
- function locSign($use,$pwd){
- $html = http_post(‘https://www.<a href=”https://www.4uvm.com/tag/hostloc” title=”查看更多关于 hostloc 的文章” target=”_blank”>hostloc</a>.com/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1’,‘fastloginfield=username&username=’.urlencode($use).‘&cookietime=2592000&password=’.urlencode($pwd).‘&quickforward=yes&handlekey=ls’);
- if(!strrpos($html,‘window.location.href’)){echo $use.‘ login error<br>’;return false;}
- $cookie = getCookie($html,‘Set-Cookie: ‘,‘;’);
- for($i=26200; $i<=26230; $i++){ //访问空间 id 可改变 建议多于 10 次,因为有可能访问到封号或者删号的空间
- $html = http_get(“https://www.hostloc.com/space-uid-{$i}.html”,$cookie);
- }
- echo $use.‘ Sign ok!!!<br>’;
- }
- function http_get($url,$cookie) {
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($ch, CURLOPT_HTTPHEADER,array(‘User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0’,‘Referer: https://www.hostloc.com/forum-45-1.html’,‘Cookie: ‘.$cookie));
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- $src = curl_exec($ch);
- curl_close($ch);
- return $src;
- }
- function http_post($url,$body){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_HEADER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER,array(‘User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0’,‘Referer: https://www.hostloc.com/forum.php’));
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
- $result = curl_exec($ch);
- curl_close($ch);
- return $result;
- }
- function getCookie($str,$leftStr,$rightStr){
- if(strrpos($str,$leftStr) == false || strrpos($str,$rightStr) == false){return ”;}
- $arr1 = explode($leftStr,$str);$i = 0;$cookie = ”;
- foreach($arr1 as $k=>$v){$i++;if($i > 1){$arr2 = explode($rightStr,$v);$cookie .= $arr2[0].‘; ‘;}}
- return $cookie;
- }
安装宝塔的朋友可以在计划任务里添加
设定每天访问一次脚本即可。