PHP sessions... Where to start from???

They have: 53 posts

Joined: Oct 2005

Hi everybody!
I have a problem and I was told to check out the sessions part in PHP.
What I want to deal with is the following :
I have a PHP page with a form, where the user writes some data. These data are then written into a file which is then used in a system command as input for an external program (NOTE: The data MUST be written into a file, it cannot be done elsewhise, because the external program takes a file as input).
The thing is that I must somehow create a file everytime a user enters data into the form, so I must learn something on sessions I think.
My question is, since I don't have a login system or something like that, but just want to create a different file each time (with the session_id being part of it, so that the file is unique), which session commands do I need?

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

What does this program do? Will it create output that is also in a file named the same as the session so the user can get the results, or do you simply only need a unique filename?

If you only need a unique filename, use a timestamp YYYYMMDDHHMMSS (and if you anticipate more than one request a second, let it use fractions of a second)

This is how I created invoice numbers, broken down to 1/1000 of a second and rearanged so it is not obvious.

-Greg

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.