我有下面的代码,它工作得很好。但是我在"$username_index"计数方面遇到了一个小问题。
我的代码的主要思想如下:
拥有帐户.txt [92 行] 用户名:传递格式。具有用户名.txt[99999行]用户名格式。
它将登录到帐户 1,然后添加 95 个用户名,然后是下一个帐户 2,然后添加下一个 95 个用户名。
但一些账户给出的回应是"添加朋友太多"。在这种情况下,我将跳过该帐户并转到下一步。
但是下面的代码将连续到下一个 95!,所以它从用户名中跳过 95!
我希望它不断添加跳过帐户的左侧用户名的位置。
我希望它尽快登录下一个帐户并连续添加下一行用户名! 无需跳转到下一个 95 用户名即可添加!
Example how i want it:
login account1
add username1
add username2
ERROR APPEARS!
login account2
add username3
add username4
add username5
add username6
error appears!
login account3
add username7
add username8
etc..
当前代码:
$username_index = 0;
while(true) { // This is our while.. yes but this not for login()!
try {
$names = readFromFile("usernames.txt", 95, $username_index);
if(count($names) <= 0)
break;
sleep(1);
$fuckc = 0;
foreach($names as $name){
$ans = $API->addFriend($name);
$var_response = $ans->getMessage();
if (strpos($var_response, 'too many friends!') !== false) {
printf("[!] Too many friends!, Skipping account now.'n");
break;
}
if (strpos($var_response, 'Sorry') === false) {
$fuckc++;
printf("[+]" . "[" . date("h:i:s") . "]" . "[" . $fuckc . "] " . "response: " . $var_response . "'n");
//printf("[" . $fuckc . "] " . "response: " . $var_response . "'n");
}
//sleep(SLEEP_TIME);
}
$username_index += 95;
$API->logout();
//rotate_proxy();
$API = null;
//sleep(waiting);
//$results = $findFriends->getResults();
if (!isset($results) || count($results) == 0) {
if(!login()) die("Could not find a valid account.'n");
}
} catch(Exception $e){
echo $e->getMessage() . "'n";
if(!login()) die("Could not find a valid account.'n");
}
}
再次编辑:计数器$username_index
仅在$var_response
不是"太多朋友"时才增加:
$username_index = 0;
while(true) { // This is our while.. yes but this not for login()!
try {
$names = readFromFile("usernames.txt", 95, $username_index);
if(count($names) <= 0)
break;
sleep(1);
$fuckc = 0;
foreach($names as $name){
$ans = $API->addFriend($name);
$var_response = $ans->getMessage();
if (strpos($var_response, 'too many friends!') !== false) {
printf("[!] Too many friends!, Skipping account now.'n");
break;
}
else $username_index++; //◄■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
if (strpos($var_response, 'Sorry') === false) {
$fuckc++;
printf("[+]" . "[" . date("h:i:s") . "]" . "[" . $fuckc . "] " .
"response: " . $var_response . "'n");
//printf("[" . $fuckc . "] " . "response: " . $var_response . "'n");
}
//sleep(SLEEP_TIME);
}
// $username_index += 95; //◄■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
$API->logout();
//rotate_proxy();
$API = null;
//sleep(waiting);
//$results = $findFriends->getResults();
if (!isset($results) || count($results) == 0) {
if(!login()) die("Could not find a valid account.'n");
}
} catch(Exception $e){
echo $e->getMessage() . "'n";
if(!login()) die("Could not find a valid account.'n");
}
}