SESSIONS creating trouble
Moderator: General Moderators
-
anandkanatt
- Forum Newbie
- Posts: 3
- Joined: Fri Aug 05, 2005 5:27 am
- Location: Inside Apache
- Contact:
SESSIONS creating trouble
I am working on a small login form here both admin and password is checked against a row in table and a session variable is set to store result ie if login of user is okay I set $_SESSION['user'] = TRUE; but my problem is when i try to access this session variable in another page it shows an error "Notice: Undefined index: user" , i am passing session ID to this page and session_start() is also specified at top of the page. I am using IIS 5.0 and PHP 5. MY browser accepts cookies from other sites .. please help me with this problem can anyone suggest the best way to use sessions in PHP coz i am new to PHP.
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
I have been having this doubt for a long time.
Can 'TRUE' or 'FALSE' can be assigned to $variables?
I know NULL can be assigned but I dont know about the other two.
And about the problem, I guess the session variable is not I suppose.
give some other value for the session variable.
Its better if you can give us the first few lines say 10 lines of code of each file.
Can 'TRUE' or 'FALSE' can be assigned to $variables?
I know NULL can be assigned but I dont know about the other two.
And about the problem, I guess the session variable is not I suppose.
give some other value for the session variable.
Its better if you can give us the first few lines say 10 lines of code of each file.
yes true false can be assigned to variables, that is how you create boolean variables (one way at least).
ex:
the above should echo "1".
ex:
Code: Select all
<?
session_start();
$_SESSION['whatver'] = TRUE;
if($_SESSION['whatver'])
echo $_SESSION['whatver'];
?>-
anandkanatt
- Forum Newbie
- Posts: 3
- Joined: Fri Aug 05, 2005 5:27 am
- Location: Inside Apache
- Contact:
hey i got the workaround
hey i got the workaround ... since i am using IIS the PHPSESSID i send was not parsed before the session_start() would process so each time session_start() is called a new session was being created.
and what i did to solve was to just add line before the session_start()
I think this workaround will be useful for all the people developing PHP APPS using IIS-PHP combo.
and about the TRUE , FALSE variables .. it is perfectly ok to use these variables but the actual value stored as TRUE and FALSE is 1 and 0.
Anyway thanks for the posts ...
AK
and what i did to solve was to just add
Code: Select all
session_id(@$_GET['PHPSESSID'])I think this workaround will be useful for all the people developing PHP APPS using IIS-PHP combo.
and about the TRUE , FALSE variables .. it is perfectly ok to use these variables but the actual value stored as TRUE and FALSE is 1 and 0.
Anyway thanks for the posts ...
AK