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

session & browsers (final)

I ask something relative later but the answer make me cry ;-)
If we duplicate the browser window (both in IE / Mozilla), both of 2 browser windows use the same session!!!
This produces many problems...

My program is this:
I have html format books inside zip files.
If I choose a book from my main page, php sets
$_SESSION['book'] = "a_book.zip";
and loads the index.html from a_book.zip.
if we click a link inside index.html like:
<a href=chapter1.html>Next</a>
Apache returns error 404, php handles this error and returns file chapter1.html from a_book.zip

All right but the problem is this:
If I duplicate browser window and in the 2nd browser I select another book, then because both of 2 browser use the same session, 2nd
browser change the $_SESSION['book'] and 1st browser searches in wrong zip file.

Any suggestions?

Regards
Gessos Paul

Jul 17 '05 #1
6 2189

"<- Chameleon ->" <ch******@hotmail.NOSPAM.com> a écrit dans le message de
news: bn**********@nic.grnet.gr...
I ask something relative later but the answer make me cry ;-)
If we duplicate the browser window (both in IE / Mozilla), both of 2 browser windows use the same session!!! This produces many problems...

My program is this:
I have html format books inside zip files.
If I choose a book from my main page, php sets
$_SESSION['book'] = "a_book.zip";
and loads the index.html from a_book.zip.
if we click a link inside index.html like:
<a href=chapter1.html>Next</a>
Apache returns error 404, php handles this error and returns file chapter1.html from a_book.zip
All right but the problem is this:
If I duplicate browser window and in the 2nd browser I select another book, then because both of 2 browser use the same session, 2nd browser change the $_SESSION['book'] and 1st browser searches in wrong zip file.
Any suggestions?

Regards
Gessos Paul


sorry for makin' you cry :)

for your problem, maybe you should try to use a random ID (or book name if
unique) for each search made on your Zip or something like that.
You should add something in your session to identify which book you're
using.
something like :
$book["RANDOM_ID"]["BOOK"]
$book["RANDOM_ID"]["OTHER_VAR_RELATED_TO_THIS_BOOK"]

You'll need to write a script to manage those vars and crush the session
var.

hope it'll help
Regards,
Julien.

Jul 17 '05 #2
> > I have html format books inside zip files.
If I choose a book from my main page, php sets
$_SESSION['book'] = "a_book.zip";
and loads the index.html from a_book.zip.
if we click a link inside index.html like:
<a href=chapter1.html>Next</a>
Apache returns error 404, php handles this error and returns file chapter1.html from a_book.zip

All right but the problem is this:
If I duplicate browser window and in the 2nd browser I select another

book, then because both of 2 browser use the same session, 2nd
browser change the $_SESSION['book'] and 1st browser searches in wrong zip file.

for your problem, maybe you should try to use a random ID (or book name if
unique) for each search made on your Zip or something like that.
You should add something in your session to identify which book you're
using.
something like :
$book["RANDOM_ID"]["BOOK"]
$book["RANDOM_ID"]["OTHER_VAR_RELATED_TO_THIS_BOOK"]

You'll need to write a script to manage those vars and crush the session
var.


Thank you for your response, but I don't understand. Sorry ;-(
first of all book name is unique. I have 2 browser windows:
1st has $_SESSION['book'] = 'php_manual.zip'
2nd overide $_SESSION['book'] = 'thinking_in_cplusplus.zip' because has the same session
so when 1st gets image: image.jpg from an <A> tag, php search inside 'thinking_in_cplusplus.zip' and not inside 'php_manual.zip'

You suggest $_SESSION['book'] will be an array? How it help?
thank you
Jul 17 '05 #3
On Thu, 30 Oct 2003 17:38:18 +0200, <- Chameleon -> wrote:
Thank you for your response, but I don't understand. Sorry ;-(
first of all book name is unique. I have 2 browser windows:
1st has $_SESSION['book'] = 'php_manual.zip'
2nd overide $_SESSION['book'] = 'thinking_in_cplusplus.zip' because has the same session
so when 1st gets image: image.jpg from an <A> tag, php search inside 'thinking_in_cplusplus.zip' and not inside 'php_manual.zip'

You suggest $_SESSION['book'] will be an array? How it help?
thank you


He's saying that you need to use a unique identifier for each book OTHER
than the generic name 'book'. (Also note that the session for a browser
and ALL of its open windows is the same session.)

So if book names are unique, track the book by using the name of the book,
instead of the very generic variable name "$book".

Something like

$_SESSION['book_list']['a_book'] = 'a_book_file.zip';
$_SESSION['book_list']['b_book'] = 'b_book_file.zip';
$_SESSION['book_list']['c_book'] = 'c_book_file.zip';

etc...

That makes an array $_SESSION['book_list']. Use that array to keep all
the books in one place, but use a different key for each book, in this
case the key is the book's name.

Hope this helps. If not, then learn more about Arrays, Multi-dimensional
arrays, Associative arrays, and Sessions. Go to
http://www.php.net/manual/ for that.

later...
--
Jeffrey D. Silverman | jeffrey AT jhu DOT edu
Johns Hopkins University | Baltimore, MD
Website | http://www.wse.jhu.edu/newtnotes/

Jul 17 '05 #4
> He's saying that you need to use a unique identifier for each book OTHER
than the generic name 'book'. (Also note that the session for a browser
and ALL of its open windows is the same session.)

So if book names are unique, track the book by using the name of the book,
instead of the very generic variable name "$book".

Something like

$_SESSION['book_list']['a_book'] = 'a_book_file.zip';
$_SESSION['book_list']['b_book'] = 'b_book_file.zip';
$_SESSION['book_list']['c_book'] = 'c_book_file.zip';

etc...

That makes an array $_SESSION['book_list']. Use that array to keep all
the books in one place, but use a different key for each book, in this
case the key is the book's name.

Hope this helps.


Thank you but it is wrong ;-)
Wrong because you want a key (the book's name).
Where can I store this key? In Session? In this case we fall in the start of the problem.
I cannot use GET, POST & COOKIE
Jul 17 '05 #5
On Thu, 30 Oct 2003 21:44:33 +0200, <- Chameleon -> wrote:
Thank you but it is wrong ;-)
Wrong because you want a key (the book's name).
Where can I store this key? In Session? In this case we fall in the start of the problem.
I cannot use GET, POST & COOKIE


You lost me there. Why can't you store the book's name in a session?
--
Jeffrey D. Silverman | jeffrey AT jhu DOT edu
Johns Hopkins University | Baltimore, MD
Website | http://www.wse.jhu.edu/newtnotes/

Jul 17 '05 #6
> > Thank you but it is wrong ;-)
Wrong because you want a key (the book's name).
Where can I store this key? In Session? In this case we fall in the start of the problem.
I cannot use GET, POST & COOKIE


You lost me there. Why can't you store the book's name in a session?


because 2nd browser windows which points in other book will overide 1st browser book's name.

anyway, I found other method to accomplish:
Until now I dont knew that:
I can pass data with GET with this:
book.php/thinking_in_cplusplus.zip/index.html

All are easy now

thanks
Jul 17 '05 #7

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

Similar topics

2
by: | last post by:
>> When I open a second browser window from the first, it uses the same session with first!!! > This is not true. session_id is unique for each combination of browser/url. I believe this too,...
0
by: Maverick | last post by:
Hello all, I read some good reviews about jakarta HTTPClient about its session and cookies management system and fancied giving it a try as a learning exercise but somehow I don't seem to be able...
8
by: Patrick | last post by:
Hi I am in the process of learning javascript and was wondering how often the web professionals update I.E & N.N? I mean do you religiously wait for the next upgrade and download it ASAP when...
5
by: Jukka K. Korpela | last post by:
The HTML specifications define the entities &zwj;, &zwnj;, &lrm;, &rlm; as denoting zero-width joiner, zero-width non-joiner, left to right mark, and right to left mark. Is there any evidence of...
17
by: Torbjørn Pettersen | last post by:
I've got a table where I want some of the cells to use a background image. The cells have variable height, so I am using an image with a rather small height to fill up the background of the cells,...
19
by: Mel | last post by:
when downloading files from my site, when file types are known (i.e *.doc) browsers open the file for viewing. is there a way to disable that and just present the save as dialog (same as for...
4
by: Chris | last post by:
When a request comes into a page on my ASP.net site and a session is not found, I want to detect whether the request is an initial request or if the user did have a session going that has now been...
0
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that...
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.