Posted by MaxPain on 11/23/05 20:54
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.
Navigation:
[Reply to this message]
|