Hi Everyone,
I'm trying to use sessions to validate that a user has visited a certain page and clicked on a link that initiated a script, rather than just typed in the url of the script into a browser.
To do this i basically set up a session variable and saved it as 1, then in the php script i took that session variable and then incremented it by one, and then checked to make sure the variable is now two, yet no matter what i do the script functions as if php is just skipping over this part as it has had no effect on how the script works or on what it does, in other words everything works as if i changed nothing.

Here is the first document that the user needs to visit before executing the script (i took out some of the html/css/javascript so that you guys dont have to go through it, i dont think it is affecting it anyway):
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
//sample link
<a href="http://anothersite.com/" target="_blank" id="img" onclick="window.open('site/counter-main/site1Handler.php', 'newwin')"><img class="logos" alt="#" title="#" src="site/images/main/image1.jpg" /></a>
    <a class="logo">External Site 1</a>
Here is the actual script again i shortened it to just the part that deals with the session
PHP Code:
$valid $_SESSION['valid'];
$sessionID $valid 1;
$sessionID != 2){
'<META HTTP-EQUIV="Refresh" CONTENT="0; URL=error/error.php">;';
//execute script 
Thanks alot