Hello all!
I do have some experiences in programming such as Java and C++.
However, I'm new to PHP but the concepts are similar...and I am not really an expert with managing and updating files.
I'm stumped on solving this problem to create new files by appending numbers if the file already exists with a username.
For example, I log in as IamMine Lastname and my information is recorded from a script (this is done on a private island in Second Life that calls my php file on a apache server)
It will first look to see if the file, IamMine LastName.txt already exists. If not, then create a new file called IamMine LastName.txt.
The next time I am recorded (this could happen on the same day - I stop the recorder and then play it again, for example), I want the file to be renamed by appending a number at the end - like IamMine LastName_1 if filename already exists.
I am passing the username as a parameter for the filename; however I have to do a string search to find out if the file exists or if it does, then I have to do another search on finding the highest number so I can increment it by one before passing it to the fopen to create a new file. I know what you are thining - why not append? My supervisor wants a new log each time we interact with a recorder object. 🙂
Am I making any sense?
I've been trying to figure out what is the best way to work with this but it seems like I'm making it too complicated.
And I don't find the strcmp() effective.
Thanks for any inputs in advance. 🙂
Melissa