[PHP] Re: sessions don't work

2002-08-16 Thread Ryan

May be the session is diable in the php.ini

Félix garcía renedo wrote:
> Hello,
> I have a problem with php sessions. 
> I have a php file like:
> 
>  session_start();
> session_register('pagina');
> ?>
> 
> 
> ...
> 
> 
>  include('file');
> ?>
> ...
> 
> 
> I have done diferent proofs and I have seen that the problem is that when I put 
>include don't work sessions and if I left session it works. When I put all together 
>it prints in the browser the code from "" to "reload the page it works properly. But I haven't found the way to do it automaticaly.
> 
> Are there somebody who knows how to fix it?
> 
> 
> Thanks.
> 
> 
> 
> Un saludo.
> 


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




[PHP] RE: sessions don't work

2002-08-16 Thread Tim Ward

why do you think the session isn't working? If there is a run time error in
'file' then an error would be reported and the output terminated. If you
have error reporting off then you would expect to get eactly what you see.
Sounds like a problem inside 'file'.


Tim Ward
St Ives Direct

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html 



> -Original Message-
> From: Félix García Renedo [mailto:[EMAIL PROTECTED]]
> Sent: 16 August 2002 08:51
> To: php
> Subject: sessions don't work 
> 
> 
> Hello,
> I have a problem with php sessions. 
> I have a php file like:
> 
>  session_start();
> session_register('pagina');
> ?>
> 
> 
> ...
> 
> 
>  include('file');
> ?>
> ...
> 
> 
> I have done diferent proofs and I have seen that the problem 
> is that when I put include don't work sessions and if I left 
> session it works. When I put all together it prints in the 
> browser the code from "" to " If I reload the page it works properly. But I haven't found 
> the way to do it automaticaly.
> 
> Are there somebody who knows how to fix it?
> 
> 
> Thanks.
> 
> 
> 
> Un saludo.
> 

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




[PHP] Re: Sessions don't work?

2002-07-24 Thread Lord Loh.

>From the PHP docs...
=


Hello visitor, you have seen this page  times.;

 is necessary to preserve the session id
# in the case that the user has disabled cookies
?>

To continue, click here




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




[PHP] Re: Sessions don't work?

2002-07-24 Thread Mike Mannakee

Your problem is very simple.  You're beginning a new session every
execution, without checking if a session is already going.  So every time it
comes back around it's looking for the variables in the current session,
which every time just began.

Check for an existing session first like:

if(!(session_id()))
session_start();

Mike Mannakee


"Alexander Deruwe" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'd like to post a follow-up to my previous message on this subject.
> Please still CC me when replying, thanks.
>
> New test code:
>
> "
>session_start();
>
>  if (!isset($HTTP_SESSION_VARS['counter'])) {
>  $HTTP_SESSION_VARS['counter'] = 1;
>  } else {
>  $HTTP_SESSION_VARS['counter']++;
>  }
>
>  if (!isset($counter2)) {
>  session_register('counter2');
>  $counter2 = 1;
>  } else {
>  $counter2++;
>  }
>
>  if (!isset($_SESSION['counter3'])) {
>  $_SESSION['counter3'] = 1;
>  } else {
>  $_SESSION['counter3']++;
>  }
>
>  echo(sprintf("You have visited this page %d times!",
$HTTP_SESSION_VARS['counter']) . "");
>  echo(sprintf("You have visited this page %d times!", $counter2) .
"");
>  echo(sprintf("You have visited this page %d times!",
$_SESSION['counter3']) . "");
>  ?>
> "
>
> Tried these on PHP 4.0.6 (register_globals = On):
> - counter: doesn't work
> - counter1: works
> - counter2: doesn't work (to be expected)
>
> PHP 4.2.2 (register_globals = Off):
> None of the counters work; same when register_globals = On
>
> I'm really puzzled by this; could someone please point me in the right
> direction?
>
> --
> Alexander Deruwe
> AQS-CarControl



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




[PHP] Re: Sessions don't work?

2002-07-24 Thread Alexander Deruwe

I'd like to post a follow-up to my previous message on this subject.
Please still CC me when replying, thanks.

New test code:

"
 ");
 echo(sprintf("You have visited this page %d times!", $counter2) . "");
 echo(sprintf("You have visited this page %d times!", $_SESSION['counter3']) . "");
 ?>
"

Tried these on PHP 4.0.6 (register_globals = On):
- counter: doesn't work
- counter1: works
- counter2: doesn't work (to be expected)

PHP 4.2.2 (register_globals = Off):
None of the counters work; same when register_globals = On

I'm really puzzled by this; could someone please point me in the right
direction?

-- 
Alexander Deruwe
AQS-CarControl

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