WAIT!
Sorry to jump in, but there is a very important fact being missed here. JimEkleberry, please read the following links before talking about PHP variable scope:
There is a direct answer to Kendo's original question. Yes, you can distinguish between variables set by the session, and variables passed on the URL. In fact you can distinguish the scoping of any PHP environment variables if you want. If you do things right, your session variables CANNOT be spoofed.
Most PHP users run PHP in its default configuration to automatically make all HTTP environment variables global (register_globals = On in php.ini). This provides for easy (lazy) programming, but can also cause security vulnerabilities, and it can make a large application harder to debug.
Even if you don't change this setting, though, you can still know where a certain variable comes from:
if(isset($HTTP_GET_VARS["var_name"])){
//This checks to see if $var_name was set on the URL
}
if(isset($HTTP_POST_VARS["var_name"])){
//checks to see if $var_name is a POST value
}
if(isset($HTTP_SESSION_VARS["var_name"])){
// aha! is this a session variable?
}
if(isset($HTTP_COOKIE_VARS["var_name"])){
// or is it just a cookie?
}
var_dump($HTTP_SESSION_VARS);
//output all current session variables, etc...
And again, JimEkleberry -- on your second post-- PHP sessions were devised to solve just that problem, without requiring a database hit for every visit to a web page.
Session variables are never passed on the URL, just the session key. PHP stores the actual variables in server-side temp files according to the key name. The PHP session id ($PHPSESSID, usually), is either stored as a cookie, or passed on the URL. (but not the variable values themselves).
Thus, as long as you explicitly check for your session variables in the $HTTP_SESSION_VARS array, you will be safe.
NOTE: in PHP 4.1 and up, these arrays can now be referenced in a "shorthand" notation, such as $_SESSION["var_name"], or $_GET["var_name"].
And, just for fun, set some session vars and then visit a PHP page with the following code:
<?php
phpinfo();
?>
It will show you all kinds of information about your environment. While browsing this page, add some variables to the URL query string, and you will see them echoed below also. -------------------------------------------
"Calculus is just the meaningless manipulation of higher symbols"
-unknown F student