473,408 Members | 1,788 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,408 software developers and data experts.

PHP super globals

I am an amateur in PHP coding .... recently I have successfully written
a database driven site using PHP on Linux .... I am working on a new
project, which too involves database access (I am using MySQL for this)
and am facing a peculiar problem ..... I was searching for a solution
when I came across this group.

Actually I am working on Windows XP this time and it seems that I am
not able to access $_SESSION variables .... actually I am writing a
login script, which on successful submission of a form accesses the
database and gets the userid which I am storing in $_SESSION['uid']....
on every subsequent pages I check the validity of his login using this
$_SESSION['uid'] and comparing cookies and other information stored in
the database .... I will give you the structure of my programming ...

there are 4 files a) login.php b) functions.php c)home.php d)
logout.php
functions.php is included in all the 3 files ..... it has
session_start() at its very beginning.

1. In login.php I am getting the username and password and comparing
them wih db info ... if successful I am storing userid in
$_SESSION['uid'] and setting cookies and updating db
2. I am redirecting to home.php
3. Here I use a function check() which has the userid as its argument
4. the userid I need to get from $_SESSION['uid'] ... but this fails
5. if check fails I call logout.php

I am usin PHP5.0.5 with Apache2.0.
Can any of you help me on this???? ...... maybe on windows I need to
change something in the php.ini file in order to use the $_SESSION
array.

If you cannot figure this out then maybe you can suggest some other way
in which I can access the userid in home.php.
I really hope you can help me on this .... otherwise my projetct is
stuck for an indefinite period of time.

Nov 23 '05 #1
2 1364
MaxPain wrote:
functions.php is included in all the 3 files ..... it has
session_start() at its very beginning.


Make sure that every time there is NO output whatsoever to the browser
before starting the session and manipulating session or cookie variables.
Output includes any characters (also spaces, newlines) before the first
"<?php" of the file.

--
E. Dronkert
Nov 23 '05 #2
I did make sure of that but it is still not working ..... any other way
you can suggest??

Nov 25 '05 #3

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

Similar topics

5
by: Frostillicus | last post by:
I'm trying to use array_multisort to sort by one of the dimensions of an array stored in $GLOBALS like this: array_multisort($GLOBALS, SORT_STRING, SORT_DESC); Each "row" in $GLOBALS contains...
7
by: John | last post by:
Hi, I'm looking for the best way to deal with globals in PHP. As a 'C' software developer, I would normally avoid all globals and not have any at all, but use structs and pass everything in...
11
by: Nicolas Lehuen | last post by:
Hi, I hope this is not a FAQ, but I have trouble understanding the behaviour of the super() built-in function. I've read the excellent book 'Python in a Nutshell' which explains this built-in...
2
by: hexerror | last post by:
Hello, I am currently having an issue with accessing any type of Super Global variable from within my scripts. The issue occurs when I attempt to get the data from a Super Global variable from...
1
by: cokofreedom | last post by:
if __name__ == '__main__': print "Globals (For Loop):" try: for i in globals(): print "\t%s" % i except RuntimeError: print "Only some globals() printed\n" else: print "All globals()...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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,...
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.