473,800 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sessions not being passed properly

I'm having a problem passing SESSION variables from page to page. Right
now, I have this code at the top of my page:

if(!$_SESSION['logged_in']) include "login.php" ;

This is the code for the login form:
if($submit != "") {
$login_results = loginCheck($ema il, $password);
if($login_resul ts) {
session_start() ;
$_SESSION['logged_in'] = "true";
$login_values = mysql_fetch_arr ay($login_resul ts);
foreach($login_ values as $index => $value) {
$_SESSION[$index] = $value;
}
}
else displayLoginFor m(displayLoginF ailure());
}
else displayLoginFor m();
....
....
Another form appears down here -> submitting reloads page.
Upon going back to this page again once the SESSION variables were set,
I'm sent back to the login screen again. I checked, and the SESSION
variables don't exist anymore after reloading the screen. This sounds
like a globals problem, but I thought those only applied to GET, POST,
and the like. Any ideas what could be going on here?

Thanks,
Aaron

P.S. I'm going straight to the boards tonight instead of doing my own
research, as I'm pressed for time with a school project due, so please
ezcuse the newbie question.
Jul 20 '05 #1
3 1440
Aaron C wrote:
P.S. I'm going straight to the boards tonight instead of doing my own
research, as I'm pressed for time with a school project due, so please
ezcuse the newbie question.


Dude, that's not cool. It's inappropriate to ask other people to do
your homework for you, whether they are on the net or not.

Besides, you posted to mailing.databas e.mysql, with a PHP question that
has nothing to do with MySQL! Poor net etiquette, at the very least.

Anyway, try googling for "php session tutorial".

Bill K.
Jul 20 '05 #2
Aaron C wrote:
P.S. I'm going straight to the boards tonight instead of doing my own
research, as I'm pressed for time with a school project due, so please
ezcuse the newbie question.


Dude, that's not cool. It's inappropriate to ask other people to do
your homework for you, whether they are on the net or not.

Besides, you posted to mailing.databas e.mysql, with a PHP question that
has nothing apparently to do with MySQL! Poor net etiquette, at the
very least.

Anyway, try googling for "php session tutorial".

Bill K.
Jul 20 '05 #3
I'm sorry, I accidentally posted to the wrong newsgroup.

BTW, I was not trying to get anyone to do any homework for me. I was
just looking to see if anyone had had a similar problem.

I do appreciate you're steering me in the right direction, though, as
your suggestion helped.

Thanks,
Aaron
Bill Karwin wrote:
Aaron C wrote:
> P.S. I'm going straight to the boards tonight instead of doing my own
> research, as I'm pressed for time with a school project due, so please
> ezcuse the newbie question.


Dude, that's not cool. It's inappropriate to ask other people to do
your homework for you, whether they are on the net or not.

Besides, you posted to mailing.databas e.mysql, with a PHP question that
has nothing apparently to do with MySQL! Poor net etiquette, at the
very least.

Anyway, try googling for "php session tutorial".

Bill K.

Jul 20 '05 #4

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

Similar topics

1
2598
by: Steve Fitzgerald | last post by:
I use sessions as part of my login script. One of the values passed is userid. The userid seems to pass fine into the main part of the page, but when I use userid in a navigation include I cannot get it to display. Here' what I mean. Code for admin navigation: function adminMenu(){
13
12054
by: jing_li | last post by:
Hi, you all, I am a newbee for php and I need your help. One of my coworker and I are both developing a webpage for our project using php. We have a copy of the same files in different location on the server (in our own accounts on the same machine). When I am testing both versions of our program using the same browser (IE on Windows or Konqueror on Linux) the session variables will mix up and only the latest selection or options will...
0
1471
by: Gleep | last post by:
Hey PHP Gurus, I have some complex scripts that work fine. I have a system where sessions are validated on every page of my application to keep them secure. Everything runs fine when I test and code things. But I am also fanatical about updating the browser for security patches and remove all spyware, virues etc.. But some of my clients are not that savy and that leads me to my first question. Occasionally I have a client complain that...
10
1959
by: Marcus | last post by:
Hi All, First, just wanted to say that I found what I thought was a very helpful tutorial on sessions in case anyone out there has questions on them: http://www.free2code.net/tutorials/programming/php/4/sessions.php I've been using sessions for quite some time but only after reading this do I really understand what is going on on both the client and server side.
22
2886
by: Theo | last post by:
Question for the group The authentication system for the site Im working on seems to function properly and all is good. A session keeps track of everything and a cookie is used to accept or deny access... sounds as it should be I hope. Then when all is done logging out destroys everything and the pages are no longer accessable. Good so far. But two things come to mind: one is preventing multiple logins of the user/password. The...
10
2147
by: Mark H | last post by:
Hey all-- I'm building a database and I basically need to keep out people who aren't authorized, but it's not like I need top security here. I'm just doing basic user/pass of a SQL database, and when a user authenticates I start a session for him. My question is, is there any way for a hacker to easily start a session without having logged in? For instance, if I save the user name and IP address in the session will it be relatively...
10
7943
by: Anthony Williams | last post by:
Hi gang, This one looks like a bug :o( As you may or may not know, setting session management in web.config to use cookieless sessions causes the ASP.NET runtime to munge a session ID into the URL, in the format http://yourapplicationpath/(Session.SessionID)/... which saves numerous headaches when it comes to storing state across page requests and sessions.
1
5212
by: Duncan | last post by:
I have a strange problem with sessions in PHP 5. I have a simple script that prints a random number both as a string and a picture on the screen. When I run the script for the first time, it works perfectly. However, when I refresh the page, new updated random number does not propagate to the image displayer script through sessions. The image displayer script continues showing the old number instead of the new random number. I checked the...
7
3007
by: Steve Wright | last post by:
Forgive my ignorance, but I am just starting to learn about sessions in PHP and how to pass data from one page to the next. What I'm about to explain could just be my misunderstanding of how sessions work. I have two test scripts. The first starts a session, displays a few details and a form. When the form is submitted it jumps to the second page. The first script looks like this. <?php session_start();
5
5568
by: jheines | last post by:
I am trying to explain how cookies and sessions work in a class I teach, but I have hit a wall when it comes to the interaction between cookies and the state of the privacy settings in Internet Explorer. I would appreciate any help anyone can offer, please. First, consider the following very simple JavaScript function: function CookiesEnabled() { SetCookie( "testcookie", "testcookie" ) ; var bCookiesEnabled = ( GetCookie(...
0
10505
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10275
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.