[PHP] Session problem

2010-12-21 Thread Walter Caielli
I'm facing the following basic problem:

I have made two simple sample files to explain it:

1st file:
".session_id();
   echo 'page 1';
?>

2nd file
";
   echo session_name().'+'.session_id();
   echo $_SESSION['SS_user'];
?>

$_SESSION seems to be empty. Nothing is print. Session Name and session ID 
are the same but it seems that $_SESSION is not shared across the two files. 
No HTML is made before sessioni_start().
Why?
I'm using PHP 5.3.4 on IIS, windows XP SP3. Tested as localhost or from 
another PC inside a LAN.

Many thanks
Walter




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] SESSION problem

2008-08-20 Thread tedd

At 12:55 AM +0100 8/20/08, Ford, Mike wrote:

Content-Type: text/plain
Content-length: 1998

Been on holiday, so coming to this party a bit late, but

On Sat 16/08/2008 15:06 Stut wrote:

 On 16 Aug 2008, at 14:46, tedd wrote:
 > At 2:11 PM +0100 8/16/08, Stut wrote:
 >> Ahh, I see the problem. You've never been able to use numbers as
 >> keys at the root level of the $_SESSION array. It's not a bug, it's
 >> just the way it is. I've just checked the documentation and can't
 >> find an obvious reference to this limitation which is kinda annoying.


Well at http://www.php.net/manual/en/session.examples.php there's a 
big fat Note at the top of the page which includes the following: 
"The keys in the $_SESSION associative array are subject to the same 
limitations as regular variable names in PHP, i.e. they cannot start 
with a number and must start with a letter or underscore.".


Yeah, but that's no fair -- you read the documentation.  :-)

Seriously, however, the thing that bothered me wasn't the limitations 
in keys, that's understandable, but rather if you do use a numeric 
index, then all the legal session variables declared after that 
incident no longer work.


Imagine having ten session variables working and then adding another 
with a numeric index between sessions five and six declarations.


I can see the session with the numeric index not working, but why 
would sessions six through ten stop?


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] SESSION problem

2008-08-19 Thread Ford, Mike
Been on holiday, so coming to this party a bit late, but
 
On Sat 16/08/2008 15:06 Stut wrote:
> On 16 Aug 2008, at 14:46, tedd wrote:
> > At 2:11 PM +0100 8/16/08, Stut wrote:
> >> Ahh, I see the problem. You've never been able to use numbers as 
> >> keys at the root level of the $_SESSION array. It's not a bug, it's 
> >> just the way it is. I've just checked the documentation and can't 
> >> find an obvious reference to this limitation which is kinda annoying.
 
Well at http://www.php.net/manual/en/session.examples.php there's a big fat 
Note at the top of the page which includes the following: "The keys in the 
$_SESSION associative array are subject to the same limitations as regular 
variable names in PHP, i.e. they cannot start with a number and must start with 
a letter or underscore.".
 
[ -- SNIP -- ]

> > Let me play the age-card -- in every language I've programmed in for 
> > the last 43 years an array can have numeric indexes -- except php's 
> > SESSION.
> 
> I wish I understood the reason why it's like this but I've never 
> looked into the session extension in that level of detail, but I doubt 
> such a limitation would exist if there was not a very good reason for 
> it. 

One word suffices here: register_globals! Or, if that doesn't suffice: if 
register_globals is turned on, all the $_SESSION entries are automatically 
registered as global variables -- so any numeric indexes will obviously be 
invalid and will "disappear". For consistency's sake, PHP enforces the 
restriction even with register_globals off.
 
Cheers!
 
Mike
 
-- 
Mike Ford,  Electronic Information Developer, 
Libraries & Learning Innovation, 
C507, Civic Quarter Campus, Leeds Metropolitan University,
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: [EMAIL PROTECTED]Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm


Re: [PHP] SESSION problem

2008-08-16 Thread Sabine Richter



tedd schrieb:

Sabine:

I understand the problem now.

But to get to my basic question to you, namely using this link:

http://www.webbytedd.com/b2/session-test1/index.php

 -- does SESSION[20] and SESSION[test2] show anything in the second step 
(Step 2) or are the results blank?


Oh, ok, when I just call your URL: they are both blank!

Cheers,
Sabine


Cheers,

tedd



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread tedd

Sabine:

I understand the problem now.

But to get to my basic question to you, namely using this link:

http://www.webbytedd.com/b2/session-test1/index.php

 -- does SESSION[20] and SESSION[test2] show anything in the second 
step (Step 2) or are the results blank?


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread tedd

At 5:15 PM +0100 8/16/08, Stut wrote:

Instead I assert you would have...

$_SESSION['user_purchase'][0] = $item0;
...
$_SESSION['user_purchase'][9] = $item9;

which is perfectly valid.

I'll try to re-word my basic point... I personally consider it bad 
to even want to use numeric indexes at the root level of the 
$_SESSION array because it creates data with no context in a 
globally accessible location.



Ahhh, I see with what you're saying -- that's a good point.

For my temp variables, I should have used some like:

$_SESSION['tedd_temps'][0] = $item0;
...
$_SESSION['tedd_temps'][9] = $item9;

That would have fit much better if I had been programming in a group.

Thanks for taking the time to explain that.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread Sabine Richter

Hi Tedd,

tedd schrieb:

At 2:45 PM +0200 8/16/08, Sabine Richter wrote:
Yes, our mails overlaped each other (Do you say that in english? My 
english is not the best.)


Sabine:

Your English is fine -- much better than my de for certain.

Thanks :-)


By the way: I tried your initial code and I had no problem with the 
variable declared after the numeric ones. (your $_SESSION['test']). I 
tried on a Version 5.2.5 an Win XP.


That's interesting.

Let's make sure we're talking about the same thing here.

This is the demo:

http://www.webbytedd.com/b2/session-test1/index.php

In my browser Step 1 shows:

SESSION[20] => good morning
SESSION[test2] => good night

In Step 2:

Neither are there.

Is that what you see?


I tried the script from your first example on 
http://www.webbytedd.com/b2/session-test/index1.php


I just deleted the header and footer includes and set the error 
reporting to E_ALL.


That's what I get:

index.php:
f411abf8cb6cb7e0f2d091251c1906dd
Step 1 -- SESSIONs Recorded
1 = 1
2 = 2
3 = 3
4 = 4
5 = 5
6 = 6
7 = 7
8 = 8
9 = 9
10 = 10
hello

Code:




Step 1 -- SESSIONs Recorded

");
}

echo($_SESSION['test']);

?>











Code:






Notice: Unknown: Skipping numeric key 1. in Unknown on line 0

Notice: Unknown: Skipping numeric key 2. in Unknown on line 0

Notice: Unknown: Skipping numeric key 3. in Unknown on line 0

Notice: Unknown: Skipping numeric key 4. in Unknown on line 0

Notice: Unknown: Skipping numeric key 5. in Unknown on line 0

Notice: Unknown: Skipping numeric key 6. in Unknown on line 0

Notice: Unknown: Skipping numeric key 7. in Unknown on line 0

Notice: Unknown: Skipping numeric key 8. in Unknown on line 0

Notice: Unknown: Skipping numeric key 9. in Unknown on line 0

Notice: Unknown: Skipping numeric key 10. in Unknown on line 0


index1.php:
f411abf8cb6cb7e0f2d091251c1906dd
Step 2 -- Results of SESSIONs passed

Notice: Undefined offset: 1 in 
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21

1 =

Notice: Undefined offset: 2 in 
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21

2 =

Notice: Undefined offset: 3 in 
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21

3 =

Notice: Undefined offset: 4 in 
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21

4 =

Notice: Undefined offset: 5 in 
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21

5 =

Notice: Undefined offset: 6 in 
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21

6 =

Notice: Undefined offset: 7 in 
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21

7 =

Notice: Undefined offset: 8 in 
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21

8 =

Notice: Undefined offset: 9 in 
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21

9 =

Notice: Undefined offset: 10 in 
P:\xampp\htdocs\sabine\test_diverse\index1.php on line 21

10 =
hello

Code:




Step 2 -- Results of SESSIONs passed

");
}

echo($_SESSION['test']);



?>











Code:






You see, I get the content of $_SESSION['test'] in index1.php.
It's the same as in your second example, isn't it?
I would try your second example too, but you highlighted the code of 
index.php in index1.php too. So I can't.





Cheers
Sabine






Cheers,

tedd




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread Stut

On 16 Aug 2008, at 17:03, tedd wrote:
I understand what you are saying -- semantics are important. But if  
there is a need for temporary place to store values I don't consider  
it bad form to store them in a numerically indexed array.


For example, if a user was going to purchase up to 10 items, I see  
nothing wrong is using:


user_purchase[0] = $item0;
...
user_purchase[9] = $item9;

And as such, one can easily extract what the user purchased by  
simply using for().


However, in this case I don't see the gain provided by using:

user_purchase['item1'] = $item0;
...
user_purchase['item9'] = $item9;

But that distinction would be required IF you were using SESSIONs.  
And that's one of my points -- normal arrays come in two types and  
the SESSION array don't.


I think you're missing the core of my point. My point only refers to  
the root level of the $_SESSION array. I have no problem with using  
numerically-indexed arrays elsewhere - I come from a C background so  
it's where I started too and frequently use them.


However, in the example above you would not use...

$_SESSION[0] = $item0;
...
$_SESSION[9] = $item9;

Instead I assert you would have...

$_SESSION['user_purchase'][0] = $item0;
...
$_SESSION['user_purchase'][9] = $item9;

which is perfectly valid.

I'll try to re-word my basic point... I personally consider it bad to  
even want to use numeric indexes at the root level of the $_SESSION  
array because it creates data with no context in a globally accessible  
location.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread tedd

At 3:06 PM +0100 8/16/08, Stut wrote:
Not really, since I would never name a session variable 1, or 2, or 
5318008 - I would always put those in the session in a named array.


That's understandable. But, if you came from a background that 
predated associate arrays, then using numeric indexes would seem more 
natural. To me arrays come in two types, those with numeric indexes 
and those with string indexes. I use both.


I wish I understood the reason why it's like this but I've never 
looked into the session extension in that level of detail, but I 
doubt such a limitation would exist if there was not a very good 
reason for it. But again, I don't see how this is relevant.


I never said it was relevant.

I am sure too that whatever the reason was, it made sense at the time 
and for the problem of the time -- similar to the a1 < z discussion 
of a couple of years back.


It's natural to me to see the session array as a filing cabinet. At 
the top level you would have files with names that indicate what 
they are. Within each file it may be further divided into numbered 
sections. Given that I can't see into the future, even if I 
currently only have one set of data (file) to store in the session 
(the filing cabinet) I wouldn't just chuck the bits of paper from 
the file into the filing cabinet. I'd leave them in the file such 
that when I need to add a new file I don't need to gather up all the 
other bit of paper into a single file to get it organised again.


Ok, that didn't quite make it as clear as I wanted it to but I hope 
it illustrates the point I'm trying to make. The root level of the 
session array (IMHO) should contain descriptive keys, and I've never 
been in a situation where 5318008 is descriptive and gives context 
to the data unless you turn it upside down!


I understand what you are saying -- semantics are important. But if 
there is a need for temporary place to store values I don't consider 
it bad form to store them in a numerically indexed array.


For example, if a user was going to purchase up to 10 items, I see 
nothing wrong is using:


user_purchase[0] = $item0;
...
user_purchase[9] = $item9;

And as such, one can easily extract what the user purchased by simply 
using for().


However, in this case I don't see the gain provided by using:

user_purchase['item1'] = $item0;
...
user_purchase['item9'] = $item9;

But that distinction would be required IF you were using SESSIONs. 
And that's one of my points -- normal arrays come in two types and 
the SESSION array don't.


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread Ashley Sheridan
I tend to prefer assigning all my session variables to an array, which
itself is a member of the $_SESSION array. For example:

$_SESSION[]
Array
(
[myarray] => Array
(
[someitem] => x
[someitem2] => y
[someitem3] => z
)
)


Ash
www.ashleysheridan.co.uk
--- Begin Message ---
On Sat, Aug 16, 2008 at 10:06 AM, Stut <[EMAIL PROTECTED]> wrote:
> I wish I understood the reason why it's like this but I've never looked into
> the session extension in that level of detail, but I doubt such a limitation
> would exist if there was not a very good reason for it. But again, I don't
> see how this is relevant.
>
> It's natural to me to see the session array as a filing cabinet. At the top
> level you would have files with names that indicate what they are. Within
> each file it may be further divided into numbered sections. Given that I
> can't see into the future, even if I currently only have one set of data
> (file) to store in the session (the filing cabinet) I wouldn't just chuck
> the bits of paper from the file into the filing cabinet. I'd leave them in
> the file such that when I need to add a new file I don't need to gather up
> all the other bit of paper into a single file to get it organised again.
>
> Ok, that didn't quite make it as clear as I wanted it to but I hope it
> illustrates the point I'm trying to make. The root level of the session
> array (IMHO) should contain descriptive keys, and I've never been in a
> situation where 5318008 is descriptive and gives context to the data unless
> you turn it upside down!
>
> -Stut
>
> --
> http://stut.net/

Just to add on a thought...  The session extension is a global
variable.  We should make sure our applications play nicely with any
other piece of code.  We do this by prefixing our functions and
classes with something to fake namespaces.  The same ideas carry over
to any other global construct.  So at the very least if I am using the
session class I will have $_SESSION['appname'] as my base.  Same goes
for $GLOBALS, etc.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] SESSION problem

2008-08-16 Thread Eric Butera
On Sat, Aug 16, 2008 at 10:06 AM, Stut <[EMAIL PROTECTED]> wrote:
> I wish I understood the reason why it's like this but I've never looked into
> the session extension in that level of detail, but I doubt such a limitation
> would exist if there was not a very good reason for it. But again, I don't
> see how this is relevant.
>
> It's natural to me to see the session array as a filing cabinet. At the top
> level you would have files with names that indicate what they are. Within
> each file it may be further divided into numbered sections. Given that I
> can't see into the future, even if I currently only have one set of data
> (file) to store in the session (the filing cabinet) I wouldn't just chuck
> the bits of paper from the file into the filing cabinet. I'd leave them in
> the file such that when I need to add a new file I don't need to gather up
> all the other bit of paper into a single file to get it organised again.
>
> Ok, that didn't quite make it as clear as I wanted it to but I hope it
> illustrates the point I'm trying to make. The root level of the session
> array (IMHO) should contain descriptive keys, and I've never been in a
> situation where 5318008 is descriptive and gives context to the data unless
> you turn it upside down!
>
> -Stut
>
> --
> http://stut.net/

Just to add on a thought...  The session extension is a global
variable.  We should make sure our applications play nicely with any
other piece of code.  We do this by prefixing our functions and
classes with something to fake namespaces.  The same ideas carry over
to any other global construct.  So at the very least if I am using the
session class I will have $_SESSION['appname'] as my base.  Same goes
for $GLOBALS, etc.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread Stut

On 16 Aug 2008, at 14:46, tedd wrote:

At 2:11 PM +0100 8/16/08, Stut wrote:
Ahh, I see the problem. You've never been able to use numbers as  
keys at the root level of the $_SESSION array. It's not a bug, it's  
just the way it is. I've just checked the documentation and can't  
find an obvious reference to this limitation which is kinda annoying.


I agree.

But what I find even more annoying is:

1) No error is generated.

2) The error prohibits ALL other SESSION variables legally declared  
after the error to stop working!


In other words, if you make the mistake of using a numeric index for  
a SESSION, then ALL legal SESSIONs declared after that will stop  
working. And, what makes this even more frustrating is that ALL  
SESSIONs declared before will continue to work. IMO, it would be  
better if once you screwed it up, then everything would stop working.


So, let's say this happens (as it did to me last year), you have a  
set of scripts that work fine and in one script you use a numeric  
index for a SESSION. Once that statement is encountered in the flow  
of the program, ALL other SESSION variables declared after that  
don't work anymore.


In one sequence of scripts everything worked fine and in a different  
sequence only some things work. That was maddening and I never knew  
what it was until now. And, no mention of this problem in the  
documentation.


This should give you a bit more ammunition for your "I never use  
SESSIONs for anything" argument.


Not really, since I would never name a session variable 1, or 2, or  
5318008 - I would always put those in the session in a named array.



--- you further stated


I would question why you would want to do such a thing.


You have never moved data between arrays?!? Come on, I'm sure you  
have done it before.


It's an old habit I have filling arrays -- I never had any problems  
using numbers before.


This works:

for ($i; $i<10; $i++)
  {
  $things[$i] = $other_things[$i];
  }

I was looking at SESSION the same way -- after all it IS called an  
array.


Let me play the age-card -- in every language I've programmed in for  
the last 43 years an array can have numeric indexes -- except php's  
SESSION.


I wish I understood the reason why it's like this but I've never  
looked into the session extension in that level of detail, but I doubt  
such a limitation would exist if there was not a very good reason for  
it. But again, I don't see how this is relevant.


It's natural to me to see the session array as a filing cabinet. At  
the top level you would have files with names that indicate what they  
are. Within each file it may be further divided into numbered  
sections. Given that I can't see into the future, even if I currently  
only have one set of data (file) to store in the session (the filing  
cabinet) I wouldn't just chuck the bits of paper from the file into  
the filing cabinet. I'd leave them in the file such that when I need  
to add a new file I don't need to gather up all the other bit of paper  
into a single file to get it organised again.


Ok, that didn't quite make it as clear as I wanted it to but I hope it  
illustrates the point I'm trying to make. The root level of the  
session array (IMHO) should contain descriptive keys, and I've never  
been in a situation where 5318008 is descriptive and gives context to  
the data unless you turn it upside down!


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread tedd

At 2:45 PM +0200 8/16/08, Sabine Richter wrote:
Yes, our mails overlaped each other (Do you say that in english? My 
english is not the best.)


Sabine:

Your English is fine -- much better than my de for certain.

By the way: I tried your initial code and I had no problem with the 
variable declared after the numeric ones. (your $_SESSION['test']). 
I tried on a Version 5.2.5 an Win XP.


That's interesting.

Let's make sure we're talking about the same thing here.

This is the demo:

http://www.webbytedd.com/b2/session-test1/index.php

In my browser Step 1 shows:

SESSION[20] => good morning
SESSION[test2] => good night

In Step 2:

Neither are there.

Is that what you see?

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread tedd

At 2:11 PM +0100 8/16/08, Stut wrote:
Ahh, I see the problem. You've never been able to use numbers as 
keys at the root level of the $_SESSION array. It's not a bug, it's 
just the way it is. I've just checked the documentation and can't 
find an obvious reference to this limitation which is kinda annoying.


I agree.

But what I find even more annoying is:

1) No error is generated.

2) The error prohibits ALL other SESSION variables legally declared 
after the error to stop working!


In other words, if you make the mistake of using a numeric index for 
a SESSION, then ALL legal SESSIONs declared after that will stop 
working. And, what makes this even more frustrating is that ALL 
SESSIONs declared before will continue to work. IMO, it would be 
better if once you screwed it up, then everything would stop working.


So, let's say this happens (as it did to me last year), you have a 
set of scripts that work fine and in one script you use a numeric 
index for a SESSION. Once that statement is encountered in the flow 
of the program, ALL other SESSION variables declared after that don't 
work anymore.


In one sequence of scripts everything worked fine and in a different 
sequence only some things work. That was maddening and I never knew 
what it was until now. And, no mention of this problem in the 
documentation.


This should give you a bit more ammunition for your "I never use 
SESSIONs for anything" argument.


--- you further stated


I would question why you would want to do such a thing.


You have never moved data between arrays?!? Come on, I'm sure you 
have done it before.


It's an old habit I have filling arrays -- I never had any problems 
using numbers before.


This works:

for ($i; $i<10; $i++)
   {
   $things[$i] = $other_things[$i];
   }

I was looking at SESSION the same way -- after all it IS called an array.

Let me play the age-card -- in every language I've programmed in for 
the last 43 years an array can have numeric indexes -- except php's 
SESSION.


Thanks for your comments.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread Stut

On 16 Aug 2008, at 13:20, tedd wrote:

At 12:40 PM +0100 8/16/08, Stut wrote:

On 16 Aug 2008, at 12:36, tedd wrote:
The problem here is can I use a variable within a $_SESSION[]  
declaration?


Like so:

$_SESSION[$var]


I haven't really been following this thread but using a variable  
like that is perfectly valid. $_SESSION is no different to any  
other array during the processing of your script, the only  
difference is that it's stored between requests.


-Stut


Stut:

I was hoping you would join in. But I solved the problem and found a  
surprising result.


The result is you cannot use a number as an index in a $_SESSION,  
like so:


$a = "20";
$_SESSION[$a] = "good morning';   <-- won't work

But you can use:

$a = "a20';
$_SESSION[$a] = "good night';   <-- will work

Furthermore, if you do make that mistake, all other $_SESSION  
variables declared AFTER the incident will cease to work. Isn't that  
interesting?


Here's an example:

http://www.webbytedd.com/b2/session-test1/index.php

The code is at the bottom of the page.

Please tell me that you didn't know this, for if you do, it will  
make my day. On the other hand, if you tell me where I it wrong, it  
will still make my day. :-)


Ahh, I see the problem. You've never been able to use numbers as keys  
at the root level of the $_SESSION array. It's not a bug, it's just  
the way it is. I've just checked the documentation and can't find an  
obvious reference to this limitation which is kinda annoying.


I would question why you would want to do such a thing. Whenever I use  
sessions (which is rare these days) I tend to organise the data with  
some sort of context, which generally doesn't end up using pure numbers.


If you really want to use numeric indices in your session array you  
can do so by adding a second level, i.e. $_SESSION['vars'] = array(20  
=> 'good night');


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread Sabine Richter

Hello Tedd,

tedd schrieb:

At 2:09 PM +0200 8/16/08, Sabine Richter wrote:

Hello Tedd,

it seems to be a naming problem. You may not use a numeric value for a 
variable name to store in $_SESSION.


By assigning it to $_SESSION, you get a
Notice: Unknown: Skipping numeric key 1 in Unknown on line 0

and in your second script a
Notice: Undefined offset: 1 in yourpath\index1.php on line XX -> 
whatever line it was in your script


If you define
$_SESSION['var'.$i] = $i;
or $_SESSION[$i.'var'] = $i;
or even $_SESSION[$i.'.1'] = $i;
the $_SESSION won't forget your vars on the way to script 2.

But it's a bit strange, that you can use your numeric keys in script 1.

I tried with other Superglobals like $_POST and $_COOKIE and they seem 
to accept numeric variable names.


So, is that a php bug?
But as the docu says "A valid variable name starts with a letter or 
underscore", I think you can not complain about it.


Cheers
Sabine


Sabine:

You hit the nail right on the head.

I discovered that fact this morning and posted an answer already. Here's 
the demo:


http://www.webbytedd.com/b2/session-test1/index.php


Yes, our mails overlaped each other (Do you say that in english? My 
english is not the best.)


I read everything I could find about sessions, but didn't come across:

"A valid variable name starts with a letter or underscore"

To the contrary, this is only what I found:

Variable names follow the same rules as other labels in PHP. A valid 
variable name starts with a letter or underscore, followed by any number 
of letters, numbers, or underscores


Where did you see that?


My citation is just a part of what you found.

By the way: I tried your initial code and I had no problem with the 
variable declared after the numeric ones. (your $_SESSION['test']). I 
tried on a Version 5.2.5 an Win XP.


Cheers,
Sabine



Cheers,

tedd



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread tedd

At 2:09 PM +0200 8/16/08, Sabine Richter wrote:

Hello Tedd,

it seems to be a naming problem. You may not use a numeric value for 
a variable name to store in $_SESSION.


By assigning it to $_SESSION, you get a
Notice: Unknown: Skipping numeric key 1 in Unknown on line 0

and in your second script a
Notice: Undefined offset: 1 in yourpath\index1.php on line XX -> 
whatever line it was in your script


If you define
$_SESSION['var'.$i] = $i;
or $_SESSION[$i.'var'] = $i;
or even $_SESSION[$i.'.1'] = $i;
the $_SESSION won't forget your vars on the way to script 2.

But it's a bit strange, that you can use your numeric keys in script 1.

I tried with other Superglobals like $_POST and $_COOKIE and they 
seem to accept numeric variable names.


So, is that a php bug?
But as the docu says "A valid variable name starts with a letter or 
underscore", I think you can not complain about it.


Cheers
Sabine


Sabine:

You hit the nail right on the head.

I discovered that fact this morning and posted an answer already. 
Here's the demo:


http://www.webbytedd.com/b2/session-test1/index.php

I read everything I could find about sessions, but didn't come across:

"A valid variable name starts with a letter or underscore"

To the contrary, this is only what I found:

Variable names follow the same rules as other labels in PHP. A valid 
variable name starts with a letter or underscore, followed by any 
number of letters, numbers, or underscores


Where did you see that?

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread tedd

At 12:40 PM +0100 8/16/08, Stut wrote:

On 16 Aug 2008, at 12:36, tedd wrote:

The problem here is can I use a variable within a $_SESSION[] declaration?

Like so:

$_SESSION[$var]


I haven't really been following this thread but using a variable 
like that is perfectly valid. $_SESSION is no different to any other 
array during the processing of your script, the only difference is 
that it's stored between requests.


-Stut


Stut:

I was hoping you would join in. But I solved the problem and found a 
surprising result.


The result is you cannot use a number as an index in a $_SESSION, like so:

$a = "20";
$_SESSION[$a] = "good morning';   <-- won't work

But you can use:

$a = "a20';
$_SESSION[$a] = "good night';   <-- will work

Furthermore, if you do make that mistake, all other $_SESSION 
variables declared AFTER the incident will cease to work. Isn't that 
interesting?


Here's an example:

http://www.webbytedd.com/b2/session-test1/index.php

The code is at the bottom of the page.

Please tell me that you didn't know this, for if you do, it will make 
my day. On the other hand, if you tell me where I it wrong, it will 
still make my day. :-)


Always a pleasure listening to your thoughts and advice.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread Sabine Richter

Hello Tedd,

it seems to be a naming problem. You may not use a numeric value for a 
variable name to store in $_SESSION.


By assigning it to $_SESSION, you get a
Notice: Unknown: Skipping numeric key 1 in Unknown on line 0

and in your second script a
Notice: Undefined offset: 1 in yourpath\index1.php on line XX -> 
whatever line it was in your script


If you define
$_SESSION['var'.$i] = $i;
or $_SESSION[$i.'var'] = $i;
or even $_SESSION[$i.'.1'] = $i;
the $_SESSION won't forget your vars on the way to script 2.

But it's a bit strange, that you can use your numeric keys in script 1.

I tried with other Superglobals like $_POST and $_COOKIE and they seem 
to accept numeric variable names.


So, is that a php bug?
But as the docu says "A valid variable name starts with a letter or 
underscore", I think you can not complain about it.


Cheers
Sabine












tedd schrieb:

Hi gang:

Arrggg -- what the heck is going on?

I can't get anything to pass via SESSION -- what's wrong?

Here's the example -- (all the code is there):

I populate the $_SESSIONs here.

http://www.webbytedd.com/b2/session-test/index.php

If you click "Proceed to Step 2", you'll see that nothing is passed.

Now, where did I go wrong?

Cheers,

tedd

PS: I've tried this on two different servers and get the same results.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread Ashley Sheridan
session_start() doesn't have to be the first line in the code, but it
does have to occur before ANY content sent to the browser, and this
includes any headers as well. Generally speaking, it does no harm to
have it as the first line of your PHP code


Ash
www.ashleysheridan.co.uk
--- Begin Message ---

At 8:02 PM -0700 8/15/08, VamVan wrote:

Tedd,

I think according to PHP manual. Session_start() must be the first 
line in the code. Dont worry it will remember your session until you 
close the browser and also it wont duplicate it.


VamVan:

Yes, I thought that as well and practiced it for years, but that's 
not true -- read the manual.


In any event, that's not the problem here.

The problem here is can I use a variable within a $_SESSION[] declaration?

Like so:

$_SESSION[$var]

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] SESSION problem

2008-08-16 Thread Stut

On 16 Aug 2008, at 12:36, tedd wrote:

At 8:02 PM -0700 8/15/08, VamVan wrote:

Tedd,

I think according to PHP manual. Session_start() must be the first  
line in the code. Dont worry it will remember your session until  
you close the browser and also it wont duplicate it.


VamVan:

Yes, I thought that as well and practiced it for years, but that's  
not true -- read the manual.


In any event, that's not the problem here.

The problem here is can I use a variable within a $_SESSION[]  
declaration?


Like so:

$_SESSION[$var]


I haven't really been following this thread but using a variable like  
that is perfectly valid. $_SESSION is no different to any other array  
during the processing of your script, the only difference is that it's  
stored between requests.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-16 Thread tedd

At 8:02 PM -0700 8/15/08, VamVan wrote:

Tedd,

I think according to PHP manual. Session_start() must be the first 
line in the code. Dont worry it will remember your session until you 
close the browser and also it wont duplicate it.


VamVan:

Yes, I thought that as well and practiced it for years, but that's 
not true -- read the manual.


In any event, that's not the problem here.

The problem here is can I use a variable within a $_SESSION[] declaration?

Like so:

$_SESSION[$var]

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-15 Thread VamVan
Tedd,

I think according to PHP manual. Session_start() must be the first line in
the code. Dont worry it will remember your session until you close the
browser and also it wont duplicate it.

Thanks

On Fri, Aug 15, 2008 at 4:39 PM, tedd <[EMAIL PROTECTED]> wrote:

> At 1:47 PM -0500 8/15/08, Boyd, Todd M. wrote:
>
>> Have you tried:
>>
>>echo SID;
>>
>> ...? I'm wondering if you're going to get different values on the two
>> pages. What that means beyond two different sessions is beyond me, but
>> it's a start.
>>
>>
>> Todd Boyd
>> Web Programmer
>>
>
> Todd:
>
> I added code to show the SID and it's the same, but still nothing happens.
>
> http://www.webbytedd.com/b2/session-test/index.php
>
> I know what the problem is, but don't know how to fix it.
>
> If you will look at the code, I am using a variable within the SESSION
> declaration:
>
> $_SESSION[$i] = $i;
>
> If I comment that out, the $_SESSION['test'] will be passed.
>
> Thanks,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


RE: [PHP] SESSION problem

2008-08-15 Thread tedd

At 1:47 PM -0500 8/15/08, Boyd, Todd M. wrote:

Have you tried:

echo SID;

...? I'm wondering if you're going to get different values on the two
pages. What that means beyond two different sessions is beyond me, but
it's a start.


Todd Boyd
Web Programmer


Todd:

I added code to show the SID and it's the same, but still nothing happens.

http://www.webbytedd.com/b2/session-test/index.php

I know what the problem is, but don't know how to fix it.

If you will look at the code, I am using a variable within the 
SESSION declaration:


$_SESSION[$i] = $i;

If I comment that out, the $_SESSION['test'] will be passed.

Thanks,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] SESSION problem

2008-08-15 Thread Boyd, Todd M.
> -Original Message-
> From: tedd [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2008 12:10 PM
> To: php-general@lists.php.net
> Subject: [PHP] SESSION problem
> 
> Hi gang:
> 
> Arrggg -- what the heck is going on?
> 
> I can't get anything to pass via SESSION -- what's wrong?
> 
> Here's the example -- (all the code is there):
> 
> I populate the $_SESSIONs here.
> 
> http://www.webbytedd.com/b2/session-test/index.php
> 
> If you click "Proceed to Step 2", you'll see that nothing is passed.
> 
> Now, where did I go wrong?
> 
> Cheers,
> 
> tedd
> 
> PS: I've tried this on two different servers and get the same results.

Have you tried:

echo SID;

...? I'm wondering if you're going to get different values on the two
pages. What that means beyond two different sessions is beyond me, but
it's a start.


Todd Boyd
Web Programmer




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-15 Thread Philip Thompson

On Aug 15, 2008, at 12:16 PM, Dan Joseph wrote:


On Fri, Aug 15, 2008 at 1:09 PM, tedd <[EMAIL PROTECTED]> wrote:


Hi gang:

Arrggg -- what the heck is going on?

I can't get anything to pass via SESSION -- what's wrong?

Here's the example -- (all the code is there):

I populate the $_SESSIONs here.

http://www.webbytedd.com/b2/session-test/index.php

If you click "Proceed to Step 2", you'll see that nothing is passed.

Now, where did I go wrong?

Cheers,

tedd

PS: I've tried this on two different servers and get the same  
results.




What's in your header.php?


It probably won't make a difference, but you may try:

");
}
?>

Throw the $_SESSION into {}.

~Philip

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SESSION problem

2008-08-15 Thread Dan Joseph
On Fri, Aug 15, 2008 at 1:09 PM, tedd <[EMAIL PROTECTED]> wrote:

> Hi gang:
>
> Arrggg -- what the heck is going on?
>
> I can't get anything to pass via SESSION -- what's wrong?
>
> Here's the example -- (all the code is there):
>
> I populate the $_SESSIONs here.
>
> http://www.webbytedd.com/b2/session-test/index.php
>
> If you click "Proceed to Step 2", you'll see that nothing is passed.
>
> Now, where did I go wrong?
>
> Cheers,
>
> tedd
>
> PS: I've tried this on two different servers and get the same results.
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
What's in your header.php?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."


[PHP] SESSION problem

2008-08-15 Thread tedd

Hi gang:

Arrggg -- what the heck is going on?

I can't get anything to pass via SESSION -- what's wrong?

Here's the example -- (all the code is there):

I populate the $_SESSIONs here.

http://www.webbytedd.com/b2/session-test/index.php

If you click "Proceed to Step 2", you'll see that nothing is passed.

Now, where did I go wrong?

Cheers,

tedd

PS: I've tried this on two different servers and get the same results.

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Session problem

2007-11-21 Thread Andrés Robinet
By the way... I remember there were to ways of installing PHP over IIS. One
was adding it for ALL websites and the other way was adding it on a site by
site basis. I'd recommend doing the second method.
Notice that this has nothing to do with ISAPI vs CGI, it is just an option
in IIS settings (again, I've not seen a Windows 2003 Server since about two
years ago, so I don't remember where or how this was accomplished).

Rob
(excuse me for top posting, but this is just a side note)

> -Original Message-
> From: Andrés Robinet [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 21, 2007 5:51 PM
> To: php-general@lists.php.net
> Subject: RE: [PHP] Session problem
> 
> > -Original Message-
> > From: Philip Thompson [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, November 21, 2007 4:43 PM
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] Session problem
> >
> > On Nov 21, 2007 11:08 AM, Mathieu Dumoulin <[EMAIL PROTECTED]
> cdgi.com>
> > wrote:
> >
> > > I got a strange problem here, here are the setup details first as
> > this
> > > seems
> > > to be a server problem more than a php problem but it is still
> > related to
> > > php configuration:
> > >
> > > Server: Win2003 (latest)
> > > WebServer: IIS6 (latest)
> > > PHP: php5.2.2.1
> > > MySQL: mysql.5
> > >
> > > Sites installed in server that may have influence:
> > >
> > > www.palliscience.com
> > > dev.palliscience.com
> > > maj.palliscience.com
> > > dev2.palliscience.com
> > >
> > > (All sites are installed using php5_ISAPI.dll)
> > >
> > > Problem:
> > >
> > > When i try to start a session in maj.palliscience.com (Same code as
> > > everywhere else except the content may differ), the server hangs. I
> > tried
> > > for two days to find and make sure where this server hang was
> coming
> > from
> > > and eventually came to the solid conclusion that my server hang on
> > > session_start. I tried to add different commands such as
> > > session_write_close
> > > at end of my scripts and checked that my sessions where not already
> > open
> > > by
> > > using session_id.
> > >
> > > The only way i was able to make my sessions work in
> > maj.palliscience.comis
> > > using the CGI version of PHP, but hell this is causing me problems
> i
> > never
> > > thought it would. I'm having problems with headers, and also the
> > $_SERVER
> > > variable is deadly different.
> > >
> > > So my question is simple, what could cause this problem.
> >
> >
> > Windoze and IIS. =/
> >
> >
> > > Could it be a clash in the filenames for the session files?
> >
> >
> > Yes, AFAIK, the session names will clash. Meaning, for each DNS
> > (subdomain,
> > whatever it is), use a different prefix to avoid clashes:
> >
> > $_SESSION['www'][...]
> > $_SESSION['dev'][...]
> > $_SESSION['maj']...]
> > etc.
> >
> > Obviously if some are in production, this is not a trivial change.
> >
> >
> >
> > > I tried reading a bit the php.ini
> > > and saw there is a way to split the session files in different
> > folders but
> > > i
> > > don't have the expertise nor the famous script the php.ini is
> talking
> > > about
> > > in the session section to fix or alter this info correctly. (I
> can't
> > start
> > > tweaking this, there are other sites on the machine that are in
> > production
> > > mode so i need a final configuration that will work on the first
> try)
> > >
> > > Keep in mind:
> > >
> > > 1) I got 3 other sites that sport the same code, only slightly
> > different
> > > content
> > > 2) All the sessions in the other sites work marvelously in ISAPI
> > > 3) Only maj is affected, i tried copying the code to
> > dev2.palliscience.com
> > > ,
> > > problem doesn't show.
> > > 4) I can definitely say my sessions are problematic, i comment out
> > any
> > > session_start, and the problem nevers shows
> >
> >
> > This is a stab in the dark, but maybe the problem is not with
> > session_start.
> > Maybe session_start uses/calls something else which has a negative
> > impact on
> > your system. So you may be addressing the issue, but from the
> wrong
> &

RE: [PHP] Session problem

2007-11-21 Thread Andrés Robinet
> -Original Message-
> From: Philip Thompson [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 21, 2007 4:43 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Session problem
> 
> On Nov 21, 2007 11:08 AM, Mathieu Dumoulin <[EMAIL PROTECTED]>
> wrote:
> 
> > I got a strange problem here, here are the setup details first as
> this
> > seems
> > to be a server problem more than a php problem but it is still
> related to
> > php configuration:
> >
> > Server: Win2003 (latest)
> > WebServer: IIS6 (latest)
> > PHP: php5.2.2.1
> > MySQL: mysql.5
> >
> > Sites installed in server that may have influence:
> >
> > www.palliscience.com
> > dev.palliscience.com
> > maj.palliscience.com
> > dev2.palliscience.com
> >
> > (All sites are installed using php5_ISAPI.dll)
> >
> > Problem:
> >
> > When i try to start a session in maj.palliscience.com (Same code as
> > everywhere else except the content may differ), the server hangs. I
> tried
> > for two days to find and make sure where this server hang was coming
> from
> > and eventually came to the solid conclusion that my server hang on
> > session_start. I tried to add different commands such as
> > session_write_close
> > at end of my scripts and checked that my sessions where not already
> open
> > by
> > using session_id.
> >
> > The only way i was able to make my sessions work in
> maj.palliscience.comis
> > using the CGI version of PHP, but hell this is causing me problems i
> never
> > thought it would. I'm having problems with headers, and also the
> $_SERVER
> > variable is deadly different.
> >
> > So my question is simple, what could cause this problem.
> 
> 
> Windoze and IIS. =/
> 
> 
> > Could it be a clash in the filenames for the session files?
> 
> 
> Yes, AFAIK, the session names will clash. Meaning, for each DNS
> (subdomain,
> whatever it is), use a different prefix to avoid clashes:
> 
> $_SESSION['www'][...]
> $_SESSION['dev'][...]
> $_SESSION['maj']...]
> etc.
> 
> Obviously if some are in production, this is not a trivial change.
> 
> 
> 
> > I tried reading a bit the php.ini
> > and saw there is a way to split the session files in different
> folders but
> > i
> > don't have the expertise nor the famous script the php.ini is talking
> > about
> > in the session section to fix or alter this info correctly. (I can't
> start
> > tweaking this, there are other sites on the machine that are in
> production
> > mode so i need a final configuration that will work on the first try)
> >
> > Keep in mind:
> >
> > 1) I got 3 other sites that sport the same code, only slightly
> different
> > content
> > 2) All the sessions in the other sites work marvelously in ISAPI
> > 3) Only maj is affected, i tried copying the code to
> dev2.palliscience.com
> > ,
> > problem doesn't show.
> > 4) I can definitely say my sessions are problematic, i comment out
> any
> > session_start, and the problem nevers shows
> 
> 
> This is a stab in the dark, but maybe the problem is not with
> session_start.
> Maybe session_start uses/calls something else which has a negative
> impact on
> your system. So you may be addressing the issue, but from the wrong
> angle??
> 
> 
> 
> > Thanks
> >
> > Mathieu Dumoulin
> 
> 
> 
> Well, I gave you a lot of useless information, but hopefully it sparks
> a
> fire! =D Good Luck.
> 
> ~Philip

I don't think there's a name clash in session file names... session
identification is based on a browser cookie if I remember well PHPSESSIONID,
and so are file names which (again, if my memory is right) are called
"sess_" where  is the aforementioned cookie.
Cookies are different for different (sub)domains... so, the browser won't
send the session cookie for "www.domain.com" to "dev.domain.com"... meaning
both subdomains should get different session ids and session files (which
cannot clash because the session id is generated randomly using an MD5 hash,
right?).
I would say the problem is at some point in the IIS-PHP communication. Maybe
the browser is sending the session ID to the server, the server gets the
session id, and when you use "session_start" it tries to grab the file which
is locked (for some extrange and unknown windows reason as usual) and then
it hangs waiting for the file to be available.

I don't know if this will be of any help for you, but I'd locate the ses

Re: [PHP] Session problem

2007-11-21 Thread Philip Thompson
On Nov 21, 2007 11:08 AM, Mathieu Dumoulin <[EMAIL PROTECTED]>
wrote:

> I got a strange problem here, here are the setup details first as this
> seems
> to be a server problem more than a php problem but it is still related to
> php configuration:
>
> Server: Win2003 (latest)
> WebServer: IIS6 (latest)
> PHP: php5.2.2.1
> MySQL: mysql.5
>
> Sites installed in server that may have influence:
>
> www.palliscience.com
> dev.palliscience.com
> maj.palliscience.com
> dev2.palliscience.com
>
> (All sites are installed using php5_ISAPI.dll)
>
> Problem:
>
> When i try to start a session in maj.palliscience.com (Same code as
> everywhere else except the content may differ), the server hangs. I tried
> for two days to find and make sure where this server hang was coming from
> and eventually came to the solid conclusion that my server hang on
> session_start. I tried to add different commands such as
> session_write_close
> at end of my scripts and checked that my sessions where not already open
> by
> using session_id.
>
> The only way i was able to make my sessions work in maj.palliscience.comis
> using the CGI version of PHP, but hell this is causing me problems i never
> thought it would. I'm having problems with headers, and also the $_SERVER
> variable is deadly different.
>
> So my question is simple, what could cause this problem.


Windoze and IIS. =/


> Could it be a clash in the filenames for the session files?


Yes, AFAIK, the session names will clash. Meaning, for each DNS (subdomain,
whatever it is), use a different prefix to avoid clashes:

$_SESSION['www'][...]
$_SESSION['dev'][...]
$_SESSION['maj']...]
etc.

Obviously if some are in production, this is not a trivial change.



> I tried reading a bit the php.ini
> and saw there is a way to split the session files in different folders but
> i
> don't have the expertise nor the famous script the php.ini is talking
> about
> in the session section to fix or alter this info correctly. (I can't start
> tweaking this, there are other sites on the machine that are in production
> mode so i need a final configuration that will work on the first try)
>
> Keep in mind:
>
> 1) I got 3 other sites that sport the same code, only slightly different
> content
> 2) All the sessions in the other sites work marvelously in ISAPI
> 3) Only maj is affected, i tried copying the code to dev2.palliscience.com
> ,
> problem doesn't show.
> 4) I can definitely say my sessions are problematic, i comment out any
> session_start, and the problem nevers shows


This is a stab in the dark, but maybe the problem is not with session_start.
Maybe session_start uses/calls something else which has a negative impact on
your system. So you may be addressing the issue, but from the wrong
angle??



> Thanks
>
> Mathieu Dumoulin



Well, I gave you a lot of useless information, but hopefully it sparks a
fire! =D Good Luck.

~Philip


[PHP] Session problem

2007-11-21 Thread Mathieu Dumoulin
I got a strange problem here, here are the setup details first as this seems 
to be a server problem more than a php problem but it is still related to 
php configuration:

Server: Win2003 (latest)
WebServer: IIS6 (latest)
PHP: php5.2.2.1
MySQL: mysql.5

Sites installed in server that may have influence:

www.palliscience.com
dev.palliscience.com
maj.palliscience.com
dev2.palliscience.com

(All sites are installed using php5_ISAPI.dll)

Problem:

When i try to start a session in maj.palliscience.com (Same code as 
everywhere else except the content may differ), the server hangs. I tried 
for two days to find and make sure where this server hang was coming from 
and eventually came to the solid conclusion that my server hang on 
session_start. I tried to add different commands such as session_write_close 
at end of my scripts and checked that my sessions where not already open by 
using session_id.

The only way i was able to make my sessions work in maj.palliscience.com is 
using the CGI version of PHP, but hell this is causing me problems i never 
thought it would. I'm having problems with headers, and also the $_SERVER 
variable is deadly different.

So my question is simple, what could cause this problem. Could it be a clash 
in the filenames for the session files? I tried reading a bit the php.ini 
and saw there is a way to split the session files in different folders but i 
don't have the expertise nor the famous script the php.ini is talking about 
in the session section to fix or alter this info correctly. (I can't start 
tweaking this, there are other sites on the machine that are in production 
mode so i need a final configuration that will work on the first try)

Keep in mind:

1) I got 3 other sites that sport the same code, only slightly different 
content
2) All the sessions in the other sites work marvelously in ISAPI
3) Only maj is affected, i tried copying the code to dev2.palliscience.com, 
problem doesn't show.
4) I can definitely say my sessions are problematic, i comment out any 
session_start, and the problem nevers shows

Thanks

Mathieu Dumoulin 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem on PHP/Debian

2007-11-12 Thread Riviere Guillaume
Dear all,

 

I have a  problem with my PHP session on Debian Etch:

When PHP create a session file sess_XXX it create this file without
right:

 

~# ls -l /var/lib/php5/session/sess_* | more

-- 1 www-data www-data   0 2007-11-13 06:49
/var/lib/php5/session/sess_0001b27b2df59844e4719476b1dd192c

-- 1 www-data www-data   0 2007-11-13 07:28
/var/lib/php5/session/sess_00f5b9449e2e7d16dadddca59e4c12b8

-- 1 www-data www-data   23 2007-11-13 08:09
/var/lib/php5/session/sess_00f800967047af7e1cb6cccee6e37087

etc ...

 

So PHP cannot verify my session (erro 13, access denied) and it create a
lot of session files (686 at my last check). I'm on Debian Stable with
PHP 5.2.0 and apache 2

 

An idea how to solve this problem ?

 

Guillaume



Re: [PHP] Session problem

2007-09-30 Thread Jim Lucas

Dušan Novaković wrote:

Does no one have some solution or suggestion?

Dušan


On 9/29/07, Dušan Novaković <[EMAIL PROTECTED]> wrote:

Hm..

I don't know that. I have also another application on the same server,
and I haven't encountered problems of the same kind. I don't know
whether these problems don't happend at all on this other application,
or I just haven't come across one. :-(

Dušan


On 9/28/07, Jim Lucas <[EMAIL PROTECTED]> wrote:

Dušan Novaković wrote:

Hi,

I have two problems with sessions.

Firstly, even though session limit is set on default value on server,
which is about 5 hours, if I don't take any action for about 15 mins I
am thrown out and I have to log in again. Are there any addition
functions which I can use in order to explicitly specify session
lifetime?

Secondly, after a certain period of time, while I am logged in, page
just freezes and it indicates that it is trying to load. Page stays
frozen all the time. At that moment, the only solution is to clear
private data in the browser. After that, I am logged out and I can
regulary log in and procede to work normally. It doesn't happend evry
time I log in, but once in while.

I have only used functions such as session_start()  and session_destroy.

Thanks for your help,
Dušan

- -
made by Dusan

sounds like a problem with the hosting provider.

Is this a single server that you have your web site on, or is it a farm of 
servers?

--
Jim Lucas

"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
 by William Shakespeare




--
made by Dusan






I would have the host then double check the config.  Make sure the 
location where the session files are being written to is writable by the 
php user.


Have them compare the two configs between the different sites.  See if 
anything besides the document root is different.


Or, upgrade to a dedicated host and run the web server your self.

--
Jim Lucas


"Perseverance is not a long race;
it is many short races one after the other"

Walter Elliot



"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session problem

2007-09-30 Thread Dušan Novaković
Does no one have some solution or suggestion?

Dušan


On 9/29/07, Dušan Novaković <[EMAIL PROTECTED]> wrote:
> Hm..
>
> I don't know that. I have also another application on the same server,
> and I haven't encountered problems of the same kind. I don't know
> whether these problems don't happend at all on this other application,
> or I just haven't come across one. :-(
>
> Dušan
>
>
> On 9/28/07, Jim Lucas <[EMAIL PROTECTED]> wrote:
> > Dušan Novaković wrote:
> > > Hi,
> > >
> > > I have two problems with sessions.
> > >
> > > Firstly, even though session limit is set on default value on server,
> > > which is about 5 hours, if I don't take any action for about 15 mins I
> > > am thrown out and I have to log in again. Are there any addition
> > > functions which I can use in order to explicitly specify session
> > > lifetime?
> > >
> > > Secondly, after a certain period of time, while I am logged in, page
> > > just freezes and it indicates that it is trying to load. Page stays
> > > frozen all the time. At that moment, the only solution is to clear
> > > private data in the browser. After that, I am logged out and I can
> > > regulary log in and procede to work normally. It doesn't happend evry
> > > time I log in, but once in while.
> > >
> > > I have only used functions such as session_start()  and session_destroy.
> > >
> > > Thanks for your help,
> > > Dušan
> > >
> > > - -
> > > made by Dusan
> >
> > sounds like a problem with the hosting provider.
> >
> > Is this a single server that you have your web site on, or is it a farm of 
> > servers?
> >
> > --
> > Jim Lucas
> >
> > "Some men are born to greatness, some achieve greatness,
> > and some have greatness thrust upon them."
> >
> > Twelfth Night, Act II, Scene V
> >  by William Shakespeare
> >
> >
>
>
> --
> made by Dusan
>


-- 
made by Dusan


Re: [PHP] Session problem

2007-09-28 Thread Jim Lucas

Dušan Novaković wrote:

Hi,

I have two problems with sessions.

Firstly, even though session limit is set on default value on server,
which is about 5 hours, if I don't take any action for about 15 mins I
am thrown out and I have to log in again. Are there any addition
functions which I can use in order to explicitly specify session
lifetime?

Secondly, after a certain period of time, while I am logged in, page
just freezes and it indicates that it is trying to load. Page stays
frozen all the time. At that moment, the only solution is to clear
private data in the browser. After that, I am logged out and I can
regulary log in and procede to work normally. It doesn't happend evry
time I log in, but once in while.

I have only used functions such as session_start()  and session_destroy.

Thanks for your help,
Dušan

- -
made by Dusan


sounds like a problem with the hosting provider.

Is this a single server that you have your web site on, or is it a farm of 
servers?

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem

2007-09-28 Thread Dušan Novaković
Hi,

I have two problems with sessions.

Firstly, even though session limit is set on default value on server,
which is about 5 hours, if I don't take any action for about 15 mins I
am thrown out and I have to log in again. Are there any addition
functions which I can use in order to explicitly specify session
lifetime?

Secondly, after a certain period of time, while I am logged in, page
just freezes and it indicates that it is trying to load. Page stays
frozen all the time. At that moment, the only solution is to clear
private data in the browser. After that, I am logged out and I can
regulary log in and procede to work normally. It doesn't happend evry
time I log in, but once in while.

I have only used functions such as session_start()  and session_destroy.

Thanks for your help,
Dušan

- -
made by Dusan


Re: [PHP] Session Problem

2007-02-20 Thread Fergus Gibson
Brad Bonkoski wrote:
> How do you move from one page to the other?  You have to pass the
> session along, I believe..
> Something like:
> $s = SID; // session contant
> page2.php?$s

You only need to pass the session identifier in the query string if you
aren't using cookies.  By default, sessions will be handled with
cookies, so they work transparently.  I suspect, as others have
suggested, that there is a path/permission problem and the session data
is not getting saved.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Session Problem

2007-02-15 Thread Brad Fuller
> -Original Message-
> From: LoneWolf [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 15, 2007 4:35 PM
> To: php-general@lists.php.net
> Subject: [PHP] Session Problem
> 
> I am having a problem where it appears that the session is not being saved
> properly.
> 
> While on a page, I can start a session and set variables to it. however,
> when I go to the next page.. the session variables appear to have been
> cleared out.

Is there anything unusual about your setup that you failed to mention?
(e.g. using  etc.)

A few things to check:
- Make sure cookies (at least session cookies) are enabled in your browser. 
- Try browsing the site from another computer.
- Make sure session_start() is being called before any HTML output
(including blank lines before the first http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session Problem

2007-02-15 Thread Brad Bonkoski

LoneWolf wrote:
I am having a problem where it appears that the session is not being saved 
properly.


While on a page, I can start a session and set variables to it. however, 
when I go to the next page.. the session variables appear to have been 
cleared out.


first page:
session_start();

$_SESSION["user_level"] = "test";


  
How do you move from one page to the other?  You have to pass the 
session along, I believe..

Something like:
$s = SID; // session contant
page2.php?$s


second page:

session_start();

echo $_SESSION["user_level"] ;



We just installed php on the 2003 server.  Is there maybe a problem with the 
php.ini file that I need to fix?


  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Session Problem

2007-02-15 Thread Alan Fullmer
Does your system have permission to write to the temp directory?

Put on error_reporting(E_ALL) and see if it throws an error. 

-Original Message-
From: LoneWolf [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 15, 2007 2:35 PM
To: php-general@lists.php.net
Subject: [PHP] Session Problem

I am having a problem where it appears that the session is not being saved
properly.

While on a page, I can start a session and set variables to it. however,
when I go to the next page.. the session variables appear to have been
cleared out.

first page:
session_start();

$_SESSION["user_level"] = "test";



second page:

session_start();

echo $_SESSION["user_level"] ;



We just installed php on the 2003 server.  Is there maybe a problem with the
php.ini file that I need to fix?

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session Problem

2007-02-15 Thread LoneWolf
I am having a problem where it appears that the session is not being saved 
properly.

While on a page, I can start a session and set variables to it. however, 
when I go to the next page.. the session variables appear to have been 
cleared out.

first page:
session_start();

$_SESSION["user_level"] = "test";



second page:

session_start();

echo $_SESSION["user_level"] ;



We just installed php on the 2003 server.  Is there maybe a problem with the 
php.ini file that I need to fix?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session problem

2006-06-20 Thread weetat

Hi all,

 I have 2 php page , whenever i click the submit in 1st page , the
 $_SESSION['LIST_OF_DATA'] display nothing in the 2nd page.

 If i do echo print_r($_SESSION['LIST_OF_DATA']) in first page , it 
displayed the data correctly.


Anybody have any ideas why php session behaviour is like that ?

Thanks - weetat

   below is the 1st page :

'Jumping',
 'itemData'  => $arrayoffiles,
 'perPage' => 10,
 'delta' => 8,
 'append' => true,
 'clearIfVoid' => true,
 'useSessions' => true,
 'closeSession' => true,
   );

   $pager = & Pager::factory($params);
   $data  = $pager->getPageData();
   $links = $pager->getLinks();
   $_SESSION['LIST_OF_DATA'] = $data;

   ?>


   below is second page :



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem when upgrading from 4 to 5.

2006-02-28 Thread Matthijs Dijkstra
Hi,

Unfortunately it is not possible (for me) to initialise the 'session.save_path' 
directive in PHP 5. Up to version 4.3.5. there was no problem and the directive 
was set to '/tmp'. After upgrading to 5.0.2. and later to 5.1.2. I did not 
succeed in initialising the directive. 

/usr/local/lib/php/php.ini:
session.save_path = "/tmp"

Configuration history related to the 'session.save_path' directive:
PHP Version 4.0.0/tmpgood
PHP Version 4.3.5/tmpgood
PHP Version 5.0.2no valuewrong
PHP Version 5.1.2no valuewrong
Checked with phpinfo().

I have checked the NEWS file and found two remarks concerning the save_path 
directive:
- Fixed bug #33072 (Add a safemode/open_basedir check for runtime
"session.save_path" change using session_save_path() function). (Rasmus)
- Fixed bug #33520 (crash if safe_mode is on and session.save_path is changed).
(Dmitry)

So my question is: Is it possible to define the directive 'session.save_path' 
in PHP 5 in the php.ini file?

Matthijs Dijkstra

Re: [PHP] Session-problem? Simple counter won't work

2005-08-09 Thread Jochem Maas

Sabine wrote:

Hello to all,

I'm working on a server where even a simple counter-script won't work.

session_start();
if (isset($HTTP_SESSION_VARS['counter'])) {
   $HTTP_SESSION_VARS['counter']++;
} else {
   $HTTP_SESSION_VARS['counter']=1;
}

On every refresh the counter is set to 1.



I take it this is not inside a function? have you tried using var_dump()
to output $HTTP_SESSION_VARS?

you may be stuck with doing things the old session_register() way rather than
using $HTTP_SESSION_VARS (or preferably $_SESSION - if you had a version of php 
at
your disposal that had that.)


I dont' know, where to search for the reasons.
The server is a normal service providers server. My customers site is 
using sessions and they are working on his site.


I would suggest that you go thru his code line by line to figure out
how it works.

also check out this page:
http://php.net/manual/en/function.session-set-cookie-params.php

given that you want your own session on a specific subpath you will have to
do some more owkr than just start the session.


My script lays in a subdirectory of my costumers site, protected with a 
.htaccess.:

The PHP-Version is 4.0.6.


which idiot is setting 4.0.6 as a requirement - its old, has lots of bugs that
have been fixed in more recent versions and is full _known_ security issues
(which have also been fixed) ... upgrade is the sane thing to do.

if there is one other person on this list using 4.0.6 you'll be lucky. all
this means that your going to have a hard time getting things done - bottom line
this costs your customer more (you are passing on the cost right?)


The values for the session-parameters are, as far as I see, standard:
session.save_handler: files
session.save_path: /tmp

Register-globals is set to on.

Has anybody an idea where the problem lays?
Is it possible that I don' have the right to write into the /tmp-directory?


possible but unlikely, given that the main site works. try writing a file to 
/tmp.



It would be very nice of you to give me some tips. I don't want to ask 
my customer silly questions.


your customer is requiring 4.0.6 - nothing you can ask could be sillier than 
that ;-)
(other than maybe asking to downgrade to php3)



Thanks in advance
Sabine



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session-problem? Simple counter won't work

2005-08-09 Thread Sabine

Hello to all,

I'm working on a server where even a simple counter-script won't work.

session_start();
if (isset($HTTP_SESSION_VARS['counter'])) {
   $HTTP_SESSION_VARS['counter']++;
} else {
   $HTTP_SESSION_VARS['counter']=1;
}

On every refresh the counter is set to 1.

I dont' know, where to search for the reasons.
The server is a normal service providers server. My customers site is 
using sessions and they are working on his site.
My script lays in a subdirectory of my costumers site, protected with a 
.htaccess.:

The PHP-Version is 4.0.6.
The values for the session-parameters are, as far as I see, standard:
session.save_handler: files
session.save_path: /tmp

Register-globals is set to on.

Has anybody an idea where the problem lays?
Is it possible that I don' have the right to write into the /tmp-directory?

It would be very nice of you to give me some tips. I don't want to ask 
my customer silly questions.


Thanks in advance
Sabine

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Session problem

2005-03-31 Thread Kim Madsen
Hi

> -Original Message-
> From: Rosen [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 31, 2005 11:31 AM
> To: php-general@lists.php.net
> Subject: [PHP] Session problem
> 
> Hi,
> I have this code :
> 
> 
> page1.php:
>  
> $nfo["fu"]="12";
> 
> session_start();
> session_register(nfo);

For good programmingskill always start with session_start() (one day You might 
print something before)

> $sn=session_name();
> $nn=session_id() ;
> 
> $web="page2.php?lang=en";
> $web.="&$sn=$nn";
> 
> header("Location: $web");
> ?>
> ===
> page2.php:
>  session_start();
> global $nfo;
> 
> $uss=$nfo["fu"];
> 
> echo $uss;  HERE $uss is empty!

Yeah, cause that´s _not_ what the manual says:

http://dk.php.net/manual/en/ref.session.php

It should be $_SESSION['nfo']['fu'] = 12;

-- 
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen 
Systemudvikler/systemdeveloper

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem

2005-03-31 Thread Rosen
Hi,
I have this code :


page1.php:

===
page2.php:


This script works on several linux servers, but on one doesn't work (
variable $uss in page2.php has no value ).
I think this may be problem with PHP configuration on this server ( I don't
have root password for this server ).

Have someone idea where may be the problem ?

Thanks in advance!
Rosen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session Problem

2004-10-05 Thread Brian
Make sure you are doing a session_start first.


On Tue, 5 Oct 2004 19:00:57 +0530, Kevin Javia <[EMAIL PROTECTED]> wrote:
> Hi there,
> 
> I have got PHP 5 installed on IIS6 with 'register_globals = on'.
> 
> When run my page with session variable at top of the page
> 
>  $_SESSION['_user'] == ""
> ..
> ?>
> 
> I got notice like "Notice: Undefined index: _user in E:\Projects\."
> 
> What can be the reason and what is the solution? _user variable is not
> registered before.
> 
> Thanks a ton for reading this far.
> 
> Kevin.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session Problem

2004-10-05 Thread raditha dissanayake
Kevin Javia wrote:
Hi there,
I have got PHP 5 installed on IIS6 with 'register_globals = on'.
 

consider switching it off. your application will be impossible to 
install on any other server if you keep working on it with register 
global s on.

When run my page with session variable at top of the page

$_SESSION['_user'] == ""
..
?>
 

Is your syntax correct if you want to set a value for this you need to 
use '=' and not '=='

I got notice like "Notice: Undefined index: _user in E:\Projects\."
 

this is just a warning, you can disable it or write it to the log file 
instead of the browser by editing your php.ini

What can be the reason and what is the solution? _user variable is not
registered before.
 

The fact that it's not registered and that you are using it in a 
comparision operation is what's caused the engine to give you a warning.

Thanks a ton for reading this far.
Kevin.
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Session Problem

2004-10-05 Thread Kevin Javia
Hi there,

I have got PHP 5 installed on IIS6 with 'register_globals = on'.

When run my page with session variable at top of the page



I got notice like "Notice: Undefined index: _user in E:\Projects\."

What can be the reason and what is the solution? _user variable is not
registered before.

Thanks a ton for reading this far.

Kevin.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session Problem PHP version 4.3.8

2004-08-13 Thread James E Hicks III
On Friday 13 August 2004 01:14 pm, Torsten Roehr wrote:
> James, have you tried with manually calling session_start() and setting
> auto_start = 0? If not, please try this.
>
> Haven't followed your previous thread so please forgive me if I'm asking
> something you already wrote. Are you using cookies? 

YES

These are my current cookie related php.ini settings.

session.use_cookies = 1
; session.use_only_cookies  defaults to 0
; session.use_only_cookies = 1

> If so, have you tried 
> without them by appending the session id manually to the links?
>

I tried that without turning cookies off and appending the SID to the 
offending anchor tag (the one with javascript). Nothing I tried worked with 
current php.ini settings.

I tried like this:

echo("\n THIS STARTS NEW 
SESSION");

Which gave me this anchor tag:
THIS STARTS NEW SESSION

And like this:

echo ("THIS STARTS NEW SESSION");

Which gave me this anchor tag:
THIS
 
STARTS NEW SESSION

> Try these settings:
> session.auto_start    = 0
> session.use_cookies   = 0
> session.use_trans_sid = 0
>
> Put session_start() at the top of ALL your pages and write your links this
> way:
> to page 2 
>

I tried with php.ini settings like you suggested and it didn't work at all. 
Whatever you clicked on started a new session. Then I turned 
session.use_trans_sid = 1 with auto_start and use_cookies still turned off 
and my example code started working!!! My problem is that all my other real 
world apps do not work with php.ini settings like that. :(

So it seems that the cookie part of sessions is broken somehow and my earlier 
idea of adding something to url_rewrite wouldn't help even if I could figure 
out what to add to it. Anyone have any other ideas. Can I upgrade to 
something higher than 4.3.8? Would that mean upgrading to 5.x?

James Hicks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session Problem PHP version 4.3.8

2004-08-13 Thread Torsten Roehr
Hi Andre, hi James,

please see below

"Andre Dubuc" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Friday 13 August 2004 11:19 am, you wrote:
> > On Friday 13 August 2004 11:14 am, Andre Dubuc wrote:
> > > Hi James,
>  [snip]
>
>  .for thatt matter, have you 'saved' it using session_write_close();
> >
> > From the Manual:
> > Session data is usually stored after your script terminated without the
> > need to call session_write_close(),
> >
> [snip]
>
>
> Well, for my money James, that's where your problem lies. Notice the
"usually"
> in the Manual quote. In my experience, it never saves unless I write to
it.

Then something is wrong with your server. You DO NOT need to explicitly call
session_write_close().

> But, with your config, with session.auto_start=1, if I read that
correctly,
> it will do nothing other than start the session automatically, but not
save a
> change to a session variable. Hence, it reloads with a 'not-set' condition
in
> that code. And by the way, it is hitting that if condition - hence your
reset
> session.

James, have you tried with manually calling session_start() and setting
auto_start = 0? If not, please try this.

Haven't followed your previous thread so please forgive me if I'm asking
something you already wrote. Are you using cookies? If so, have you tried
without them by appending the session id manually to the links?

Try these settings:
session.auto_start= 0
session.use_cookies   = 0
session.use_trans_sid = 0

Put session_start() at the top of ALL your pages and write your links this
way:
to page 2 

Hope it helps,

Regards, Torsten Roehr

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session Problem PHP version 4.3.8

2004-08-13 Thread Andre Dubuc
On Friday 13 August 2004 11:19 am, you wrote:
> On Friday 13 August 2004 11:14 am, Andre Dubuc wrote:
> > Hi James,
 [snip]

 .for thatt matter, have you 'saved' it using session_write_close();
>
> From the Manual:
> Session data is usually stored after your script terminated without the
> need to call session_write_close(),
>
[snip]


Well, for my money James, that's where your problem lies. Notice the "usually" 
in the Manual quote. In my experience, it never saves unless I write to it. 
But, with your config, with session.auto_start=1, if I read that correctly, 
it will do nothing other than start the session automatically, but not save a 
change to a session variable. Hence, it reloads with a 'not-set' condition in 
that code. And by the way, it is hitting that if condition - hence your reset 
session.

Just my $2 worth (inflation, you know :>)
Andre

> Time is set.
>
> > Test1 and hits the above condition, it will write a new time, and hence a
> > new session.
>
> It should never hit the if condition after the first load of the page.
>
> > I presume two things; 1. that you have  as
> > opener lines on each page  and 2. that register_globals=off.
>
> In my php.ini I have session.auto_start = 1, so that I do not need
> session_start(). And register_globals is set to off.
>
> > The last thing caused
> > all sorts of grief for me last week - messes up sessions if 'on'
>
> Been there done that! Thanks for trying to help!
>
> James

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session Problem PHP version 4.3.8

2004-08-13 Thread James E Hicks III
On Friday 13 August 2004 11:14 am, Andre Dubuc wrote:
> Hi James,
>
> Well for what it's worth:
>
> Your code in Test1 sets the paraemters -
> if(!$_SESSION['start_time']){
>   echo("\n Session Reset");
>   $_SESSION['start_time'] = time();
>
> yet when Test2 loads, you haven't called $_SESSION[''start_time'} nor, for
> that matter, have you 'saved' it using session_write_close();

From the Manual:
Session data is usually stored after your script terminated without the need 
to call session_write_close(),


> Therefore when the Test2 loads, time is not set, so when it returns to

Time is set.

> Test1 and hits the above condition, it will write a new time, and hence a
> new session.
>

It should never hit the if condition after the first load of the page.

> I presume two things; 1. that you have  as opener
> lines on each page  and 2. that register_globals=off. 

In my php.ini I have session.auto_start = 1, so that I do not need 
session_start(). And register_globals is set to off.

> The last thing caused 
> all sorts of grief for me last week - messes up sessions if 'on'
>

Been there done that! Thanks for trying to help!

James 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session Problem PHP version 4.3.8

2004-08-13 Thread Andre Dubuc
Hi James,

Well for what it's worth:

Your code in Test1 sets the paraemters -
if(!$_SESSION['start_time']){
echo("\n Session Reset");
$_SESSION['start_time'] = time();

yet when Test2 loads, you haven't called $_SESSION[''start_time'} nor, for 
that matter, have you 'saved' it using session_write_close(); 
Therefore when the Test2 loads, time is not set, so when it returns to Test1 
and hits the above condition, it will write a new time, and hence a new 
session.

I presume two things; 1. that you have  as opener 
lines on each page  and 2. that register_globals=off. The last thing caused 
all sorts of grief for me last week - messes up sessions if 'on'

Hth,
Andre

On Friday 13 August 2004 10:37 am, James E Hicks III wrote:
> OK, so it wasn't the nut behind the wheel after all. I am still having
> problems with sessions after upgrading to PHP 4.3.8. The test code below
> works as expected on server equipped with PHP 4.3.6 and keeps the session
> start time the same no matter what link you click on. However with version
> 4.3.8 when you click on the last link on the page it will start a new
> session and the session start time will be updated. What can I change to
> fix this?
>
> All the session related php.ini settings are the same on both servers and I
> will repost that information here. Both servers are running the same
> version of Apache, Server version: Apache/1.3.27 (Unix)  (Gentoo/Linux).
>
> ## Session settings in php.ini
> [Session]
> session.save_handler = files
> session.save_path = /tmp
> session.use_cookies = 1
> ; session.use_only_cookies = 1
> session.name = PHPSESSID
> session.auto_start = 1
> session.cookie_lifetime = 0
> session.cookie_path = /
> session.cookie_domain =
> session.serialize_handler = php
> session.gc_probability = 1
> session.gc_divisor = 100
> session.gc_maxlifetime = 1440
> session.bug_compat_42 = 1
> session.bug_compat_warn = 1
> session.referer_check =
> session.entropy_length = 0
> session.entropy_file =
> ;session.entropy_length = 16
> ;session.entropy_file = /dev/urandom
> session.cache_limiter = nocache
> session.cache_expire = 180
> session.use_trans_sid = 0
> url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
>
> And here is the example code that I am having trouble with.
>
> SESSION_TEST1.php
>
>  echo("\n SESSION TEST");
> echo("\n ");
> echo("\n  ");
> echo("\n ");
> echo("\n ");
> if(!$_SESSION['start_time']){
>   echo("\n Session Reset");
>   $_SESSION['start_time'] = time();
> }
> echo("\n Session Start Time -".date("M/d/Y h:i:s",
> $_SESSION['start_time']));
> echo("\n ");
> echo("\n  WORKS\">"); echo("\n ");
> echo("\n THIS ALSO WORKS");
> echo("\n THIS
> STARTS NEW SESSION");
> echo("\n ");
> ?>
>
> SESSION_TEST2.php
>
>  echo("\n SESSION TEST 2");
> echo("\n Now there is new session and the other window will update with new
> time");
> echo("\n Close This
> Window");
> echo("\n ");
> ?>
>
> Help
>
> James Hicks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session Problem PHP version 4.3.8

2004-08-13 Thread James E Hicks III
OK, so it wasn't the nut behind the wheel after all. I am still having 
problems with sessions after upgrading to PHP 4.3.8. The test code below 
works as expected on server equipped with PHP 4.3.6 and keeps the session 
start time the same no matter what link you click on. However with version 
4.3.8 when you click on the last link on the page it will start a new session 
and the session start time will be updated. What can I change to fix this?

All the session related php.ini settings are the same on both servers and I 
will repost that information here. Both servers are running the same version 
of Apache, Server version: Apache/1.3.27 (Unix)  (Gentoo/Linux).

## Session settings in php.ini
[Session]
session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
; session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 1
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

And here is the example code that I am having trouble with.

SESSION_TEST1.php

SESSION TEST");
echo("\n ");
echo("\n  ");
echo("\n ");
echo("\n ");
if(!$_SESSION['start_time']){
echo("\n Session Reset");
$_SESSION['start_time'] = time();
}
echo("\n Session Start Time -".date("M/d/Y h:i:s",
$_SESSION['start_time']));
echo("\n ");
echo("\n ");
echo("\n ");
echo("\n THIS ALSO WORKS");
echo("\n THIS 
STARTS NEW SESSION");
echo("\n ");
?>

SESSION_TEST2.php

SESSION TEST 2");
echo("\n Now there is new session and the other window will update with new 
time");
echo("\n Close This 
Window");
echo("\n ");
?>

Help

James Hicks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem

2004-06-22 Thread [EMAIL PROTECTED]
I have a problem with sessions.  If someone closes their internet explorer
window without logging off the session remains open.  When you try to go
back to the site IE hangs until I manually remove the sess_ files from
the /tmp directory.  Any insights on this one??

VR/Tim



Re: [PHP] Session problem

2004-03-24 Thread Richard Davey
Hello Carlos,

Wednesday, March 24, 2004, 2:52:16 PM, you wrote:

cc> I want to know how can i do to make the session dont expire?. i have an
cc> application that works with sessions, when i left the browser open for a
cc> while, i dont know maybe 30 minutes, when i try to go into a section it
cc> throw me an error, for session expire, how can i fic that?.

You can control the default lifespan of your session by modifying your
php.ini file (look for the Session section, specifically
session.gc_maxlifetime).

You could also modify this via ini_set().

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem

2004-03-24 Thread carlos castillo

I want to know how can i do to make the session dont expire?. i have an
application that works with sessions, when i left the browser open for a
while, i dont know maybe 30 minutes, when i try to go into a section it
throw me an error, for session expire, how can i fic that?.

thanks.

Carlos A. Castillo.
Ingeniero de desarrollo
[EMAIL PROTECTED]


Su Aliado Efectivo en Internet
www.imagine.com.co
(57 1)2182064 - (57 1)6163218
Bogotá - Colombia 

- Soluciones web para Internet e Intranet
- Soluciones para redes
- Licenciamiento de Software
- Asesoría y Soporte Técnico


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session problem (i think)

2004-03-16 Thread Nick Rout

On Wed, 17 Mar 2004 12:37:55 +1000
Tom Rogers <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> Wednesday, March 17, 2004, 12:24:27 PM, you wrote:
> NR> Thanks, it is set right, but I see some other things are not.
> NR> these other bits are set in a .htaccess file in the root of this
> NR> applications htdocs tree. When I execute a test.php file in the same
> NR> directory as the .htaccess file I presume the output of phpinfo() should
> NR> relect whats in the .htaccess file? If not, I assume I should be looking
> NR> in apache's config files at the AllowOveride stuff?
> NR> --
> NR> Nick Rout <[EMAIL PROTECTED]>
> 
> 
> Yes that is the next place to look

i added these lines to my apache config and restarted apache:


AllowOverride All


Still the specific settings in .htaccess don't get loaded. 

any other ideas?



> 
> -- 
> regards,
> Tom
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Nick Rout <[EMAIL PROTECTED]>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] session problem (i think)

2004-03-16 Thread Tom Rogers
Hi,

Wednesday, March 17, 2004, 12:24:27 PM, you wrote:
NR> Thanks, it is set right, but I see some other things are not.
NR> these other bits are set in a .htaccess file in the root of this
NR> applications htdocs tree. When I execute a test.php file in the same
NR> directory as the .htaccess file I presume the output of phpinfo() should
NR> relect whats in the .htaccess file? If not, I assume I should be looking
NR> in apache's config files at the AllowOveride stuff?
NR> --
NR> Nick Rout <[EMAIL PROTECTED]>


Yes that is the next place to look

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session problem (i think)

2004-03-16 Thread Nick Rout

On Wed, 17 Mar 2004 11:03:12 +1000
Tom Rogers <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> Wednesday, March 17, 2004, 9:43:51 AM, you wrote:
> NR> I am running Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48 OpenSSL/0.9.6k PHP/4.3.4
> 
> NR> I have a drupal site set up, http://rout.dyndns.org/cagc
> 
> NR> Since some time on Sunday i have had the following error appear at the
> NR> bottom of the page:
> 
> NR> Warning: Unknown(): A session is active. You cannot change
> NR> the session module's ini settings at this time. in Unknown on line
> 
> NR> I then cannot login to the site. Some of the site functionality is there
> NR> (ie you can view the basic pages etc, but anything that needs a login to
> NR> acheive is no good)
> 
> NR> When I search google I seem to find that this is a php error, although I
> NR> cannot see a fix anywhere.
> 
> NR> Can anyone tell me where to look in order to sort this out. I am a php
> NR> newbie, so if there is any other info I need to provide please let me
> NR> know.
> NR> -- 
> NR> Nick Rout <[EMAIL PROTECTED]>
> 
> 
> Check in php.ini session.auto_start it should be off if you want your
> own session control.

Thanks, it is set right, but I see some other things are not. 

these other bits are set in a .htaccess file in the root of this
applications htdocs tree. When I execute a test.php file in the same
directory as the .htaccess file I presume the output of phpinfo() should
relect whats in the .htaccess file? If not, I assume I should be looking
in apache's config files at the AllowOveride stuff?

> 
> -- 
> regards,
> Tom
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Nick Rout <[EMAIL PROTECTED]>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session problem (i think)

2004-03-16 Thread Tom Rogers
Hi,

Wednesday, March 17, 2004, 9:43:51 AM, you wrote:
NR> I am running Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48 OpenSSL/0.9.6k PHP/4.3.4

NR> I have a drupal site set up, http://rout.dyndns.org/cagc

NR> Since some time on Sunday i have had the following error appear at the
NR> bottom of the page:

NR> Warning: Unknown(): A session is active. You cannot change
NR> the session module's ini settings at this time. in Unknown on line

NR> I then cannot login to the site. Some of the site functionality is there
NR> (ie you can view the basic pages etc, but anything that needs a login to
NR> acheive is no good)

NR> When I search google I seem to find that this is a php error, although I
NR> cannot see a fix anywhere.

NR> Can anyone tell me where to look in order to sort this out. I am a php
NR> newbie, so if there is any other info I need to provide please let me
NR> know.
NR> -- 
NR> Nick Rout <[EMAIL PROTECTED]>


Check in php.ini session.auto_start it should be off if you want your
own session control.

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session problem (i think)

2004-03-16 Thread Nick Rout
I am running Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48 OpenSSL/0.9.6k PHP/4.3.4

I have a drupal site set up, http://rout.dyndns.org/cagc

Since some time on Sunday i have had the following error appear at the
bottom of the page:

Warning: Unknown(): A session is active. You cannot change the session module's ini 
settings at this time. in Unknown on line 0

I then cannot login to the site. Some of the site functionality is there
(ie you can view the basic pages etc, but anything that needs a login to
acheive is no good)

When I search google I seem to find that this is a php error, although I
cannot see a fix anywhere.

Can anyone tell me where to look in order to sort this out. I am a php
newbie, so if there is any other info I need to provide please let me
know.
-- 
Nick Rout <[EMAIL PROTECTED]>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] session problem

2004-02-04 Thread Ford, Mike [LSS]
On 04 February 2004 12:59, marc serra contributed these pearls of wisdom:

> Hi,
> 
> 
> 
> I'm working on a multi-langage website and i got problem with
> a fonction
> which destroy my session :-(
> 
> 
> 
> I got a file which change my langage like this :
> 
> 
> 
> //
> 
> session_start();
> 
> 
> 
> if ($_POST['langue']=="us")
> 
>   $_SESSION['language']="us";
> 
> else if ($_POST['langue']=="fr")
> 
>   $_SESSION['language']="fr";
> 
> 
> 
> header("Location:
> http://".$_SERVER['HTTP_HOST'].$_POST['page_name']); 
> 
> /*/

If you rely on URL rewriting to transmit your session ID, this won't work for header 
redirects, so you need to manually include the SID value.  In any case, this is good 
defensive programming (in case that configuration parameter ever gets changed!).  So 
your redirect should look like:

header("Location: http://".$_SERVER['HTTP_HOST'].$_POST['page_name'].'?'.SID);

Cheers!

Mike

-- 
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session problem

2004-02-04 Thread Jason Wong
On Wednesday 04 February 2004 20:59, marc serra wrote:

> When the header function is called I'm correctly redirected on the right
> page but all my session variables are destroyed.

Try session_write_close() before you redirect.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I hope something GOOD came in the mail today so I have a REASON to live!!
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session problem

2004-02-04 Thread marc serra
Hi,

 

I'm working on a multi-langage website and i got problem with a fonction
which destroy my session :-(

 

I got a file which change my langage like this :

 

//

session_start();

 

if ($_POST['langue']=="us")

  $_SESSION['language']="us";

else if ($_POST['langue']=="fr")

  $_SESSION['language']="fr";

 

header("Location: http://".$_SERVER['HTTP_HOST'].$_POST['page_name']);

/*/

 

When the header function is called I'm correctly redirected on the right
page but all my session variables are destroyed.

Can you please help me resolving this problem. I've tried directly entering
the path for redirection like that:

header("Location: index.php");

 

but it's the same problem.

 

Thanks in advance,

 

__

MARC SERRA

MASTER Commerce Electronique

IUP GMI AVIGNON

FRANCE



Re: [PHP] Session problem

2003-10-27 Thread Jason Wong
On Tuesday 28 October 2003 08:33, Manisha Sathe wrote:
> ok, i am putting it the code in both files, now my first.php is as follows

[code snipped]

The code looks OK. Things you can do to try track down the problem:

1) As always, turn on FULL error reporting and check the logs
2) Verify that your browser is set to accept cookies, or that you have enabled 
php for transparent sessions support
3) Verify that sessions are being created by looking for them in the directory 
specified by session.save_path in php.ini

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The Official Colorado State Vegetable is now the "state legislator".
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session problem

2003-10-27 Thread Manisha Sathe
ok, i am putting it the code in both files, now my first.php is as follows


//start the session - in all the pages
session_start();
var_dump(ini_get('variables_order'));
var_dump(isset($_SESSION));
var_dump($_SESSION);

//store it like that
$_SESSION["name"]= "Rinku";
-
The error msg is

string(5) "EGPCS" bool(true) array(0) { }

-
second.php is like this

--


the error msg is

string(5) "EGPCS" bool(true) array(0) { }
Notice: Undefined index: name in C:\Project
Codes\Vanderveer\www\testPHP\second.php on line 10

--

Please can u help me now in understanding it ?

manisha

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session problem

2003-10-26 Thread dark
Hi,

session_start has to be the first command this time.  try again and the result will 
look better, maybe explaining.
so it should look like:



angel

On Sun, 26 Oct 2003 17:47:38 +0800
"Manisha Sathe" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> do u mean to say put this codes in php ?
> I tried to put it in second.php following is the msg -
> --
> string(5) "EGPCS" bool(false)
> Notice: Undefined variable: _SESSION in C:\Project
> Codes\Vanderveer\www\testPHP\second.php on line 4
> NULL
> Warning: session_start(): Cannot send session cookie - headers already sent
> by (output started at C:\Project Codes\Vanderveer\www\testPHP\second.php:2)
> in C:\Project Codes\Vanderveer\www\testPHP\second.php on line 7
> 
> Warning: session_start(): Cannot send session cache limiter - headers
> already sent (output started at C:\Project
> Codes\Vanderveer\www\testPHP\second.php:2) in C:\Project
> Codes\Vanderveer\www\testPHP\second.php on line 7
> 
> Notice: Undefined index: name in C:\Project
> Codes\Vanderveer\www\testPHP\second.php on line 10
> -
> 
> I am not that expert in PHP, what all above means ? can u give me a hint
> now, what is going wrong ?
> 
> regards
> manisha
> 
> "Evan Nemerson" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > var_dump(ini_get('variables_order'));
> > var_dump(isset($_SESSION));
> > var_dump($_SESSION);
> >
> > ?
> >
> >
> > On Sunday 26 October 2003 01:43 am, Manisha Sathe wrote:
> > > It works well on linux means it shows me o/p as 'Manisha' but on local
> > > Win2kserver, it gives error.
> > >
> > > I tried to make use of error_reporting(0); in second.php but then screen
> > > becomes blank, it does not show me the output as "Manisha"
> > >
> > > manisha
> > >
> > >
> > >
> > > "Evan Nemerson" <[EMAIL PROTECTED]> wrote in message
> > > news:[EMAIL PROTECTED]
> > >
> > > > Your Linux server probably has error_reporting set to 0, which is
> usually
> > >
> > > a
> > >
> > > > good idea for production environments. To supress the error messages
> > >
> > > without
> > >
> > > > modifying your php.ini, do error_reporting(0). Take a look in your
> > > > php.ini file- the error_reporting directive will have lots of comments
> > > > around it explaining the concept thoroughly.
> > > >
> > > > On Sunday 26 October 2003 01:06 am, Manisha Sathe wrote:
> > > > > I am trying to use session but it seems it does not work on win2k
> > >
> > > server,
> > >
> > > > > the same runs on linux.
> > > > >
> > > > > following is my first php
> > > > > ---
> > > > >  > > > > session_start();
> > > > > $_SESSION["name"]= "Manisha";
> > > > > ?>
> > > > > --
> > > > > following is the second php
> > > > >
> > > > >  > > > > session_start();
> > > > > echo $_SESSION["name"];
> > > > > ?>
> > > > >
> > > > > -
> > > > >
> > > > > but it is always giving me following error msg
> > > > >
> > > > > Notice: Undefined index: name in C:\Project
> > > > > Codes\www\testPHP\second.php
> > >
> > > on
> > >
> > > > > line 6
> > > > >
> > > > > 
> > > > >
> > > > > The same thing works well on live Linux server. I checked php.ini
> > >
> > > options
> > >
> > > > > such as session enable / register global etc - both r same. Please
> help
> > > > > me. Is it a problem with win2k server or did i miss out any thing in
> > > > > php.ini ?
> > > > >
> > > > > Regards
> > > > > Manisha
> > > >
> > > > --
> > > > Evan Nemerson
> > > > [EMAIL PROTECTED]
> > > >
> > > > --
> > > > "The people are the only sure reliance for preservation of our
> liberty."
> > > >
> > > > -Thomas Jefferson
> >
> > --
> > Evan Nemerson
> > [EMAIL PROTECTED]
> >
> > --
> > "A popular government, without popular information, or the means of
> acquiring
> > it, is but a Prologue to a Farce or a Tragedy - or perhaps both. Knowledge
> > will forever govern ignorance, and a people who mean to be their own
> > Governors must arm themselves with the power which knowledge gives."
> >
> > -James Madison
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session problem

2003-10-26 Thread Manisha Sathe
Hi,

do u mean to say put this codes in php ?
I tried to put it in second.php following is the msg -
--
string(5) "EGPCS" bool(false)
Notice: Undefined variable: _SESSION in C:\Project
Codes\Vanderveer\www\testPHP\second.php on line 4
NULL
Warning: session_start(): Cannot send session cookie - headers already sent
by (output started at C:\Project Codes\Vanderveer\www\testPHP\second.php:2)
in C:\Project Codes\Vanderveer\www\testPHP\second.php on line 7

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at C:\Project
Codes\Vanderveer\www\testPHP\second.php:2) in C:\Project
Codes\Vanderveer\www\testPHP\second.php on line 7

Notice: Undefined index: name in C:\Project
Codes\Vanderveer\www\testPHP\second.php on line 10
-

I am not that expert in PHP, what all above means ? can u give me a hint
now, what is going wrong ?

regards
manisha

"Evan Nemerson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> var_dump(ini_get('variables_order'));
> var_dump(isset($_SESSION));
> var_dump($_SESSION);
>
> ?
>
>
> On Sunday 26 October 2003 01:43 am, Manisha Sathe wrote:
> > It works well on linux means it shows me o/p as 'Manisha' but on local
> > Win2kserver, it gives error.
> >
> > I tried to make use of error_reporting(0); in second.php but then screen
> > becomes blank, it does not show me the output as "Manisha"
> >
> > manisha
> >
> >
> >
> > "Evan Nemerson" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> > > Your Linux server probably has error_reporting set to 0, which is
usually
> >
> > a
> >
> > > good idea for production environments. To supress the error messages
> >
> > without
> >
> > > modifying your php.ini, do error_reporting(0). Take a look in your
> > > php.ini file- the error_reporting directive will have lots of comments
> > > around it explaining the concept thoroughly.
> > >
> > > On Sunday 26 October 2003 01:06 am, Manisha Sathe wrote:
> > > > I am trying to use session but it seems it does not work on win2k
> >
> > server,
> >
> > > > the same runs on linux.
> > > >
> > > > following is my first php
> > > > ---
> > > >  > > > session_start();
> > > > $_SESSION["name"]= "Manisha";
> > > > ?>
> > > > --
> > > > following is the second php
> > > >
> > > >  > > > session_start();
> > > > echo $_SESSION["name"];
> > > > ?>
> > > >
> > > > -
> > > >
> > > > but it is always giving me following error msg
> > > >
> > > > Notice: Undefined index: name in C:\Project
> > > > Codes\www\testPHP\second.php
> >
> > on
> >
> > > > line 6
> > > >
> > > > 
> > > >
> > > > The same thing works well on live Linux server. I checked php.ini
> >
> > options
> >
> > > > such as session enable / register global etc - both r same. Please
help
> > > > me. Is it a problem with win2k server or did i miss out any thing in
> > > > php.ini ?
> > > >
> > > > Regards
> > > > Manisha
> > >
> > > --
> > > Evan Nemerson
> > > [EMAIL PROTECTED]
> > >
> > > --
> > > "The people are the only sure reliance for preservation of our
liberty."
> > >
> > > -Thomas Jefferson
>
> --
> Evan Nemerson
> [EMAIL PROTECTED]
>
> --
> "A popular government, without popular information, or the means of
acquiring
> it, is but a Prologue to a Farce or a Tragedy - or perhaps both. Knowledge
> will forever govern ignorance, and a people who mean to be their own
> Governors must arm themselves with the power which knowledge gives."
>
> -James Madison

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session problem

2003-10-26 Thread Manisha Sathe
It works well on linux means it shows me o/p as 'Manisha' but on local
Win2kserver, it gives error.

I tried to make use of error_reporting(0); in second.php but then screen
becomes blank, it does not show me the output as "Manisha"

manisha



"Evan Nemerson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Your Linux server probably has error_reporting set to 0, which is usually
a
> good idea for production environments. To supress the error messages
without
> modifying your php.ini, do error_reporting(0). Take a look in your php.ini
> file- the error_reporting directive will have lots of comments around it
> explaining the concept thoroughly.
>
>
> On Sunday 26 October 2003 01:06 am, Manisha Sathe wrote:
> > I am trying to use session but it seems it does not work on win2k
server,
> > the same runs on linux.
> >
> > following is my first php
> > ---
> >  > session_start();
> > $_SESSION["name"]= "Manisha";
> > ?>
> > --
> > following is the second php
> >
> >  > session_start();
> > echo $_SESSION["name"];
> > ?>
> >
> > -
> >
> > but it is always giving me following error msg
> >
> > Notice: Undefined index: name in C:\Project Codes\www\testPHP\second.php
on
> > line 6
> >
> > 
> >
> > The same thing works well on live Linux server. I checked php.ini
options
> > such as session enable / register global etc - both r same. Please help
> > me. Is it a problem with win2k server or did i miss out any thing in
> > php.ini ?
> >
> > Regards
> > Manisha
>
> --
> Evan Nemerson
> [EMAIL PROTECTED]
>
> --
> "The people are the only sure reliance for preservation of our liberty."
>
> -Thomas Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session problem

2003-10-26 Thread Evan Nemerson
Your Linux server probably has error_reporting set to 0, which is usually a 
good idea for production environments. To supress the error messages without 
modifying your php.ini, do error_reporting(0). Take a look in your php.ini 
file- the error_reporting directive will have lots of comments around it 
explaining the concept thoroughly.


On Sunday 26 October 2003 01:06 am, Manisha Sathe wrote:
> I am trying to use session but it seems it does not work on win2k server,
> the same runs on linux.
>
> following is my first php
> ---
>  session_start();
> $_SESSION["name"]= "Manisha";
> ?>
> --
> following is the second php
>
>  session_start();
> echo $_SESSION["name"];
> ?>
>
> -
>
> but it is always giving me following error msg
>
> Notice: Undefined index: name in C:\Project Codes\www\testPHP\second.php on
> line 6
>
> 
>
> The same thing works well on live Linux server. I checked php.ini options
> such as session enable / register global etc - both r same. Please help 
> me. Is it a problem with win2k server or did i miss out any thing in
> php.ini ?
>
> Regards
> Manisha

-- 
Evan Nemerson
[EMAIL PROTECTED]

--
"The people are the only sure reliance for preservation of our liberty."

-Thomas Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session problem

2003-10-26 Thread Evan Nemerson
var_dump(ini_get('variables_order'));
var_dump(isset($_SESSION));
var_dump($_SESSION);

?


On Sunday 26 October 2003 01:43 am, Manisha Sathe wrote:
> It works well on linux means it shows me o/p as 'Manisha' but on local
> Win2kserver, it gives error.
>
> I tried to make use of error_reporting(0); in second.php but then screen
> becomes blank, it does not show me the output as "Manisha"
>
> manisha
>
>
>
> "Evan Nemerson" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
> > Your Linux server probably has error_reporting set to 0, which is usually
>
> a
>
> > good idea for production environments. To supress the error messages
>
> without
>
> > modifying your php.ini, do error_reporting(0). Take a look in your
> > php.ini file- the error_reporting directive will have lots of comments
> > around it explaining the concept thoroughly.
> >
> > On Sunday 26 October 2003 01:06 am, Manisha Sathe wrote:
> > > I am trying to use session but it seems it does not work on win2k
>
> server,
>
> > > the same runs on linux.
> > >
> > > following is my first php
> > > ---
> > >  > > session_start();
> > > $_SESSION["name"]= "Manisha";
> > > ?>
> > > --
> > > following is the second php
> > >
> > >  > > session_start();
> > > echo $_SESSION["name"];
> > > ?>
> > >
> > > -
> > >
> > > but it is always giving me following error msg
> > >
> > > Notice: Undefined index: name in C:\Project
> > > Codes\www\testPHP\second.php
>
> on
>
> > > line 6
> > >
> > > 
> > >
> > > The same thing works well on live Linux server. I checked php.ini
>
> options
>
> > > such as session enable / register global etc - both r same. Please help
> > > me. Is it a problem with win2k server or did i miss out any thing in
> > > php.ini ?
> > >
> > > Regards
> > > Manisha
> >
> > --
> > Evan Nemerson
> > [EMAIL PROTECTED]
> >
> > --
> > "The people are the only sure reliance for preservation of our liberty."
> >
> > -Thomas Jefferson

-- 
Evan Nemerson
[EMAIL PROTECTED]

--
"A popular government, without popular information, or the means of acquiring 
it, is but a Prologue to a Farce or a Tragedy - or perhaps both. Knowledge 
will forever govern ignorance, and a people who mean to be their own 
Governors must arm themselves with the power which knowledge gives."

-James Madison

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem

2003-10-26 Thread Manisha Sathe
I am trying to use session but it seems it does not work on win2k server,
the same runs on linux.

following is my first php
---

--
following is the second php



-

but it is always giving me following error msg

Notice: Undefined index: name in C:\Project Codes\www\testPHP\second.php on
line 6



The same thing works well on live Linux server. I checked php.ini options
such as session enable / register global etc - both r same. Please help  me.
Is it a problem with win2k server or did i miss out any thing in php.ini ?

Regards
Manisha

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] session-problem

2003-09-01 Thread Curt Zirzow
* Thus wrote Juerg Zgraggen ([EMAIL PROTECTED]):
> now my problem: i wrote in my navigation-frame this code:
> if( !isset($_SESSION['testint'] ) )
>{
>$_SESSION['testint'] = 1;
>}
> $_SESSION['testint']++;
> print_r($_SESSION);
> ?>
> 
> after the print_r() i can see my 'testint'-session-variable on the
> navigation-site. however on the other frame-site. i do NOT see this
> 'testint'-session-variable when i reload it. and when i reload the
> navigation-frame the variable does appear but does NOT increase. isset()
> always return false!!! when i take a look at the session-file on my
> Computer, i do NOT find the variable 'testint'...

session_start() has been called right?



Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session-problem

2003-09-01 Thread Juerg Zgraggen
hi

got a big session-problem and i have no idea what i'm doing wrong...

i have quite a big web-app and i tried to upgrade the code.
ex: $frm_id to$_POST['frm_id']
and$HTTP_SESSION_VAR['myId']   to   $_SESSION['myId']
... ect...

i changed the register_globals = Off in the php.ini and tried to browse my
webapp.

now my problem: i wrote in my navigation-frame this code:


after the print_r() i can see my 'testint'-session-variable on the
navigation-site. however on the other frame-site. i do NOT see this
'testint'-session-variable when i reload it. and when i reload the
navigation-frame the variable does appear but does NOT increase. isset()
always return false!!! when i take a look at the session-file on my
Computer, i do NOT find the variable 'testint'...

now when i make a complete new dummy php-file and copy-paste this
session-code on the navigation-site then the session works perfectly. even
when i call the navigation-site again AFTER processing this dummy-php-file.
the session for this variable works suddenly.

what am i doing wrong???
please give me a hint!
regards, jazper

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session problem in back button

2003-08-26 Thread murugesan
Seems confusing.

-
//include.php
session_name("sessionname");
session_start();
-->>
This was added in a separate file and included that file in all the files
including index.php
In index.php I registered a variable s_authed and initialised it to 0

-
//index.php
include "include.php";
session_register("s_authed");
$s_authed = 0; // initialize session flag
->>

And after sign up I am authenticating the user in a separate file
and setting a flag s_authed to 1
-
//auth.php
if(check for authentication)
{
   
   $HTTP_SESSION_VARS['s_authed']=1;
}
->>
Now in the main.php
I am checking
-
//main.php

if($s_authed==1)
{
   //Display login form code goes here
}
else
{
display "authentication required";
}
->>



This is working fine. Even when I copy and paste the URL to another browser
it is showing authentication required page.
When I used

if (!isset($_SESSION['sessionname']))
{
   //Display login form code goes here
}

in main.php
it is not working. I mean that it display the page even when I copy and
paste URL in a new browser window.

Seems like an essay :)
Why is it so.
Is that my previous method was correct or any mistakes I did?



-murugesan






- Original Message -
From: "Paul Fitzpatrick" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 26, 2003 10:43 PM
Subject: RE: [PHP] Session problem in back button


>
> Hi,
>
> This will stop them seeing the login once they are in a registered
> session
> Only diplay the login form if NOT a registered session variable
> 'sessionname' (or some other session variable)
>
>
> If (!isset($_SESSION['sessionname']))
> {
>//Display login form code goes here
> }
>
> Cheers.
>
>
>
>
> -Original Message-
> From: murugesan [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 25, 2003 9:55 AM
> To: murugesan; Cody Phanekham; [EMAIL PROTECTED]
> Subject: [PHP] Session problem in back button
>
> Hello all,
> Now i have a problem in back button.
> After signing in when I click back button It goes to login page.
> But
> when I click the forward button it is going to the main page.
> How can I prevent this.
>
> -murugesan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Session problem in back button

2003-08-26 Thread Paul Fitzpatrick

Hi,

This will stop them seeing the login once they are in a registered
session
Only diplay the login form if NOT a registered session variable
'sessionname' (or some other session variable)


If (!isset($_SESSION['sessionname']))
{
   //Display login form code goes here
}

Cheers.




-Original Message-
From: murugesan [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 25, 2003 9:55 AM
To: murugesan; Cody Phanekham; [EMAIL PROTECTED]
Subject: [PHP] Session problem in back button

Hello all,
Now i have a problem in back button.
After signing in when I click back button It goes to login page.
But
when I click the forward button it is going to the main page.
How can I prevent this.

-murugesan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem in back button

2003-08-25 Thread murugesan
Hello all,
Now i have a problem in back button.
After signing in when I click back button It goes to login page. But
when I click the forward button it is going to the main page.
How can I prevent this.

-murugesan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP Session Problem!.....urgent!

2003-08-14 Thread babak
Dear Sir,

I've been using PHP for business and personal use for a while now, and I
have to admit, I'm not just a user anymore and I am a fan. but it's been a
while I came across a problem : I use session variables a lot for security
purposes but I notice that PHP doesn't hold the session variables when I
go from one URL to another URL.These are 2 different domains but located
on the same server and in my php.ini I set a separate temp folder outside
of both of those domains' folders,
do you have any idea how I can solve this problem ?...so far the only
solution I've found is that I pass the session ID to that page that's on
the other server and then I can get access to session variables. It's just
that if the person who is already logged in my system and they type in a
different URL which is part my system also it's just a different URL , I
lose them.

Any help is apprieciated,

 Sincerely
   Babak P.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Session Problem!.....urgent!

2003-08-14 Thread CPT John W. Holmes
From: <[EMAIL PROTECTED]>
> Dear Sir,

You don't have to call me that unless you're in the military, also. :)

> I've been using PHP for business and personal use for a while now, and I
> have to admit, I'm not just a user anymore and I am a fan. but it's been a
> while I came across a problem : I use session variables a lot for security
> purposes but I notice that PHP doesn't hold the session variables when I
> go from one URL to another URL.These are 2 different domains but located
> on the same server and in my php.ini I set a separate temp folder outside
> of both of those domains' folders,
> do you have any idea how I can solve this problem ?...so far the only
> solution I've found is that I pass the session ID to that page that's on
> the other server and then I can get access to session variables. It's just

That's how you HAVE to do it. If I understand you correctly, you've already
got both sites storing their session files in the same directory. Passing
the SID between sites is the only way to maintain that same session.
Sessions normally use cookies, which are tied to a domain and will not be
sent when you switch domains, that's why you pass the SID.

> that if the person who is already logged in my system and they type in a
> different URL which is part my system also it's just a different URL , I
> lose them.

Nothing you can do about that. Get them to use links.

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Session Problem!.....urgent!

2003-08-14 Thread Robert Cummings
The root of your problem is that sessions generally do not traverse
multiple domains. A possible solution is to embed an image in each of
the servers which references a PHP script in the other server, and while
doing so passes the sessionID along.

On server abc.foo.org you might have the following:

http://xyz.foo.org/sessionMap.php?sessionId=123456789"; />

While on server xyz.goo.org you would have the following:

http://abc.foo.org/sessionMap.php?sessionId=123456789"; />

What this does is create a session on the other server even though the
user has not "seemingly" visited it. By passing the original session ID
you indicate the session ID that should be used for the new session and
thus bypass any session ID generation. Then if the user visits that site
they will already be set up, and provided the session data is stored in
the same database for each site then all information will be
transferable.

The image which accesses the other server's sessionMap.php script would
only need to be output to the browser when a new session is created.

HTH,
Rob.


On Thu, 2003-08-14 at 13:29, [EMAIL PROTECTED] wrote:
> Dear Sir,
> 
> I've been using PHP for business and personal use for a while now, and I
> have to admit, I'm not just a user anymore and I am a fan. but it's been a
> while I came across a problem : I use session variables a lot for security
> purposes but I notice that PHP doesn't hold the session variables when I
> go from one URL to another URL.These are 2 different domains but located
> on the same server and in my php.ini I set a separate temp folder outside
> of both of those domains' folders,
> do you have any idea how I can solve this problem ?...so far the only
> solution I've found is that I pass the session ID to that page that's on
> the other server and then I can get access to session variables. It's just
> that if the person who is already logged in my system and they type in a
> different URL which is part my system also it's just a different URL , I
> lose them.
> 
> Any help is apprieciated,
> 
>  Sincerely
>Babak P.
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
-- 
.-.
| Worlds of Carnage - http://www.wocmud.org   |
:-:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.|
`-'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem when setting session variables in files that are in different directories

2003-07-23 Thread Mikael Jansson
I am running PHP 4.3.0 on a WinXPpro machine and I recently got problem with
sessions.

What I am building is a loginsystem and I need to save some parameters in
session variables. This works fine on my Win2k pro machine but when I moved
it to winXP it creates two different sessions when I set the $_SESSION
variables. here is some psedo code:

1. When going to any page first thing is to check if permission is set and
also setting a session variable with the pagename (to use as an redirct
later on)
2. after setting the session variable an file is included that performs the
actual login or permission check. In this file another session variable is
set after the login is made, and now starts the weard thing, because now a
new sessionID will be created and if I look in the sessiondata directory
there will be 2 files (with different session ids) that has all the data I
have set but in 2 files.

The first session variable is set from a PHP file in one directory and then
the include file is in another directory and that seems to be the problem
because if I move the first PHP file into the include file directory it will
all work just fine.

Please say you have some comments on what the problem is.

Thanx in advance

/ Mikael



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem

2003-07-23 Thread tana dsasa
I have installed an user-login aplication on my website ( 
http://www.norbertnet.ro ) but i have problems with session controls.
I receive all kinds of warnings and i don't know how to interpret them, for instance 
when i want to register a session it is not very good registered

thanks advanced




-
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger

[PHP] Session problem

2003-07-23 Thread tana dsasa
I have installed an user-login aplication on my website ( 
http://www.norbertnet.ro ) but i have problems with session controls.
I receive all kinds of warnings and i don't know how to interpret them, for instance 
when i want to register a session it is not very good registered
 
thanks advanced


-
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger

RE: [PHP] Session problem

2003-07-23 Thread Sævar Öfjörð
You have to specify which warnings and errors if you want someone to
help

-Original Message-
From: tana dsasa [mailto:[EMAIL PROTECTED] 
Sent: 23. júlí 2003 09:58
To: [EMAIL PROTECTED]
Subject: [PHP] Session problem

I have installed an user-login aplication on my website (
http://www.norbertnet.ro ) but i have problems with session controls.
I receive all kinds of warnings and i don't know how to interpret them
 
thanks advanced


-
Want to chat instantly with your online friends? Get the FREE
Yahoo!Messenger


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem

2003-07-23 Thread tana dsasa
I have installed an user-login aplication on my website ( http://www.norbertnet.ro ) 
but i have problems with session controls.
I receive all kinds of warnings and i don't know how to interpret them
 
thanks advanced


-
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger

Re: [PHP] Session Problem

2003-07-14 Thread Kevin Stone
- Original Message -
From: "Sourabh G" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 13, 2003 11:15 AM
Subject: [PHP] Session Problem


> Hi,
>
> I am getting a weird session problem in my site.
>
> Background of the Problem:
> --
> My site use sessions for user authentication. Site has a Admin Panel where
> admin can search users and then through a link
>
> (which has login and password appended) login as user.
>
> On login as user, session var changes to the new user vars, like user id
> etc. So, if some one try to access any thing on
>
> admin panel, they get error which is quite evident why is that happened.
The
> login user is not a admin any more, its a normal
>
> user with no privilege.
>
> I came to a conclusion that if I spawn new browser window it takes old
> session. After trying for hours, I was able to solve
>
> this. I started a new session when I login as user by setting session name
> and storing the other vars. This way I can start
>
> the session as needed.
>
> After solving this problem I thought I am done. But some thing really
weird
> popped up. The links on the page, like "My
>
> Account", "Change Password" goes to admin when I click them. This looks
like
> on clicking the link, Old admin session becoming
>
> active and showing the page as a admin. I have no idea why is that
> happening. I have searched goggle but no result.
>
> Is it a browser issue, or php issue, or I am doing something wrong.
>
>
> * I have compiled PHP with trans-sid option.
> ** I store session in my sql database. I can see the user session active.
>
> Ideal Solution:-)
> --
>
> When I search the user and login as user. Both admin and user session
remain
> alive and I can work on both windows seamlessly.
>
> Can Any one point me in the right direction.
>
> Thanks


This is a problem that many of us have had to deal with.. Session ID's
caching and revalidating when the back button is used or a page is
revisited.  The solution is simple.  Don't just destroy the Session, also
write over all variables within the session like this..

foreach($_SESSION as $key => $val)
{
$_SESSION[$key] = '';
}

The next time session_start() is called the session file will be emptied.
This will ensure that if you click the back button and the Session ID has
been cached the session file no longer contains any useful data and there is
no possibility that your Login script will revalidate the user.

Quite frankly I wouldn't even bother using session_destroy().  It doesn't
seem to do anything useful.

Good luck,
Kevin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session Problem

2003-07-14 Thread Sourabh G
Hi,

I am getting a weird session problem in my site.

Background of the Problem:
--
My site use sessions for user authentication. Site has a Admin Panel where
admin can search users and then through a link

(which has login and password appended) login as user.

On login as user, session var changes to the new user vars, like user id
etc. So, if some one try to access any thing on

admin panel, they get error which is quite evident why is that happened. The
login user is not a admin any more, its a normal

user with no privilege.

I came to a conclusion that if I spawn new browser window it takes old
session. After trying for hours, I was able to solve

this. I started a new session when I login as user by setting session name
and storing the other vars. This way I can start

the session as needed.

After solving this problem I thought I am done. But some thing really weird
popped up. The links on the page, like "My

Account", "Change Password" goes to admin when I click them. This looks like
on clicking the link, Old admin session becoming

active and showing the page as a admin. I have no idea why is that
happening. I have searched goggle but no result.

Is it a browser issue, or php issue, or I am doing something wrong.


* I have compiled PHP with trans-sid option.
** I store session in my sql database. I can see the user session active.

Ideal Solution:-)
--

When I search the user and login as user. Both admin and user session remain
alive and I can work on both windows seamlessly.

Can Any one point me in the right direction.

Thanks



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session Problem

2003-07-02 Thread Michael A Smith
Okay,

I'm starting session with 

session_name("PRATTCMS_ADMIN");
session_save_path($sess_path);
session_start();

This works on one server I have, compiled the almost exact same (except
without png and jpeg support for gd). They both use trans_sid. What's
going on here? In the session path, the session is being created, and
information is being put into it, but when you go to another page, or
another session_start(), it's like the cookie isn't being sent to the
browser. What's going on?

-Michael
-- 
Michael Smith
[EMAIL PROTECTED]

"The great thing about democracy is that it gives 
every voter a chance to do something stupid." 
 -Art Spander


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] session problem solved.

2003-06-28 Thread anders thoresson
At some places, I was using $_SESSION['u_uname'] as variable name, at other 
$_SESSION['uname']. Changing to $_SESSION['uname'] through all my 
accesscontrol.php solved the problem. Now it works on my ISP's server.

Question is, though: Why does the faulty script work on my localhost? Next 
step is to try the script that work at my ISP's server at my localhost. ;-)

--
anders thoresson
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Session problem

2003-06-24 Thread Dan Joseph
Hi,

> I have a problem with php sessions. The following code works on my home PC
> but doesn't work on my office PC. What can be the problem?

Its possible you have cookies turned off on your office PC.

-Dan Joseph


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session problem

2003-06-24 Thread Karina S
Hello,

I have a problem with php sessions. The following code works on my home PC
but doesn't work on my office PC. What can be the problem?

Thanks!


I have 2 files:
file1.php:
session_stert();
$_SESSION['demo']="test";

and file2.php
session_start();
echo $_SESSION['demo'];

I use PHP 4.3.2.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session problem

2003-03-17 Thread shaun
silly me,

testing the query (echo $query;) was actually causing the problem!


"Pete James" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> You need to start the session at the beginning of the script, or use
> output buffering.
>
> Either:
>  session_start();
> require("...
> ...
>
> or
>
>  ob_start();
> require("...
> ...
>
> You're trying to output stuff to the screen (which implicitly sends the
> headers) then trying to send more headers by calling session_register()
> (which implicitly calls session_start() )
>
> HTH.
> Pete.
>
> shaun wrote:
> > Hi,
> >
> > I get the following error when using using the following script to
> > authenticate a user. The login form is inside a frameset, is this whats
> > causing th eproblem, and is there a way round this?
> >
> > Warning: Cannot send session cookie - headers already sent by (output
> > started at
/home/w/o/workmanagement/public_html/authenticate_user.php:12) in
> > /home/w/o/workmanagement/public_html/authenticate_user.php on line 35
> >
> > authenticate_user.php:
> >  > require("dbconnect.php");
> >
> > // Assume user is not authenticated
> > $auth = false;
> >
> > // Formulate the query
> > $query = "SELECT * FROM WMS_User WHERE
> >   User_Username = '$_POST[username]' AND
> >   User_Password = '$_POST[password]'";
> >
> > echo $query;
> >
> > // Execute the query and put results in $result
> > $result = mysql_query( $query )
> >   or die ( 'Unable to execute query.' );
> >
> > // Get number of rows in $result.
> > $num = mysql_numrows( $result );
> >
> > if ( $num != 0 ) {
> >
> >  // A matching row was found - the user is authenticated.
> >  $auth = true;
> >
> >  //get the data for the session variables
> >  $suser_name   = mysql_result($result, 0, "User_Name");
> >  $suser_password = mysql_result($result, 0, "User_Password");
> >  $stype_level   = mysql_result($result, 0, "User_Type");
> >
> >  $ses_name  = $suser_name;
> >  $ses_pass  = $suser_password;
> >  $ses_level = $stype_level;
> >
> >  session_register("ses_name"); //this is line 35
> >  session_register("ses_pass");
> >  session_register("ses_level");
> > }
> >
> > //if user isn't authenticated redirect to appropriate page
> > if ( ! $auth ) {
> > include("login.php");
> >  exit;
> > }
> >
> > //if user is authenticated, include the main menu
> > else{
> >  include("home.php");
> > }
> >
> > //close connection
> > mysql_close();
> > ?>
> >
> > Thanks in as=dvance for your help
> >
> >
> >
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session problem

2003-03-17 Thread Pete James
You need to start the session at the beginning of the script, or use 
output buffering.

Either:

or


You're trying to output stuff to the screen (which implicitly sends the 
headers) then trying to send more headers by calling session_register() 
(which implicitly calls session_start() )

HTH.
Pete.
shaun wrote:
Hi,

I get the following error when using using the following script to
authenticate a user. The login form is inside a frameset, is this whats
causing th eproblem, and is there a way round this?
Warning: Cannot send session cookie - headers already sent by (output
started at /home/w/o/workmanagement/public_html/authenticate_user.php:12) in
/home/w/o/workmanagement/public_html/authenticate_user.php on line 35
authenticate_user.php:

// Assume user is not authenticated
$auth = false;
// Formulate the query
$query = "SELECT * FROM WMS_User WHERE
  User_Username = '$_POST[username]' AND
  User_Password = '$_POST[password]'";
echo $query;

// Execute the query and put results in $result
$result = mysql_query( $query )
  or die ( 'Unable to execute query.' );
// Get number of rows in $result.
$num = mysql_numrows( $result );
if ( $num != 0 ) {

 // A matching row was found - the user is authenticated.
 $auth = true;
 //get the data for the session variables
 $suser_name   = mysql_result($result, 0, "User_Name");
 $suser_password = mysql_result($result, 0, "User_Password");
 $stype_level   = mysql_result($result, 0, "User_Type");
 $ses_name  = $suser_name;
 $ses_pass  = $suser_password;
 $ses_level = $stype_level;
 session_register("ses_name"); //this is line 35
 session_register("ses_pass");
 session_register("ses_level");
}
//if user isn't authenticated redirect to appropriate page
if ( ! $auth ) {
include("login.php");
 exit;
}
//if user is authenticated, include the main menu
else{
 include("home.php");
}
//close connection
mysql_close();
?>
Thanks in as=dvance for your help





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Session problem

2003-03-17 Thread shaun
Hi,

I get the following error when using using the following script to
authenticate a user. The login form is inside a frameset, is this whats
causing th eproblem, and is there a way round this?

Warning: Cannot send session cookie - headers already sent by (output
started at /home/w/o/workmanagement/public_html/authenticate_user.php:12) in
/home/w/o/workmanagement/public_html/authenticate_user.php on line 35

authenticate_user.php:


Thanks in as=dvance for your help



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session Problem

2003-01-15 Thread Matt
>- Original Message - 
>From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Subject: [PHP] Session Problem


> Can some one pl  explain what this means ...
> Warning: Cannot send session cache limiter - headers already sent 
> (output started at /Users/pgarcha/Sites/edit.php:7) in 
> /Users/pgarcha/Sites/edit.php on line 8

Take a look here for an explanation: http://www.php-faq.com/#3


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Session Problem

2003-01-15 Thread janet
In a message dated 1/15/2003 4:18:10 PM Pacific Standard Time,
[EMAIL PROTECTED] writes:


>I am trying to make use of sessions to auhenticate users on the secure 
>parts of the website.  Things seems to work fine...but I keep getting 
>this warning. Can some one pl  explain what this means ...
>Warning: Cannot send session cache limiter - headers already sent 
>(output started at /Users/pgarcha/Sites/edit.php:7) in 
>/Users/pgarcha/Sites/edit.php on line 8

Headers must be sent before any other output is sent. This message is telling
you that some output was sent on line 7, so now it can't send a header (like
for a session) on line 8. You need to open your session before you send any
output. Sometimes the output is just a blank space or blank line before the
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




  1   2   3   >