otuatail Posted March 11, 2008 Share Posted March 11, 2008 This is making me tear my hair out. Line 40 if (!isset($_SESSION['current_page'])) // ************* Line 40 $_SESSION['current_page'] = ''; AND Here it is used. if($_SESSION['current_page'] <> 'index.php') // ******** Line 115 { Full code if it helps <? // Des-otoole.co.uk Website Version 3.0.1 08-06-2007 Desmond O'Toole. // http://poptop.hypermart.net/testindex.html Real Testimonies // [email protected] // echo phpversion(); // gethostbyname(); // http://validator.w3.org/ Browser = W3C_Validator/1.432.2.22 // http://jigsaw.w3.org/css-validator/ Browser = Jigsaw/2.2.5 W3C_CSS_Validator_JFouffa/2.0 // //IE 7 Security Issue // Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322) // Microsoft Data Access Internet Publishing Provider Protocol Discovery // Microsoft-WebDAV-MiniRedir/5.1.2600 // // var_dump($_SERVER); $accept = $_SERVER["HTTP_ACCEPT"]; // text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 $Browser = $_SERVER['HTTP_USER_AGENT']; // $accept_charset = $_SERVER["HTTP_ACCEPT_CHARSET"]; // ISO-8859-1,utf-8;q=0.7,*;q=0.7 // $accept_language = $_SERVER["HTTP_ACCEPT_LANGUAGE"]; // en-gb,en;q=0.5 // $x_wap_profile = $_SERVER["HTTP_X_WAP_PROFILE"]; // $profile = $_SERVER["HTTP_PROFILE"]; $RemoteAddress = $_SERVER['REMOTE_ADDR']; //172.55.44.33 $domain = $_SERVER['HTTP_HOST']; //des-otoole.co.uk ? // echo "Script " . $_SERVER['SCRIPT_FILENAME'] . "<br>"; // echo "Self " . $_SERVER['PHP_SELF'] . "<br>"; if (!isset($_GET['counter'])) { $_GET['counter'] = ""; } if (!isset($_GET['Event_Log'])) { $_GET['Event_Log'] = ""; } if (isset($_GET['show'])) { if($_GET['show']== "4451019") $_SESSION['Event_Log'] = 'NO'; } if (!isset($_SESSION['current_page'])) // *************** Line 40 *************** $_SESSION['current_page'] = ''; include ("functions.inc"); // session_start(); $_SESSION['Event_Log'] = 'NO'; if($_GET['counter'] == "") $_SESSION['Event_Log'] = 'YES'; if(isRougeBot($Browser) == 1) { $redirect = "http://" . $RemoteAddress; mailto("RougeBot"); header('Location: ' . $redirect); exit; } if($RemoteAddress == "66.55.151.2") { $val = $RemoteAddress . " + " . $Browser; // mailto("66.55.151.2 Crap"); Log666(); exit; } if(isIE7($Browser) == 1) // $Browser = "MSIE 7.0-WebDAV-MiniRedir/5.1.2600"; { mailto("MSIE 7"); header('Location: 666.php'); exit; } connectDB(1); $sql = "SELECT * FROM `config`"; $query = mysql_query($sql) or die(mysql_error()); $rs = mysql_fetch_array($query); $Construction = $rs['Construction']; $Robot = $rs['Robot']; $IP = $rs['IP']; $dbLog = $rs['dbLog']; $page = "Home"; $IsMe = IsMe($RemoteAddress , $IP); $_SESSION['Atack'] = 0; if($RemoteAddress == "195.136.80.67" || $Robot == 'Y' && $IsMe == 'Y') { $_SESSION['Atack'] = 1; if($IsMe != 'Y') StoreData($page); mailto($page); include('404.html'); exit(); } if($Construction == 'Y' && $IsMe == 'N') { // header('Location: UnderConstruction.php'); include('UnderConstruction.php'); exit; } $Total_Hits = get_hit_counter(); $_SESSION['K9'] = isRobot($Browser); if($Robot == 'Y') $_SESSION['K9'] = 1; if($_SESSION['Event_Log'] == 'YES' && $_SESSION['current_page'] == "" && $_SESSION[K9] == 0) { hitcounter(); // echo "Hitcount<br>"; } if($_SESSION['current_page'] <> 'index.php') // *************** Line 115 *************** { // echo "storedata<br>"; StoreData($page); // Only if Event_Log = 'YES' and Flag 'dbLog' = 'Y' if($_SESSION['K9'] == 0 || $dbLog == 'N') mailto($page); // if this is a Robot } $_SESSION['current_page'] = 'index.php'; if($_SESSION['K9'] == 0) { // echo ($_SERVER['SCRIPT_NAME']); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <meta name="verify-v1" content="aF5317XxX7tb+aN2QxxDXFGfePWNsyArR1gu/JlOS/E=" /> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <META HTTP-EQUIV="imagetoolbar" CONTENT="no"> <LINK rel="stylesheet" href="style.css" type="text/css"> <TITLE>Home</TITLE> </HEAD> <BODY> <div id="side-menu"> <!-- <a onmouseover="document.images[0].src='images/Family-H.gif'" onmouseout="document.images[0].src='images/Family.gif'" href="Family.php" rel="nofollow"><IMG src="images/Family.gif" alt=""></a> <br> --> <a onmouseover="document.images[0].src='images/Testimony-H.gif'" onmouseout="document.images[0].src='images/Testimony.gif'" href="Testimony.php"><IMG src="images/Testimony.gif" alt=""></a> <br><br> <a onmouseover="document.images[1].src='images/Contact-H.gif'" onmouseout="document.images[1].src='images/Contact.gif'" href="Contact.php" rel="nofollow"><IMG src="images/Contact.gif" alt=""></a> </div> <div id="me"> <img src="images/me-him4_R.jpg" alt=""> <br> <span class="Info">Visitors since April 2006</span> <!-- <span> <?=display_hits($Total_Hits)?></span> --> </div> <div id="w3c"> <br><br><br><br> <IMG src="images/w3c.gif" alt=""> <IMG src="images/css.gif" alt=""> </div> </BODY> </HTML> <?} else { include('robot.html'); }?> Link to comment https://forums.phpfreaks.com/topic/95680-why-is-my-session-variable-not-set/ Share on other sites More sharing options...
p2grace Posted March 11, 2008 Share Posted March 11, 2008 You need to have session_start(); above all session variables, and it also has to be at the top of every page Link to comment https://forums.phpfreaks.com/topic/95680-why-is-my-session-variable-not-set/#findComment-489862 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.