473,473 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Session varibable problem, please help

I have been having error messages relating to a session variable. I did
a print_r of the $session and I got the following results

Array ( [language] => english [languages_id] => 1 [selected_box] =>
configuration [IsAdminLoggedIn] => 1 )
Fatal error: Session variable IsAdminLoggedIn is not globally defined
As you could see in the print out, the variable IsAdminLogged in is set
and yet I get the error message, does anyone know what is going on?
Thanks

Jul 17 '05 #1
12 1646
do you have any code to demonstrate the problem?
konstantin

<ef*****@epitome.com.sg> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have been having error messages relating to a session variable. I did
a print_r of the $session and I got the following results

Array ( [language] => english [languages_id] => 1 [selected_box] =>
configuration [IsAdminLoggedIn] => 1 )
Fatal error: Session variable IsAdminLoggedIn is not globally defined
As you could see in the print out, the variable IsAdminLogged in is set
and yet I get the error message, does anyone know what is going on?
Thanks

Jul 17 '05 #2

konsu wrote:
do you have any code to demonstrate the problem?
konstantin

<ef*****@epitome.com.sg> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have been having error messages relating to a session variable. I did a print_r of the $session and I got the following results

Array ( [language] => english [languages_id] => 1 [selected_box] =>
configuration [IsAdminLoggedIn] => 1 )
Fatal error: Session variable IsAdminLoggedIn is not globally defined

As you could see in the print out, the variable IsAdminLogged in is set and yet I get the error message, does anyone know what is going on?
Thanks


Konstantin

This is the code I had in my pages

<?php
session_start ();

// Use $HTTP_SESSION_VARS with PHP 4.0.6 or less
if (!isset($_SESSION['IsAdminLoggedIn'])) {
//(!isset($_SESSION['IsAdminLoggedIn']))
header("Location: index_login.php?ALE=0");
}
?>

I hope this shed some light on how I used the session variable.
Regards

Jul 17 '05 #3
i placed this code in to a separate php file and it displayed 'ok':

<?php
session_start ();
if (!isset($_SESSION['IsAdminLoggedIn']))
{
echo('ok');
}
?>

must be a configuration problem on your server.
Jul 17 '05 #4

ef*****@epitome.com.sg wrote:
I have been having error messages relating to a session variable. I did a print_r of the $session and I got the following results

Array ( [language] => english [languages_id] => 1 [selected_box] =>
configuration [IsAdminLoggedIn] => 1 )
Fatal error: Session variable IsAdminLoggedIn is not globally defined
As you could see in the print out, the variable IsAdminLogged in is set and yet I get the error message, does anyone know what is going on?
Thanks


No, the variable $_SESSION['configuration']['IsAdminLoggedIn'] is set.
That is different.

Change your code to reflect this.

Also, when using print_r on arrays, use:

echo '<pre>';print_r ($array);echo '</pre>';
This will format the dump much prettier on the screen.

Ken

Jul 17 '05 #5
Konsu

Thanks for trying that out, do you know what settings on the server
could affect the session variable?

konsu wrote:
i placed this code in to a separate php file and it displayed 'ok':

<?php
session_start ();
if (!isset($_SESSION['IsAdminLoggedIn']))
{
echo('ok');
}
?>

must be a configuration problem on your server.


Jul 17 '05 #6
ef*****@epitome.com.sg top-posted:
... do you know what settings on the server
could affect the session variable?


I could bet that "session.save_path" is badly configured.

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jul 17 '05 #7

Pedro Graca wrote:
ef*****@epitome.com.sg top-posted:
... do you know what settings on the server
could affect the session variable?
I could bet that "session.save_path" is badly configured.

--
Mail to my "From:" address is readable by all at

http://www.dodgeit.com/ == ** ## !! ------------------------------------------------ !! ## ** == TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>) may bypass my spam filter. If it does, I may reply from another

address!
Hi

I found that my session.save_path was set to a folder called /tmp
which didn't exist. I created the folder in the directory but
unfortunately no effect.

I was wondering if "register_globals" function is needed to be turned
on on hte server as on mine it is set to off.

Jul 17 '05 #8
ef*****@epitome.com.sg wrote:

Pedro Graca wrote:
I could bet that "session.save_path" is badly configured.
I found that my session.save_path was set to a folder called /tmp
which didn't exist. I created the folder in the directory but
unfortunately no effect.


If you don't want to change php.ini, create the "tmp" directory under
the root directory ("C:\tmp")

Or change php.ini so that session.save_path points to an *existing*
directory and then restart your web-server,
I was wondering if "register_globals" function is needed to be turned
on on hte server as on mine it is set to off.


No, no need to turn register_globals on.
--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
Jul 17 '05 #9
My hosting provider has C:\tmp created and re-started the server, Still
no luck.

Sorry if this is a stupid question.

Since the variable [IsAdminLogged] exists when I printed $_session, why
does it not picked up for line

if (!isset($_SESSION['IsAdminLoggedIn']))
logically it should,. Shouldn't it?

Jul 17 '05 #10
ef*****@epitome.com.sg wrote:
My hosting provider has C:\tmp created and re-started the server, Still
no luck.

Sorry if this is a stupid question.

Since the variable [IsAdminLogged] exists when I printed $_session, why
does it not picked up for line

if (!isset($_SESSION['IsAdminLoggedIn']))
logically it should,. Shouldn't it?


No, bcause you set one variable, and test one with another name, perhaps?
Jul 17 '05 #11
I'll try that. Thanks for your suggestion. Will update everyone on the
outcome.

Steve wrote:
ef*****@epitome.com.sg wrote:
My hosting provider has C:\tmp created and re-started the server, Still no luck.

Sorry if this is a stupid question.

Since the variable [IsAdminLogged] exists when I printed $_session, why does it not picked up for line

if (!isset($_SESSION['IsAdminLoggedIn']))
logically it should,. Shouldn't it?


No, bcause you set one variable, and test one with another name,

perhaps?

Jul 17 '05 #12
I tried what Steve suggested and replaced IsAdminLogged with Language
and I didn't get any error. What does this suggest? Does it mean the
variable IsAdminLogged wasn't set correctly?

Regards

ef*****@epitome.com.sg wrote:
I'll try that. Thanks for your suggestion. Will update everyone on the outcome.

Steve wrote:
ef*****@epitome.com.sg wrote:
My hosting provider has C:\tmp created and re-started the server, Still no luck.

Sorry if this is a stupid question.

Since the variable [IsAdminLogged] exists when I printed
$_session,
why does it not picked up for line

if (!isset($_SESSION['IsAdminLoggedIn']))
logically it should,. Shouldn't it?


No, bcause you set one variable, and test one with another name,

perhaps?


Jul 17 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
11
by: doltharz | last post by:
Please Help me i'm doing something i though was to be REALLY EASY but it drives me crazy The complete code is at the end of the email (i mean newsgroup article), i always use Option...
14
by: Paul Yanzick | last post by:
Hello, I am trying to develop a book tracking application for my capstone in school, and am running into a problem. The application is an ASP.Net application written in C#. The first page you...
5
by: Mark Rodrigues | last post by:
Hi Everyone, I have been fighting a problem for a while and I wonder if someone out there can help. This problem has been presented in a number of news postings previously but I am yet to see a...
1
by: Werner | last post by:
Hi Patrick! Can you give an example of how to use a frameset inside an aspx-file? When I create a new frameset in Visual Studio.Net it just gives me a htm-File. Or give me a link where I can...
13
by: Alexander Widera | last post by:
hi, who has seen the follow problem or could help please? i visit a page .... i read a sesssion-var . ... everythink works...... i visit the page again..... error ... the sessionvar is null .... i...
31
by: jcr | last post by:
Hi: I am having trouble dynamically setting a variable. The following code does not work. Any ideas would greatly be appreciated. Thanks, Jim Dim astr As String Dim bstr As String Dim...
9
by: cashdeskmac | last post by:
I have put a string into Session and tried to retrieve it on the next page I visit but the Session appears empty. I have exactly the same spelling for both adding and retrieving the value: ...
2
by: Orgil | last post by:
I'm using ASP 3.0 however there is ASP.NET, because I'm working an old site that is built in ASP 3.0. I hope you for getting any help for my problem from you. So, my site's sessions are empty...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.