Jump to content

gamesmad

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gamesmad's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is it possible to replace a whole line, regardless of content, with str_replace??  If not, what could I use instead?? Will
  2. I cannot thank you enough :)  I have finally got my script finished :P Thanks, Will
  3. How would I use fread to find part of it, and replace it with something else?? Will
  4. OK, I just whipped up this - [code]<?php require "config.php"; $settingscontents = file_get_contents("$boarddir/$account/Settings.php", "r+"); echo "$settingscontents"; ?>[/code] Where do I go from here, fread() seems to only look through a file by bytes??  I want to find some text in the file and replace it with something else. Will
  5. OK thanks guys, I will produce some of mine code, and Ill come back if it doesnt work. Will
  6. So using fopen will bind the contents of the file to the variable??  I dont understand what fread does, something to do with reading the filesize??  I understand fwrite.  Hope you can answer. Thanks, Will
  7. Hey, Does anyone have any working code that will allow me to open a file, find part of it, replace that part with something else, and then save the file?? Thanks, Will
  8. I still cant get it to work, please can someone help?? Will
  9. Now the file doesnt get edited...  And other ideas nogray, or anyone else?? Will
  10. OK, I had a go with str_replace, now there is no error, but it doesnt work.  I have attached the file. Will [attachment deleted by admin]
  11. I get the error - [code]Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /home/gamesm/public_html/freeforums/suspend.php on line 26[/code] Lines 21 - 26 go like this - [code]21  $settingscontent = file_get_contents($settingsdir); 22 23  $mode[0] = "$maintenance = 0;"; 24  $newmode[0] = "$maintenance = 2;"; 25 26  $newsettingscontent = preg_replace($mode, $newmode, $settingscontent);[/code] Any idea where I am going wrong??  Its stopping my script from working... Will
  12. Thanks very much, your a legend :) Will
  13. What is the command for finding and replacing part of a file? Hope you guys can help. Thanks, Will
×
×
  • 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.