What is a script’s SESSION prepend?
SESSION variable name is something like this:
$_SESSION['var_name']. Now, let’s say a user is running a session between his/her browser and the server. Furthermore, let’s say he/she is running two different scripts from your web application in separate browser tabs. There could end up being a collision in that each one of those two different scripts has a session variable with the same name. For example let’s say the two scripts are
script_1.php has a variable called
script_2.php also has a variable called
$_SESSION['yourPick']. Well what’s going to happen if the user hops between browser tabs and works on both scripts simultaneously? I’ll tell you what will eventually happen: The value of that session variable will become tainted and it won’t make any sense (unless of course you want that session variable to be like some kind of global thing).
Having a script specific session prepend is the solution to this problem. So how does that work?
What will it all look like?
Continuing with our example, we’ll assign
S1 to be the script prepend for
S2 to be the script prepend for
script_2.php. The corresponding session variables will be
The prepend has to be unique to the particular app script. Other than that here is a list of things unique to my web app.
- I choose the first letter of each word in the script name.
- I use capital letters.
- I use the
usedScriptSESSION_Prepends.phpscript to make sure my prepend is unique.
- If it’s not unique I alter it.