Jump to content

[SOLVED] Help Please


oceans

Recommended Posts

Friends,

 

Has any one encountered the following problem:

 

When I open two or more IE windows on the same computer, both the IE windows are NOT starting different session files at my server, the first one starts a file and all uses the same file!

 

Is this normal? I understand that each client should open a unique file right! Even if all the clients are coming from the same PC?

 

I don’t do any thing special, I just simply declare like the following:

 

<?php
ob_start();
session_start();
$_SESSION['SessionVariable01']=0;
?>

 

Got I got to do any setup at my server?

Link to comment
Share on other sites

This is the default behavior of the IE 7 and Mozilla.

 

This is better for you to accept it.

 

The solution is when you first time start session you need to dynamic create and pass session id each time and need to pass session id at each pages and use it to continue with session.

 

The solution is very crucial.

Link to comment
Share on other sites

I am open,

 

I am willing to handle it myself

 

I do not know If I would have talked to you earlier on this.

 

Can you please advice the following:

 

The maxlength for session file name.

 

I will create random alphanumeric and name the file, then use the file, but the problem is how would I know if the random named file is already in use?

Link to comment
Share on other sites

As normal I have 1 start page and all links.

 

thus am I right to say

 

the following goes to the first page

$session_id = md5('projectname_'.time());

session_id($session_id);
session_start();

 

the following goes to all the session involved pages

session_start();

Link to comment
Share on other sites

I wish to replace "projectname_" with some run time random alphanumeric to make it little more robust it is OK?

 

by the way i noted the used sessions files are littered in the session folder, it is the server's job to clear after timeout or is it my job to clear using my php code?

Link to comment
Share on other sites

Internet was down

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

(1) Suppose you are first time starting a session

file : page1.php

$session_id = md5('projectname_'.time()); // when you come to this page in IE 7 and mozilla session id will be diff so session will be different

 

session_id($session_id);

session_start();

 

(2) Now you are redirecting from page1.php to page2.php

location('header:page2.php?session_id?session_id='.$session_id);  // I mean you need to pass session id every where (keep in mind this must be in query. do not send in hidden variable)

At page2.php start session like this.

 

session_id($_REQUEST['session_id']);  // You are using a session which is created at page1.php

session_start();

 

Now i think you will got. what i am saying to do.

Link to comment
Share on other sites

Jitesh,

 

I tried your method.

 

(1) Index.php

$session_id = md5('projectname_'.time());

session_id($session_id);
session_start();

 

(2) All other page

session_start();

 

It works well, I do not know is it reliable as I have not done your latest instruction.

 

But in accordence with your latest instructions I have one concern, if I walk from page to page using PHP I can do your instruction what if I walk from page to page via html hyperlink. In my case yes I do both.

 

Please advice, one interesting thing with I used php 4 i did not have this problem, I tried with yahoo, same set of codes.

Link to comment
Share on other sites

Jitesh,

 

I have some problem,

 

this is what I did

 

for sending session id to next page(s), I have a chain of page which requires input from previous.

header('location: PageX.php?session_id='.$session_id);

 

in the next page header

$session_id = session_id($_REQUEST['session_id']);

 

then body

header('location: PageX.php?session_id='.$session_id);

 

somthing is wrong can you help.

 

Yes, I want to implement

Link to comment
Share on other sites

next to next page you will get sesssion id through request

$_REQUEST['sesson_id'];

 

 

So make

header('location: PageX.php?session_id='.$_REQUEST['sesson_id']);

or

header('location: PageX.php?session_id='.session_id());

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

 

better advide

 

make

header('location: PageX.php?session_id='.session_id());

every where

 

in anchor tag like this

<a src="test.php?session_id=<?php echo session_id();?>">

 

because

session_id() is PHP API to either set session id or retrive set session id.

Link to comment
Share on other sites

Jitesh,

 

Thanks for being with me

 

I have 5 pages,

 

Page 1 in header

$session_id = md5(time());
session_id($session_id);
session_start();

 

Page 1 in body

header('location: Page2.php?session_id='.$session_id);

 

Page 2 in header

session_id($_REQUEST['session_id']);
session_start();

 

Page 2 in body

header('location: Page3.php?session_id='.$session_id);

.

 

Page 3 in header

session_id($_REQUEST['session_id']);
session_start();

 

Page 3 in body

header('location: Page4.php?session_id='.$session_id);

 

 

Page 1 ok, page 2 ok, but in page 3, I get the following:

 

"

Warning: session_start() [function.session-start]: The session id contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in C:\wamp\www\Page3.php on line 4

 

"

line 4 is "session_start();"

 

I also noted that one new session file is being created as i walk from page 1 to 3

Link to comment
Share on other sites

change to this in header call

 

header('location: Page2.php?session_id='.session_id());

header('location: Page3.php?session_id='.session_id());

header('location: Page4.php?session_id='.session_id());

header('location: Page5.php?session_id='.session_id());

 

..........................................

Link to comment
Share on other sites

Can any one help me,

 

I AM GOING MAD!!!!!!!

 

Please help. I can't understand why..... ??? :'(

"

ob_start();

session_id($_REQUEST['session_id']);

session_start();

"

 

when I echo later in the body I get different number!!!!!!!!!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.