Click to See Complete Forum and Search --> : Modifying Pages Via PHP


gnomepower
11-25-2003, 08:28 PM
I'm working with one thing to show to someone as a mini project and I'm really confused on this last part. I'm trying to make an installer to set in all the pages "{board_url}" to what the user has entered, and to modifiy a PHP file to change admin password and username. so I need to CHMOD the files, but I do not know what to do after that. It does not run on mySQL, and I do not want it to have to.
So far for the setup page, I pretty much have this;

Code:

<(form code)>
<p>Enter Your IF Board URL <input type="text" name="board_url"><br>
Enter Your IF Board Name <input type="text" name="board_name"><br>
Enter Your IF Board Admin Username (your username on the board, you <B>must</b> be an admin) <input type="text" name="username"><br>
Enter Your IF Board Admin Password (<B>must</b> be admin) <input type="password" name="pswd"><br>
<input type="submit" value="Setup" name="setup">
</form>



TY you very much and I hope someone can help.

pyro
11-25-2003, 08:56 PM
Umm... what exactly is your question?

gnomepower
11-26-2003, 11:10 PM
How to modify pages from a php script.

pyro
11-26-2003, 11:21 PM
Here's what I'd do. Read the file (http://us2.php.net/manual/en/function.file.php) to a string (or, if your using PHP 4.3.0 or greater, this (http://us2.php.net/manual/en/function.file-get-contents.php) might be of more use). Then, do your replacing with str_replace() (http://us2.php.net/manual/en/function.str-replace.php) or PCRE (http://us2.php.net/manual/en/ref.pcre.php). Once that is done, use fwrite() (http://us2.php.net/manual/en/function.fwrite.php) to rewrite the file.

gnomepower
11-27-2003, 12:54 PM
thx so much :) ill try that right now...

pyro
11-27-2003, 01:01 PM
You bet... :)