2016-07-14 8 views
0

Ich habe dies unter Code, es funktioniert perfekt. Aber ich habe ein kleines Problem mit der Zählung "$ username_index".Loop "Addfriend" zählen Problem

die Hauptidee meines Codes folgt:

accounts.txt [92 Zeilen] Benutzername mit: Pass-Format. mit usernames.txt [99999 Zeilen] Benutzernamen Format.

Es wird sich in account1 einloggen, dann wird es 95 Benutzernamen hinzufügen, dann next account2, dann die nächsten 95 Benutzernamen hinzufügen.

Aber einige Konten geben Antwort "Zu viele Freunde hinzufügen". In diesem Fall werde ich den Account überspringen und mit dem nächsten fortfahren.

Aber unter dem Code wird weiter zu den nächsten 95!, So dass es 95 von Nutzernamen überspringen!

Ich möchte es continue hinzufügen, wo der linke Benutzername von übersprungenen Konto.

Ich möchte es, sobald es auf dem nächsten Konto anmelden und CONTIUING die nächste Zeile der USERNAMES hinzufügen wird! Du musst nicht zum nächsten 95 Benutzernamen springen, um hinzuzufügen!

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.. 

Aktuelle Code:

$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"); 
    } 
} 

Antwort

0

Herausgegeben wieder: der Zähler $username_index nur increasse wenn $var_response nicht "zu viele Freunde!" :

$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"); 
    } 
} 
+0

Vielen Dank für Ihr Interesse. Der Code wird zum nächsten Konto verschoben, wenn ein Fehler auftritt oder wenn 95 hinzugefügt wird. das ist es. –

+0

@mzabox, was ist das Problem jetzt? Ich bin hier, um es zu reparieren. –

+0

Jetzt funktioniert Ihr Code perfekt, aber es stoppt für plötzlich, es ist keine Endlosschleife. –