infoking58 Posted November 3, 2011 Share Posted November 3, 2011 Im not sure how to fix this error. Here is the line... <TEXTAREA name="text" rows=20 cols=80>'.stripslashes(implode("",$text)).'</TEXTAREA> and the code...? if($q) { $filename = "../includes/pages/$q"; if(!is_writable($filename)) { die("<b>$q</b> is not writable! All files in your includes/pages directory should be CHMOD 666"); } $text = @file($filename,"r"); echo '<b>EDIT PAGE</b> : '.$q.' <FORM action="index.php" method="POST"> <INPUT type="hidden" name="q" value="'.$q.'"> <TEXTAREA name="text" rows=20 cols=80>'.stripslashes(implode("",$text)).'</TEXTAREA> <br><INPUT type="submit" name="submit" value="Save page"> </FORM>'; include("footer.php"); exit; } Any help would be greatly appreciated. I'm brand new at type of coding. Link to comment https://forums.phpfreaks.com/topic/250394-implode-functionimplode-invalid-arguments-passed-in-homeadmini/ Share on other sites More sharing options...
trq Posted November 3, 2011 Share Posted November 3, 2011 $text is quite obviously not an array. Link to comment https://forums.phpfreaks.com/topic/250394-implode-functionimplode-invalid-arguments-passed-in-homeadmini/#findComment-1284777 Share on other sites More sharing options...
erm410 Posted November 8, 2011 Share Posted November 8, 2011 As Thorpe mentioned, $text is not an array. The underlying problem is that you botched the file() function call: the second parameter should be an integer not a string (see file). The original error is suppressed by the @ in front of the file() call (output in comments): $text = file('test', 'r'); //PHP Warning: file() expects parameter 2 to be long, string given in php shell code on line 1 var_dump($text); //NULL implode('', $text); //PHP Warning: implode(): Invalid arguments passed in php shell code on line 1 $text = file('test'); var_dump($text); /*array(2) { [0]=> string(6) "line1 " [1]=> string(6) "line2 " }*/ echo implode('', $text); /*line1 line2*/ Link to comment https://forums.phpfreaks.com/topic/250394-implode-functionimplode-invalid-arguments-passed-in-homeadmini/#findComment-1286111 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.