Advertisement

08.24.2008 at 02:33PM PDT, ID: 23674092 | Points: 90
[x]
Attachment Details

Included PHP pages do not find SESSIONS which are defined and says undefined

Asked by TycoonMillion in PHP Scripting Language, Web Languages/Standards

Tags:

Hey

I asked the same question a while back on here but the solution is not working for me this time. Look at these pages first please in this order...
Page 1: www.webtechglobal.co.uk  (Attempt to login using Username and Password) you will see undefined index authgrant

Page 2: http://www.webtechglobal.co.uk/chat.php    at the top of the page you will see the followng...       test1 = yestest2 = admin


test1 is an echoed variabled populated with the session for authgrant and test2 for another session. This shows that on this page the sessions are registered correctly. The top right login box will also change. Its all test stage just now so security is hardly even in there.

The different between pages will show in the URL after you attempt to login! I use a pagecell to display the content however the chat.php is its own entire page.

Page 3: http://www.webtechglobal.co.uk/index.php?cellname=pagecells/home.php
You will now see the top right login panel disappear because the header of this site is also included from a seperate file but not on the chat.php page!

i spent hours trying to sort it, learn it and confirm this is that matter I just can't figure out a quick solution. I can think of some long solutions but they have problems of their own so I wondered if anyone wanted to give this one a try! Its either a problem with the site URL method acting like another domain which would not use the same SESSION from what I read or its because they are included files.

Tried everything I can find online either way and now I'm totally stuck. Anyone want some points? :)

Thanks for any help
Ryan

PS jsut realised low on points, was a monthly subscriber but card has expired and you guys dont allow Maestro. For this I will defo issue 500 pointsStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
<?php   
 
 function my_session_start()
    {
        if (isset($_COOKIE['PHPSESSID'])) 
			{
            	$sessid = $_COOKIE['PHPSESSID'];
        	} 
		else if (isset($_GET['PHPSESSID'])) 
			{
            	$sessid = $_GET['PHPSESSID'];
        	}
		else 
			{
            	session_start();
            	return false;
        	}
       
        if (!preg_match('/^[a-z0-9]{32}$/', $sessid)) 
			{
           		 return false;
        	}
		session_start();
        return true;
    }
	//This line is explained at PHP.net SESSIONS (Session issue with different domains)
	//ini_set("session.cookie_domain",substr($_SERVER[HTTP_HOST],3));			
	my_session_start();
	
	//Increase error output
	error_reporting(E_ALL);
    ini_set('display_errors','1');
	
				//Establish if logout is required and session destroy
         if(empty($_GET['logout']))
        {
                  $_SESSION['logout'] = "empty";
        }
        else if(!empty($_GET['logout']))
        {
                  $_SESSION['logout'] = $_GET['logout'];
        }
        
		//Establish page cell, if first visit to site go to home.php as default
        if(empty($_GET['cellname']))
                {
                        $_SESSION['cellname'] = 'pagecells/home.php';
                }
        else if (!empty($_GET['cellname']) && $_SESSION['logout'] == "killsession")
                {
                  $_SESSION['cellname'] = $_GET['cellname'];
      			  //session_destroy();
                }
        else
                {
                  $_SESSION['cellname'] = $_GET['cellname'];
                }
 
	include('inc/globalconfig.inc'); //Settings for site controlled by master pages
	include ('inc/doctype.inc'); 
	include ('starrater/_drawrating.php'); //Page rater with stars
?>
                        
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>WebTG</title>
</head>
 
<body onLoad="new Accordian('basic-accordian',5,'header_highlight'); MM_preloadImages('../Images/WebDesign Nav/webdesign_button_1b.jpg','Images/WebDesign Nav/webdesign_button_2b.jpg')"; onmousemove="closesubnav(event);">
  <?php   
   include ('headerglobal.php');
   include (''.$_SESSION['cellname'].'');
   include ('footerglobal.php'); 
   ?>
</body>
 
</html>
 
<?php include 'inc/docdetails.inc'; ?>
 
Keywords: Included PHP pages do not find SESSIO…
 
Loading Advertisement...
 
[+][-]08.25.2008 at 02:29AM PDT, ID: 22304165

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.25.2008 at 02:30AM PDT, ID: 22304172

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.25.2008 at 05:56AM PDT, ID: 22305041

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.25.2008 at 08:42AM PDT, ID: 22306413

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.25.2008 at 03:43PM PDT, ID: 22310007

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.29.2008 at 08:57PM PDT, ID: 22350588

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.12.2008 at 01:37AM PDT, ID: 22457985

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628