Jump to content

: implode() [function.implode]: Invalid arguments passed in /home......./admin/i


infoking58

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.