Quote:
Originally Posted by mtishetsky
OMG
You try to solve the problem which does not exists. Tell us what you WANT to do, not HOW YOU want it to be done. I am 99% sure that you need a database and a single script.
|
Ok, I have a form that creates a new folder and puts a file called index.php in it. So when the form is submitted, a new folder with a homepage for that folder is created.
Now, this index.php is copied from the templates folder. This page is 100% reliant on an id from a database. So all I need to do is write the id at the top of index.php so the rest of the page is taken from the database accurately. It's sort of how wordpress uses ?p=3 to display different posts. But I don't want to use query strings.
So back to the point, I need to put an id at the top of index.php. Rather than writing it manually, the original form will look into the database and get the id. But that form can't write the id itself to the index.php as you can't stop and start with fwrite. So instead, the form will open up a simple txt file and write the id into it.
Now, there is a txt file that contains an id in it. index.php needs an id. What is the best way for index.php to get the id from the txt file?
Bear in mind, there is only one txt file and every time the form is submitted, the id in the txt file will be replaced. So the txt file will keep changing, so fread won't work because fread opens the txt file every time, so it will just get the current id (not what I want).
Any ideas?
|