全球小号主机论坛,每天可以通过访问用户空间的形式增加20积分【光明正大0贴水上元老神仙】,有各路大佬早就做好了各种刷分脚本python
啊php
啊各种各样。
这里记录一下可在论坛开启防cc的模式下刷分签到的php
脚本。做一个备份。【并不可以,没有设置时间间隔,建议调整时间间隔或者设置不同时间段的多个任务】
宝塔面板直接新建空白文件,填入文件名,进行编辑,默认格式UTF-8
以UTF-8格式进行编辑,建立php
文件,比如文件名叫hostloc.php
填入代码如下文【最后面】。
同样以UTF-8格式进行编辑,建立id.txt
,这里是填写账号密码用的,每行一个,格式:
用户名#密码
将这两个文件放在同一个路径下,比如我放在/media/locsign
里面。
随后在设置定时访问就行了,无论宝塔新建计划任务,还是直接添加crontab任务。
宝塔新建定时任务的话就点击计划任务
,然后
任务类型:Shell脚本
任务名称:随意填写
执行周期:每天,然后时间自定义
脚本内容填写:php /media/locsign/hostloc.php
然后每天就可以自动访问hostloc签到刷分了。如果今天还没刷过,就直接点执行就好了。
添加crontab
定时的话,比如每天1点签到,则终端输入:
crontab -e
按a
在当前光标右边添加文本。
然后将以下粘贴至终端,按ESC
,输入:wq
保存退出
0 1 * * * php /media/locsign/hostloc.php >> /media/locsign/hostloc.log 2>&1
php刷分脚本
<?php
$cookie_name = $cookie_val = '';
$lines = file(dirname(__FILE__).'/id.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(
"username" => $username,
"password" => $password,
"fastloginfield" => "username",
"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 = rand(0,30000);
curl_get($spaceUrl = "https://www.hostloc.com/space-uid-{$uid}.html");
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){
global $cookie_name, $cookie_val;
while(true){
$res = do_curl_post($url, $post_data);
preg_match("/cookie=\"(\w*?)\=(\w*)/", $res, $preg_cookie);
preg_match("/href=\"(.*?)\"/", $res, $preg_url);
if(!empty($preg_cookie[1])){
$cookie_name = $preg_cookie[1];
$cookie_val = $preg_cookie[2];
$res = do_curl_post($preg_url[1], $post_data);
}else{
break;
}
sleep(1);
}
return $res;
}
function do_curl_post($url, $post_data){
global $cookie_name, $cookie_val;
$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,600);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.hostloc.com/');
if(!empty($cookie_name)){
curl_setopt($ch, CURLOPT_COOKIE, "$cookie_name=$cookie_val;");
}
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
function curl_get($url){
global $cookie_name, $cookie_val;
$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,600);
if(!empty($cookie_name)){
curl_setopt($ch, CURLOPT_COOKIE, "$cookie_name=$cookie_val;");
}
$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);
}
文章参考来源: