473,597 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2781
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=bl abla

(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_ha ndler = files (in most cases)
session.save_pa th = /tmp (or whereever you store the stuff)
session.use_coo kies = 1 (important)
session.auto_st art = 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["userauthentica tedLevel1"] = "Y";
$_SESSION["userauthentica tedLevel2"] = "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_ha ndler = 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_pa th = /tmp

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

; Initialize session on request startup.
session.auto_st art = 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.seriali ze_handler = php

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

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxl ifetime = 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.entrop y_length = 16

;session.entrop y_file = /dev/urandom

; Set to {nocache,privat e,public} to determine HTTP caching aspects.
session.cache_l imiter = nocache

; Document expires after n minutes.
session.cache_e xpire = 180

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

url_rewriter.ta gs = "a=href,area=hr ef,frame=src,in put=src,form=fa keentry"
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_ha ndler = files
session.save_pa th = /tmp
session.use_coo kies = 1
session.name = PHPSESSID
session.auto_st art = 1
session.cookie_ lifetime = 0
session.cookie_ path = /tmp
session.cookie_ domain = donald
session.seriali ze_handler = php
session.gc_prob ability = 1
session.gc_maxl ifetime = 1440
session.referer _check =
session.entropy _length = 0
session.entropy _file =
session.cache_l imiter = nocache
session.cache_e xpire = 180
session.use_tra ns_sid = 1

Regards,

Marcel
"Erwin Moller"
<si************ *************** *************** @spamyourself.c om> 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=bl abla

(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_ha ndler = files (in most cases)
session.save_pa th = /tmp (or whereever you store the stuff)
session.use_coo kies = 1 (important)
session.auto_st art = 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["userauthentica tedLevel1"] = "Y";
$_SESSION["userauthentica tedLevel2"] = "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_ha ndler = 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_pa th = /tmp

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

; Initialize session on request startup.
session.auto_st art = 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.seriali ze_handler = php

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

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxl ifetime = 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.entrop y_length = 16

;session.entrop y_file = /dev/urandom

; Set to {nocache,privat e,public} to determine HTTP caching aspects.
session.cache_l imiter = nocache

; Document expires after n minutes.
session.cache_e xpire = 180

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

url_rewriter.ta gs = "a=href,area=hr ef,frame=src,in put=src,form=fa keentry"

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_ha ndler = files
session.save_pa th = /tmp
session.use_coo kies = 1
session.name = PHPSESSID
session.auto_st art = 1
session.cookie_ lifetime = 0
session.cookie_ path = /tmp
session.cookie_ domain = donald
session.seriali ze_handler = php
session.gc_prob ability = 1
session.gc_maxl ifetime = 1440
session.referer _check =
session.entropy _length = 0
session.entropy _file =
session.cache_l imiter = nocache
session.cache_e xpire = 180
session.use_tra ns_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************ *************** *************** @spamyourself.c om> 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_ha ndler = files
session.save_pa th = /tmp
session.use_coo kies = 1
session.name = PHPSESSID
session.auto_st art = 1
session.cookie_ lifetime = 0
session.cookie_ path = /tmp
session.cookie_ domain = donald
session.seriali ze_handler = php
session.gc_prob ability = 1
session.gc_maxl ifetime = 1440
session.referer _check =
session.entropy _length = 0
session.entropy _file =
session.cache_l imiter = nocache
session.cache_e xpire = 180
session.use_tra ns_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
12032
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...
4
31178
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 suppose i log in my site using username "test". At this time I set $_SESSION="test". And I use $_SESSION inside my application to print the username. Now if I open another browser & log in with "another test" the session
11
4935
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., http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=Tidy7IDbDHA.2108%40cpmsftngxa06.phx.gbl) that indicate that ASP will queue up requests when they come in with the same "session".
0
2030
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 (it is processing data, a job which can be neatly parallelized) I have created five user accounts on my XP Home system, log in as every one of these users and launch the application in each session, which works fine. (BTW: is the number of users...
1
3487
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 web.config file is configured as such: <authentication mode="Forms"> <forms loginUrl="Login.aspx" protection="All" name="myApplication"/> </authentication>
4
2332
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 different sessions? is it a bug in ASP.NET? or is it some thing i have to take care programatically when we develop asp.net application?
18
3381
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 relies on subscrption fees. Sessions ID's are matched between the browser and the server. So a users can login with same username and password and those sessions are tracked individually. Some suggest create table fields with the session ID...
2
7699
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 script, but the issue is I am not able to open multiple consoles. The Scripts which i wrote is as follows: import pexpect
3
3981
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 to set it up on multiple servers. The problem is that when someone uploads a file, how do I distribute it to all of the servers? Should I use php to send it to all of the servers once
0
7959
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8379
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...
0
8254
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
6677
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...
1
5842
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5421
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
3876
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...
1
2393
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1226
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.