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

multiple sessions

Dear all,

I have a script which checks whether a user is logged in and on which level.
If he is not logged in, he will get the login screen. My problem is that the
script works on the server of the ISP, but not on my local machine. I
checked me php.ini files and also phpinfo on the ISP server. But what
happens is that if I try to log in on my local server the session is started
but not read by the next file, it returns again to the login screen. The
files in the /tmp directory are written and contain the data, but they are
not read in again. Can any body help me on this. I work with php 4.3.

Regards,
goalie
Jul 17 '05 #1
4 2767
Goalie wrote:
Dear all,

I have a script which checks whether a user is logged in and on which
level. If he is not logged in, he will get the login screen. My problem is
that the script works on the server of the ISP, but not on my local
machine. I checked me php.ini files and also phpinfo on the ISP server.
But what happens is that if I try to log in on my local server the session
is started but not read by the next file, it returns again to the login
screen. The files in the /tmp directory are written and contain the data,
but they are not read in again. Can any body help me on this. I work with
php 4.3.

Regards,
goalie


Hi,

I think you better named your posting: 'Broken Session' instead of multiple
session. You don't seem to get 1 running. :-)

Ok, many settings can influence the behaviour.
The BEST way to start is in my humble opinion in your browser.
1) Delete all cookies.
2) Goto you PHP page
3) CHeck if it sets a cookie with a PHPSESSIONID=blabla

(I expect not)

Now try to adjust your php.ini (and restart webserver if needed).
FInd the [Session] part

Pay special attention to:
session.save_handler = files (in most cases)
session.save_path = /tmp (or whereever you store the stuff)
session.use_cookies = 1 (important)
session.auto_start = 1 (important!)

The autostart is very handy.
You don't have to fiddle around with starting sessions and such.

For security: DOn't rely on the fact that a session exists, just rely on the
fact that YOU put something into a session.
It makes things much more clear from a programmers point-of-view.
(At least that is what I think.)

eg:
$_SESSION["userauthenticatedLevel1"] = "Y";
$_SESSION["userauthenticatedLevel2"] = "N";

is a good way to set userrights.

On the pages that are secured, just check for the right value in the
session.

Hope this helps.

Regards,
Erwin Moller

-----------------------------------------

Here follows mine (which works)

[Session]
; Handler used to store/retrieve data.
session.save_handler = files

; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
session.save_path = /tmp

; Whether to use cookies.
session.use_cookies = 1
; Name of the session (used as cookie name).
session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 1

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; The path for which the cookie is valid.
session.cookie_path = /

; The domain for which the cookie is valid.
session.cookie_domain =

; Handler used to serialize data. php is the standard serializer of PHP.
session.serialize_handler = php

; Percentual probability that the 'garbage collection' process is started
; on every session initialization.
session.gc_probability = 1

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

; Check HTTP Referer to invalidate externally stored URLs containing ids.
; HTTP_REFERER has to contain this substring for the session to be
; considered as valid.
session.referer_check =

; How many bytes to read from the file.
session.entropy_length = 0

; Specified here to create the session id.
session.entropy_file =

;session.entropy_length = 16

;session.entropy_file = /dev/urandom

; Set to {nocache,private,public} to determine HTTP caching aspects.
session.cache_limiter = nocache

; Document expires after n minutes.
session.cache_expire = 180

; use transient sid support if enabled by compiling with --enable-trans-sid.
session.use_trans_sid = 1

url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeent ry"
Jul 17 '05 #2
Dear all,

I changed the things in the php.ini file, but it didn't help (restarted
httpd as well).
My browser accepts cookies, in the temp directory a file made sess_blabla
after I clicked login. But when I go into my secure.php page
isset($_SESSION['name'] is false and I am redirected to my login page. After
that my second session file is started.

The session lines in php.ini looks like:
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /tmp
session.cookie_domain = donald
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 1440
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1

Regards,

Marcel
"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:41**********************@news.xs4all.nl...
Goalie wrote:
Dear all,

I have a script which checks whether a user is logged in and on which
level. If he is not logged in, he will get the login screen. My problem
is
that the script works on the server of the ISP, but not on my local
machine. I checked me php.ini files and also phpinfo on the ISP server.
But what happens is that if I try to log in on my local server the
session
is started but not read by the next file, it returns again to the login
screen. The files in the /tmp directory are written and contain the data,
but they are not read in again. Can any body help me on this. I work with
php 4.3.

Regards,
goalie


Hi,

I think you better named your posting: 'Broken Session' instead of
multiple
session. You don't seem to get 1 running. :-)

Ok, many settings can influence the behaviour.
The BEST way to start is in my humble opinion in your browser.
1) Delete all cookies.
2) Goto you PHP page
3) CHeck if it sets a cookie with a PHPSESSIONID=blabla

(I expect not)

Now try to adjust your php.ini (and restart webserver if needed).
FInd the [Session] part

Pay special attention to:
session.save_handler = files (in most cases)
session.save_path = /tmp (or whereever you store the stuff)
session.use_cookies = 1 (important)
session.auto_start = 1 (important!)

The autostart is very handy.
You don't have to fiddle around with starting sessions and such.

For security: DOn't rely on the fact that a session exists, just rely on
the
fact that YOU put something into a session.
It makes things much more clear from a programmers point-of-view.
(At least that is what I think.)

eg:
$_SESSION["userauthenticatedLevel1"] = "Y";
$_SESSION["userauthenticatedLevel2"] = "N";

is a good way to set userrights.

On the pages that are secured, just check for the right value in the
session.

Hope this helps.

Regards,
Erwin Moller

-----------------------------------------

Here follows mine (which works)

[Session]
; Handler used to store/retrieve data.
session.save_handler = files

; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
session.save_path = /tmp

; Whether to use cookies.
session.use_cookies = 1
; Name of the session (used as cookie name).
session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 1

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; The path for which the cookie is valid.
session.cookie_path = /

; The domain for which the cookie is valid.
session.cookie_domain =

; Handler used to serialize data. php is the standard serializer of PHP.
session.serialize_handler = php

; Percentual probability that the 'garbage collection' process is started
; on every session initialization.
session.gc_probability = 1

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

; Check HTTP Referer to invalidate externally stored URLs containing ids.
; HTTP_REFERER has to contain this substring for the session to be
; considered as valid.
session.referer_check =

; How many bytes to read from the file.
session.entropy_length = 0

; Specified here to create the session id.
session.entropy_file =

;session.entropy_length = 16

;session.entropy_file = /dev/urandom

; Set to {nocache,private,public} to determine HTTP caching aspects.
session.cache_limiter = nocache

; Document expires after n minutes.
session.cache_expire = 180

; use transient sid support if enabled by compiling
with --enable-trans-sid.
session.use_trans_sid = 1

url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeent ry"

Jul 17 '05 #3
Goalie wrote:
Dear all,

I changed the things in the php.ini file, but it didn't help (restarted
httpd as well).
My browser accepts cookies, in the temp directory a file made sess_blabla
after I clicked login. But when I go into my secure.php page
isset($_SESSION['name'] is false and I am redirected to my login page.
After that my second session file is started.
Hi,

Are both files on the same domain? (should be)
And what is 'donald' excactly doing in your php.ini?
--> session.cookie_domain = donald <--

Is that a valid domain????
Try to remove donald, and try again.

Regards,
Erwin Moller

The session lines in php.ini looks like:
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /tmp
session.cookie_domain = donald
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 1440
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1

Regards,

Marcel

Jul 17 '05 #4
Yes, they are in the same domain.
I removed it, but not succeed.

Goalie
"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:41**********************@news.xs4all.nl...
Goalie wrote:
Dear all,

I changed the things in the php.ini file, but it didn't help (restarted
httpd as well).
My browser accepts cookies, in the temp directory a file made sess_blabla
after I clicked login. But when I go into my secure.php page
isset($_SESSION['name'] is false and I am redirected to my login page.
After that my second session file is started.


Hi,

Are both files on the same domain? (should be)
And what is 'donald' excactly doing in your php.ini?
--> session.cookie_domain = donald <--

Is that a valid domain????
Try to remove donald, and try again.

Regards,
Erwin Moller

The session lines in php.ini looks like:
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /tmp
session.cookie_domain = donald
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 1440
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 1

Regards,

Marcel

Jul 17 '05 #5

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

Similar topics

13
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...
4
by: john | last post by:
How do u guys handle multiple sessions?? i.e, opening different browser windows by running iexplore.exe or clicking IE icons and opening the application. My sessions are mixing up. what i mean is...
11
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
0
by: RonNanko | last post by:
Hi, let me first explain what my problem is all about: I have a third-party application, which does not allow multiple instances of itself. As I need to run the application in multiple instances...
1
by: Rob | last post by:
I have an ASP.NET application that uses forms-based authentication. A user wishes to be able to run multiple sessions of this application simultaneously from the user's client machine. The...
4
by: Shankar Reddy | last post by:
Hi All, Problem: Data is being shared across multiple sessions in ASP.NET! Does anybody come across this kind of situation where session data or view state data is being shared across...
18
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site...
2
by: vmalhotra | last post by:
Hi I am new in python scripting. I want to open a Multiple telnet session through once script. In other way i can tell i want to open two linux consoles through one script. I wrote one...
3
by: Ben Holness | last post by:
Hi all, I have a php/mysql website where people can upload their own graphics for the buttons and background of pages on the website. This used to run on one server, but I have now been asked...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?

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.