There are two alternatives for activating a session for a visitor. We can simply use a PHP function called session_start()
at the beginning of our PHP code or we can edit our php.ini
file and add the session.autostart
option. We will use the session_start()
function in this chapter. The former method has its own drawbacks.
After starting a session we can access the session ID for each user through the SID constant. So it will provide us a unique file name for our artwork. We just need to add this ID number at the end of the original file name and save the result with that name. The general form of such code is something like this:
<?php Session_start(); $filename = $original_filename.strip_tags(SID); // our required code for image processing //we just need to use $filename variable for saving the result ?>