Senkerik Posted June 8, 2009 Share Posted June 8, 2009 Some reason this problem has come up.. All i have done was download my files to my comp then re-upload them to a new server. Warning: implode() [function.implode]: Invalid arguments passed in /home/ceasedfa/public_html/readchat.php on line 35 This is my ReadChat.php <?php include ('global.config.php'); include ('include/class.core.php'); $CeasedFate = new Core(); $CeasedFate->connectDB($SQL_host,$SQL_user,$SQL_pass,$SQL_db); $CeasedFate->stripPost(); $CeasedFate->stripGet(); $CeasedFate->is_logged($_SESSION['username'],$_SESSION['uid']); $d = $CeasedFate->detail('users','ignore_list','username=\''.$_SESSION['username'].'\''); $list = explode('|',$d['ignore_list']); $filename = $ChatFile; $handle = fopen($filename, "r"); $contents = @fread($handle, filesize($filename)); $newc =explode('<br>',$contents); foreach($newc as $cnew){ if($x<=25){ $temp_= ereg_replace('<span id="time_'.$_SESSION['username'].'" style="visibility:hidden;">',' <span style="visibility:visible;color:#ffccff;font-size:14px;font-family:arial;">',$cnew); $temp_= ereg_replace('<span id="'.$_SESSION['username'].'" style="display:none;">',' <span class="private">',$temp_); $temp_= ereg_replace('<span id="'.$_SESSION['username'].'" style="display:none;">','<span class="private">',$temp_); if(count($list)>0){ foreach($list as $ignore){ if (strlen(trim($ignore))>0){ $temp_= ereg_replace('<span id="ign_'.$ignore.'">',"<span style='display:none;'>",$temp_); } } } $newcc[]=$temp_; } $x++; } $newcc=implode('<br>',$newcc); echo $newcc; fclose($handle); ?> Link to comment https://forums.phpfreaks.com/topic/161427-warning-implode/ Share on other sites More sharing options...
gijew Posted June 8, 2009 Share Posted June 8, 2009 A couple of things. You should use str_replace() instead of ereg_replace() as it'll be much faster. You can also use it with an array so you don't have to do as many replaces Second, you're probably getting the error because of a bad character getting output. Try doing a var_dump($newcc) to see what is in there. Perhaps you can see it that way. If not, try encoding the <br> tag with htmlentities() to see if that solves it. Link to comment https://forums.phpfreaks.com/topic/161427-warning-implode/#findComment-851891 Share on other sites More sharing options...
Senkerik Posted June 8, 2009 Author Share Posted June 8, 2009 I'm still not fully understanding this. Could you maybe help me a little more? Sorry for being a pain the in butt. Just wanna get this right so i don't mess up next time Link to comment https://forums.phpfreaks.com/topic/161427-warning-implode/#findComment-851893 Share on other sites More sharing options...
Senkerik Posted June 8, 2009 Author Share Posted June 8, 2009 I'm still not fully understanding this. Could you maybe help me a little more? Sorry for being a pain the in butt. Just wanna get this right so i don't mess up next time Link to comment https://forums.phpfreaks.com/topic/161427-warning-implode/#findComment-851902 Share on other sites More sharing options...
sasa Posted June 9, 2009 Share Posted June 9, 2009 ... Try doing a var_dump($newcc) to see what is in there. ... (before implode) Link to comment https://forums.phpfreaks.com/topic/161427-warning-implode/#findComment-852291 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.