darkfreaks Posted January 25, 2010 Share Posted January 25, 2010 hey guys im using a script i coded that uses the php file() function to grab text off a webpage and return it however i have it set up so if it doesnt match a certain text to return the content of the page but when i echo it out i get the form then the word Array=> what am i doing wrong <?php $user=$_POST['user']; if(empty($user)){ ?> <form method="post"> <input type="text" name="user"> <input type="submit" name="submit" value="Assimilate!"> </form> <?php }else{ $url='http://vampirefreaks.com/profile.php?user='; $user=$_POST['user']; $file = file("$url$user"); foreach($file as $lines) { $line=strip_tags($lines); $line=trim("$line"); if ($line != ''){ $line=preg_replace('/\s+/',' ',$line); $line=preg_replace('/\s+$/',' ',$line); //echo "$line<br>\n"; $form='<form method="post"> <input type="text" name="user"> <input type="submit" name="submit" value="Assimilate!"> </form>'; if($line == 'THIS USER DOES NOT EXIST'){$message="this user is dead<br />$form";break;} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion:') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Picture Theft') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: pervert') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Nudity. You left out the word "demented looking" from your username btw.') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Nudity') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Previously deleted pervert.') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: inappropriate images') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Previously Deleted Pervert') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Spamming') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: prev. deleted pedo') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: This Is Not A Sex Site.') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Spam') {$message="$line $user $form";} if ($line == 'THIS USER HAS BEEN DELETED BY VF ADMIN Reason for Deletion: Picture Theft') {$message="$line $user $form";} if($line=='This User Has Been Suspended') { $by=$reason = next($file);//gets the next pointer in the array $reason = next($file);//gets the next pointer in the array $message="$user Has Been Suspended By VF Admin For:$by$reason$form"; } } } if ($message) { echo "<font color=red>$message</font>";} else{ echo'<form method="post"> <input type="text" name="user"> <input type="submit" name="submit" value="Assimilate!"> </form>'; echo "$file"; } } ?> Link to comment https://forums.phpfreaks.com/topic/189761-file-array-error/ Share on other sites More sharing options...
wildteen88 Posted January 25, 2010 Share Posted January 25, 2010 i get the form then the word Array=> what am i doing wrong I cant tell you what is wrong without seeing your code. Link to comment https://forums.phpfreaks.com/topic/189761-file-array-error/#findComment-1001429 Share on other sites More sharing options...
darkfreaks Posted January 25, 2010 Author Share Posted January 25, 2010 i edited it in Link to comment https://forums.phpfreaks.com/topic/189761-file-array-error/#findComment-1001433 Share on other sites More sharing options...
gizmola Posted January 25, 2010 Share Posted January 25, 2010 Is vampirefreaks.com your site? Link to comment https://forums.phpfreaks.com/topic/189761-file-array-error/#findComment-1001436 Share on other sites More sharing options...
darkfreaks Posted January 25, 2010 Author Share Posted January 25, 2010 no it is a site i am pulling the info off of Link to comment https://forums.phpfreaks.com/topic/189761-file-array-error/#findComment-1001437 Share on other sites More sharing options...
wildteen88 Posted January 25, 2010 Share Posted January 25, 2010 To output the contents of an array you need to use print_r eg echo '<pre>'.print_r($file,true).'</pre>'; Link to comment https://forums.phpfreaks.com/topic/189761-file-array-error/#findComment-1001438 Share on other sites More sharing options...
darkfreaks Posted January 25, 2010 Author Share Posted January 25, 2010 tried that but then i get Array=> 1-100 then the contents of the page. however this all worked before i put in the following if statement <?php if($line=='This User Has Been Suspended') { $by=$reason = next($file);//gets the next pointer in the array $reason = next($file);//gets the next pointer in the array break; $message="$userHas Been Suspended By VF Admin For:$by$reason$form"; }?> is it possible it is not exiting the arrayed next loop? Link to comment https://forums.phpfreaks.com/topic/189761-file-array-error/#findComment-1001445 Share on other sites More sharing options...
darkfreaks Posted January 25, 2010 Author Share Posted January 25, 2010 blah i took the else statement out until i can get an answer why $file is coming out with array() instead of getting the page content. i will leave this open. for now. :-\ Link to comment https://forums.phpfreaks.com/topic/189761-file-array-error/#findComment-1001467 Share on other sites More sharing options...
darkfreaks Posted January 25, 2010 Author Share Posted January 25, 2010 nevermind problem solved! Link to comment https://forums.phpfreaks.com/topic/189761-file-array-error/#findComment-1001546 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.