Easy PHP Calendar - We really take care of your dates!


Go Back   Easy PHP Calendar > Pre-Sales Questions > General

General Get answers to your questions before purchasing the Easy PHP Calendar.

Closed Thread
 
Thread Tools Search this Thread Display Modes

Session Problem
Old 10-28-2007, 12:17 PM   #1
qenq
Calendar User
 
qenq is offline
Join Date: Oct 2007
Posts: 7
Default Session Problem

Hi, i installed the calender in my existing programm which works with sessions too. When i login as an admin, my sessions are disturbed by the calender. When i am logged out, my programm sees that there was an session_destroy() and quits working.

So my question is, are there users here who have had the same problems, and how did they fix it, or is there someone else to help me out.

Thanks in advantage

Cheers
QenQ
 

Old 10-29-2007, 01:12 AM   #2
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,878
Default

You may try having the calendar admin open in a new window.
__________________
-- Brian

Questions?

Instructions: Version 6 - Version 7 | FAQ | Errors FAQ | Paths FAQ | Forums | Support
| Web Site Hosting
 

Session Problem
Old 10-29-2007, 01:54 AM   #3
qenq
Calendar User
 
qenq is offline
Join Date: Oct 2007
Posts: 7
Default Session Problem

Yes, but if i do so, it is just the same, nothing changes if you open the calendar from an exisiting windon into a new window, the session_id will be the same, an if your calendar destroys it, my session_id is gone to.

On php.net i found this

Quote:
Sessions and browser's tabs

May you have noticed when you open your website in two or more tabs in Firefox, Opera, IE 7.0 or use 'Control+N' in IE 6.0 to open a new window, it is using the same cookie or is passing the same session id, so the another tab is just a copy of the previous tab. What you do in one will affect the another and vice-versa. Even if you open Firefox again, it will use the same cookie of the previous session. But that is not what you need mostly of time, specially when you want to copy information from one place to another in your web application. This occurs because the default session name is "PHPSESSID" and all tabs will use it. There is a workaround and it rely only on changing the session's name.

Put these lines in the top of your main script (the script that call the subscripts) or on top of each script you have:

if(version_compare(phpversion(),'4.3.0')>=0) {
if(!ereg('^SESS[0-9]+$',$_REQUEST['SESSION_NAME'])) {
$_REQUEST['SESSION_NAME']='SESS'.uniqid('');
}
output_add_rewrite_var('SESSION_NAME',$_REQUEST['SESSION_NAME']);
session_name($_REQUEST['SESSION_NAME']);
}

How it works:

First we compare if the PHP version is at least 4.3.0 (the function output_add_rewrite_var() is not available before this release).

After we check if the SESSION_NAME element in $_REQUEST array is a valid string in the format "SESSIONxxxxx", where xxxxx is an unique id, generated by the script. If SESSION_NAME is not valid (ie. not set yet), we set a value to it.

uniqid('') will generate an unique id for a new session name. It don't need to be too strong like uniqid(rand(),TRUE), because all security rely in the session id, not in the session name. We only need here a different id for each session we open. Even getmypid() is enough to be used for this, but I don't know if this may post a treat to the web server. I don't think so.

output_add_rewrite_var() will add automatically a pair of 'SESSION_NAME=SESSxxxxx' to each link and web form in your website. But to work properly, you will need to add it manually to any header('location') and Javascript code you have, like this:

header('location: script.php?'.session_name().'='.session_id()
. '&SESSION_NAME='.session_name());

<input type="image" src="button.gif" onClick="javascriptpen_popup('script.php?<?php
echo session_name(); ?>=<?php echo session_id(); ?>&SESSION_NAME=<?php echo session_name(); ?>')" />

The last function, session_name() will define the name of the actual session that the script will use.

So, every link, form, header() and Javascript code will forward the SESSION_NAME value to the next script and it will know which is the session it must use. If none is given, it will generate a new one (and so, create a new session to a new tab).

May you are asking why not use a cookie to pass the SESSION_NAME along with the session id instead. Well, the problem with cookie is that all tabs will share the same cookie to do it, and the sessions will mix anyway. Cookies will work partially if you set them in different paths and each cookie will be available in their own directories. But this will not make sessions in each tab completly separated from each other. Passing the session name through URL via GET and POST is the best way, I think.
I did not yet try it out, i thought maybe you did notice this problem already.

Cheers
QenQ
 

Old 10-29-2007, 09:01 PM   #4
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,878
Default

The Admin Managers weren't designed to be used along with another PHP session. I have had this asked once before that I remember, and they worked around it. However, it's been some time ago and I don't remember what they did.

The only think I can think (which I don't event know if it's possible) is use a separate sessions paths (set in the setup/sessionsPath.php file) for the calendar.
__________________
-- Brian

Questions?

Instructions: Version 6 - Version 7 | FAQ | Errors FAQ | Paths FAQ | Forums | Support
| Web Site Hosting
 
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Path Problems??? mungojeerie Installation / Upgrade Questions 5 01-15-2007 11:12 PM
Install Problem SinJin Installation / Upgrade Questions 3 11-19-2006 09:41 PM
A problem with "add an event" button iraultza General 1 07-17-2006 11:49 AM
Event Admin Error Messages : WARNING Session Start.... Polygamist General Support 4 05-03-2005 01:35 PM



All times are GMT -4. The time now is 12:45 AM.


vBulletin skins developed by: eXtremepixels
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright 2009 NashTech, Inc.

| Home | Register | Today's Posts | Search | New Posts |