• 难啊难!要钱难!
  • 更新到WordPress5.6啦
  • 有点伤心了,今年净遇到王某海这种人.
  • 难啊难...
  • 七牛的JS SDK 的文档真坑啊.
  • 蓝奏云分享部分地区无法访问需手动修改www.lanzous.com变为:www.lanzoux.com
  • 好气啊~原来使用的CDN服务商莫名其妙的给我服务取消了~
  • 遇见一个沙雕汽车人.
  • 换了证书看看测试一下效果~
  • 煞笔!啥时候开工资?

HostLoc论坛自动签到脚本

PHP KIENG 2年前 (2020-03-08) 84709次浏览 已收录 1个吐槽 扫描二维码

记录一下省的下回找不到.

<?php

$lines = file(dirname(__FILE__).'/list.txt');

foreach($lines as $line){
        list($username, $password) = explode('#', $line);
        $username = trim($username);
        $password = trim($password);
        if(empty($username) || empty($password)){
                continue;
        }


        $suburl = "https://www.hostloc.com/member.php?mod=logging&action=login";
        $loginInfo = array(
          		"fastloginfield" => "username",
                "username" => $username,
                "password" => $password,
                "quickforward" => "yes",
                "handlekey" => "ls",
                "loginsubmit" => true
        );

        echo "login($username) ... ";
        $login = curl_post($suburl,$loginInfo);
        
        if(strpos($login, $username) !== FALSE){

                preg_match("/>用户组: (.*?)<\/a>/", $login, $preg);
                $group = $preg[1];
                echo "Success!($group)\n";
        }else{
                echo "Failed!\n\n";
                continue;
        }
        extract(get_jf());
        echo "Credit: $credit; Money: $money\n";

        echo "Visting user space ";
        for($i=0;$i<20;$i++){
                $uid = mt_rand(10000,20000);
                curl_get('https://www.hostloc.com/space-uid-'.$uid.'.html');
          		sleep(1);
                echo ".";
        }
        echo " done!\n";
        extract(get_jf());
        echo "Credit: $credit; Money: $money\n\n";


}

function get_jf(){
        $data = array();
        $html = curl_get("https://www.hostloc.com/home.php?mod=spacecp&ac=credit&op=base");
        preg_match("/积分: (\d+)<\/a>/", $html, $preg);
        if(!empty($preg[1])){
                $data['credit'] = $preg[1];
        }else{
                $data['credit'] = 0;
        }
        preg_match("/金钱: <\/em>(\d+)/", $html, $preg);
        if(!empty($preg[1])){
                $data['money'] = $preg[1];
        }else{
                $data['money'] = 0;
        }

        return $data;
}

function curl_post($url, $post_data){
    $ch = curl_init ();
    curl_setopt($ch, CURLOPT_POST , 1);
    curl_setopt($ch, CURLOPT_HEADER , 0);
    curl_setopt($ch, CURLOPT_URL , $url);
    curl_setopt($ch, CURLOPT_COOKIEJAR , '/tmp/hostloc.cookie');
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:'.rand_ip())); 
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible;Baiduspider-render/2.0; +http://www.baidu.com/search/spider.html)');
    curl_setopt($ch, CURLOPT_POSTFIELDS , $post_data);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    //curl_setopt($ch, CURLOPT_TIMEOUT,6000);
    curl_setopt($ch, CURLOPT_REFERER, 'https://www.hostloc.com/');
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}


function curl_get($url){
    $ch = curl_init ();
    curl_setopt($ch, CURLOPT_HEADER , 0);
    curl_setopt($ch, CURLOPT_URL , $url);
    curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/hostloc.cookie');
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:'.rand_ip())); 
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible;Baiduspider-render/2.0; +http://www.baidu.com/search/spider.html)');
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT,6000);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}

function rand_ip(){
    return rand(1,255).'.'.rand(1,255).'.'.rand(1,255).'.'.rand(1,255);
}

另存为 loc.php

新建一个 list.txt

格式为:

账号#密码
账号#密码....

KIENG , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA 4.0协议进行授权
转载请注明出处:HostLoc 论坛自动签到脚本
本文章链接:https://blog.kieng.cn/2229.html
喜欢 (14)
KIENG
关于作者:
一个热衷网络的Man
发表我的评论
取消评论
表情 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 快速获取昵称
  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(1)个小伙伴在吐槽
  1. 不错
    e.2020-04-12 01:39 回复 Windows 10 | Chrome 78.0.3904.108