onesovereignang
03-12-2010, 12:21 AM
Hi All,
I've looked all over the web and can't seem to find the answer anywhere... I can find snippet after snippet, and parts of other scripts that do SOME of this, but not the WAY I need it to.
First, I have to create a NEW flat file each time a form is sent containing a new topic. This file will be the name of the topic plus the extension '.txt' and be created in the current directory. The name will be supplied by a field named 'NewTopic' and will also need to be passed by the form through the sendmail function at the same time the flat files are updated.
The content of the file created must contain the PHP include string which must be concatonated from the segments ( <?php include ' )
plus the name of the topic being created, plus the segment ( .php'; ?> ), all on the same line with NO SPACES added during concatonation, and all 'spaces' contained within the topic name string need to be converted to UNDERSCORES... ( _ ) to prevent javascript errors should a space be encoded as '%20' for any reason.
It would also require a common file (NumberOfTopics.txt) containing only the number of topics in the (Flat File) database. This number must be in a seperate file, because it is used by other functions to determine the number of topics used and to be used by another script to comply with yet another script's access limits. (It's not relevent to this script, but just so you know why there needs to be a seperate COUNT file!)
Therefore, whenever the page containing the form is first loaded, the script will need to access another flat file containing a list of topics, (Topics.txt) listed one per line, and populate a dropdown selector box on the form as it loads.
Before the form is sent, the drop down selector box is queried and the currently selected topic is passed to the post or put command that sends the form via sendmail, while updating the flat file database on one or more of the following conditions.
If a NEW TOPIC is selected, the name of the new topic in the new topic field will be added to the flat file database of topics... (Topics.txt)
Also, simultaneously, the file 'NumberOfTopics.txt' is updated, by incrementing the number in the file by ONE!
Also, the post command to sendmail must include the topic number drawn from the flat file 'NumberOfTopics.txt', incremented by ONE, the name of the new topic from the 'New Topic' field to be added when the user presses the send button, and the contents of the 'Topic' drop down selector field currently selected on the form.
For example, If there are 45 topics in the topic list, the number in the file 'NumberOfTopics.txt' must be the same.
Each time a new topic is added, the file 'NumberOfTopics.txt' must be incremented by ONE and the file 'Topics.txt' must have the new topic name inserted into the file in 'ALPHABETICAL ORDER', which will require that the topics in the file be sorted before writing to update the file.
There is more that needs to be done, but after carefully analyzing the process, it will be much simpler to attack the problem piece meal.
Once the steps listed here are accomplished I can explain the next step in the process.
I am new to this but have read and experimented enough to be able to follow directions, but writing the script is beyond me.
I am using PHP include commands to accomplish most of this, so if you can break it down to seperate sections, that I can digest easily, I would appreciate it... and if you can help, I'll gladly credit you with the help and link to your website if you want.
Thank you for your help.
OneSovereignAngel
I've looked all over the web and can't seem to find the answer anywhere... I can find snippet after snippet, and parts of other scripts that do SOME of this, but not the WAY I need it to.
First, I have to create a NEW flat file each time a form is sent containing a new topic. This file will be the name of the topic plus the extension '.txt' and be created in the current directory. The name will be supplied by a field named 'NewTopic' and will also need to be passed by the form through the sendmail function at the same time the flat files are updated.
The content of the file created must contain the PHP include string which must be concatonated from the segments ( <?php include ' )
plus the name of the topic being created, plus the segment ( .php'; ?> ), all on the same line with NO SPACES added during concatonation, and all 'spaces' contained within the topic name string need to be converted to UNDERSCORES... ( _ ) to prevent javascript errors should a space be encoded as '%20' for any reason.
It would also require a common file (NumberOfTopics.txt) containing only the number of topics in the (Flat File) database. This number must be in a seperate file, because it is used by other functions to determine the number of topics used and to be used by another script to comply with yet another script's access limits. (It's not relevent to this script, but just so you know why there needs to be a seperate COUNT file!)
Therefore, whenever the page containing the form is first loaded, the script will need to access another flat file containing a list of topics, (Topics.txt) listed one per line, and populate a dropdown selector box on the form as it loads.
Before the form is sent, the drop down selector box is queried and the currently selected topic is passed to the post or put command that sends the form via sendmail, while updating the flat file database on one or more of the following conditions.
If a NEW TOPIC is selected, the name of the new topic in the new topic field will be added to the flat file database of topics... (Topics.txt)
Also, simultaneously, the file 'NumberOfTopics.txt' is updated, by incrementing the number in the file by ONE!
Also, the post command to sendmail must include the topic number drawn from the flat file 'NumberOfTopics.txt', incremented by ONE, the name of the new topic from the 'New Topic' field to be added when the user presses the send button, and the contents of the 'Topic' drop down selector field currently selected on the form.
For example, If there are 45 topics in the topic list, the number in the file 'NumberOfTopics.txt' must be the same.
Each time a new topic is added, the file 'NumberOfTopics.txt' must be incremented by ONE and the file 'Topics.txt' must have the new topic name inserted into the file in 'ALPHABETICAL ORDER', which will require that the topics in the file be sorted before writing to update the file.
There is more that needs to be done, but after carefully analyzing the process, it will be much simpler to attack the problem piece meal.
Once the steps listed here are accomplished I can explain the next step in the process.
I am new to this but have read and experimented enough to be able to follow directions, but writing the script is beyond me.
I am using PHP include commands to accomplish most of this, so if you can break it down to seperate sections, that I can digest easily, I would appreciate it... and if you can help, I'll gladly credit you with the help and link to your website if you want.
Thank you for your help.
OneSovereignAngel