GrantDouglas Posted August 7, 2009 Share Posted August 7, 2009 Ok so my script writes to a log file (which is variable $banned). It needs to insert the text so it appears like this $ip[] = '0.0.0.0'; here is what i have tried but i can't seem to get it to work. fwrite($banned, "$ip[] = '$user';"); the error produced is: Parse error: syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/ultimate/public_html/bomber/editban.php on line 6 line 6 being the line i showed you Im fairly new to php so any help at all would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/169206-problem-fwritebanned-ip-user/ Share on other sites More sharing options...
GrantDouglas Posted August 7, 2009 Author Share Posted August 7, 2009 Sorry i mean it needs to look like this in the document: $ip[] = '0.0.0.0'; Link to comment https://forums.phpfreaks.com/topic/169206-problem-fwritebanned-ip-user/#findComment-892791 Share on other sites More sharing options...
waterssaz Posted August 7, 2009 Share Posted August 7, 2009 Try this :-) <?php $string = "\$ip[] = '"."".$user."'"; fwrite($banned, $string); ?> Link to comment https://forums.phpfreaks.com/topic/169206-problem-fwritebanned-ip-user/#findComment-892813 Share on other sites More sharing options...
alexdemers Posted August 7, 2009 Share Posted August 7, 2009 Or make use of single quotes. <?php fwrite($banned, '$ip[] = \''.$user.'\';'."\n" ); ?> Link to comment https://forums.phpfreaks.com/topic/169206-problem-fwritebanned-ip-user/#findComment-892858 Share on other sites More sharing options...
GrantDouglas Posted August 7, 2009 Author Share Posted August 7, 2009 Thank you. It worked :-D Link to comment https://forums.phpfreaks.com/topic/169206-problem-fwritebanned-ip-user/#findComment-893272 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.