473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

basic session question

All,
I've read the docs on session handling but still can't figure this one
out. I'm guessing it's a setting in php.ini or something.
I've inherited this code from someone, and it's got a typical login/set
session/redirect. on the live server, it works fine. on my local computer,
it doesn't.

in the login script, the session is being created correctly, as print_r()
shows me. but when it redirects to the next page, I get "Undefined variable:
_SESSION" when i do a print_r on it. I've added session_start() to that
page, but then all I get is an empty session array.

Here's the pertinent chunk of code i inherited in the login page:

// Start the session, register the values & redirect.
session_name ('YourVisitID');
//ini_set ('session.use_cookies', 0);
session_start();
$_SESSION['first_name'] = $row[1];
$_SESSION['user_id'] = $row[0];
print_r($_SESSION);
//exit();
header ("Location: http://" . $root . "/photogallery/admin.php?" .
SID);
exit();
Any of this sound like a familiar problem?

Thanks a lot.

Marc
Jan 15 '07 #1
1 1252
figured this one out. it was that YourVisitID. I didn't see any calls to
session_start() on any of this dude's other pages, but the docs told me i
needed it so i started putting them in, but it didn't fix it. once i got
rid of that session_name() call, things started working. now i understand
what's going on.


"Marc E" <no*****@hifiwebdesign.comwrote in message
news:ec******************************@suscom.com.. .
All,
I've read the docs on session handling but still can't figure this one
out. I'm guessing it's a setting in php.ini or something.
I've inherited this code from someone, and it's got a typical login/set
session/redirect. on the live server, it works fine. on my local computer,
it doesn't.

in the login script, the session is being created correctly, as print_r()
shows me. but when it redirects to the next page, I get "Undefined
variable: _SESSION" when i do a print_r on it. I've added session_start()
to that page, but then all I get is an empty session array.

Here's the pertinent chunk of code i inherited in the login page:

// Start the session, register the values & redirect.
session_name ('YourVisitID');
//ini_set ('session.use_cookies', 0);
session_start();
$_SESSION['first_name'] = $row[1];
$_SESSION['user_id'] = $row[0];
print_r($_SESSION);
//exit();
header ("Location: http://" . $root . "/photogallery/admin.php?" .
SID);
exit();
Any of this sound like a familiar problem?

Thanks a lot.

Marc

Jan 15 '07 #2

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

Similar topics

1
by: Wiktor Zychla | last post by:
Hello, I am an experienced Win.Forms developer and now I am learning ASP.NET (no ASP background). there are some basic issues I do not understand and cannot find any satisfable answers. 1. my...
6
by: pinorama123 | last post by:
I have an ASP.NET application that contains a few classes that I have built. One of my objects is a user object. I have a pretty basic question about how this would work. If I have multiple...
3
by: codegreen9 | last post by:
Hi, My understanding is that session info must be stored using Session, which means text data. What I'd like to be able to do, is keep an object alive throughout a user's session, without...
2
by: aharonhere | last post by:
Hello. I have a problem with closing a session and moving to the regular page. The process is between 3 ASP pages: (1)References.asp (2)SignIn1.asp (3)SignIn2.asp the first page is a form...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.