Code: Select all
<?php
session_start();
function Session($sessvar, $sessval = "~~~")
{
global $_SESSION;
if (isset($_SESSION[$sessvar]) == FALSE)
$_SESSION[$sessvar] = "";
if ( '~~~' != $sessval)
{
$_SESSION[$sessvar] = $sessval;
}
return $_SESSION[$sessvar];
}
?>The jist of the code is:
- If the request session variable doesnt exist, create it.
- If a value was passed in, assign it.
- Return the session value.
- If I pass in a 0 in $sessval, the comparison of "if ('~~~'!= $sesval)" always returns false.
- I cannot seem to actually see the $_SESSION variables. If I use a normal $_SESSION command and not the function, the variables work fine. If I use the "Session" function, I can see the session variables get set in the session file but cannot retrieve them.
Thanks in advance for any help!