Re: [PHP] session variables

2004-06-01 Thread John W. Holmes
Bob Lockie wrote:
$_SESSION['new_name'] = $_REQUEST['new_name'];
Is not global.
I printed out the value locally but it is not made into a session variable.
Yes, it is. Providing you have sessions configured correctly and use 
session_start().

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session variables

2004-06-01 Thread Bob Lockie
On 06/01/04 22:12 John Nichel spoke:
Bob Lockie wrote:
$_SESSION['new_name'] = $_REQUEST['new_name'];
Is not global.
I printed out the value locally but it is not made into a session 
variable.

Did you start the session before you set $_SESSION['new_name']?
That was my problem.
I reorganized and put some code in a file that didn't have a 
session_start() call. :-(

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


[PHP] Session variables not recognized?

2004-05-25 Thread Brian Dunning
The first line of my file is session_start(); but whenever I try to set 
or reference $_SESSION['anything'] I get:

 Undefined variable: _SESSION
What's up with that???
- Brian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Session variables not recognized?

2004-05-25 Thread Daniel Clark
Session handling was added in PHP 4.0. 

The first line of my file is session_start(); but whenever I try to set 
or reference $_SESSION['anything'] I get:

  Undefined variable: _SESSION

What's up with that???

- Brian

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



Re: [PHP] Session variables not recognized?

2004-05-25 Thread Brian Dunning
This is 4.3.2 and sessions are enabled.
Session handling was added in PHP 4.0.
The first line of my file is session_start(); but whenever I try to 
set
or reference $_SESSION['anything'] I get:

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


Re: [PHP] Session variables not recognized?

2004-05-25 Thread John Nichel
Brian Dunning wrote:
This is 4.3.2 and sessions are enabled.
Session handling was added in PHP 4.0.
The first line of my file is session_start(); but whenever I try to set
or reference $_SESSION['anything'] I get:
 Undefined variable: _SESSION

- Brian
Post some code.
--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Session variables not working

2004-05-15 Thread Andrew Wood
If a page accesses the session variables does it need to explicity 
reset them as well because it would appear that an intermediate PHP 
script which also reads the 2 variables is destroying the session for 
no apparent reason


On 14 May 2004, at 22:11, Brad Pauly wrote:
On Fri, 2004-05-14 at 14:48, Andrew Wood wrote:
I'm trying to set the following two vars on one page then read their
values on another like this:
page1.php...
ob_start();
session_start();
  $_SESSION['member_id'] = $member_id;
  $_SESSION['password'] = $password;
ob_end_flush();
Where are $member_id and $password coming from?
page2.php...
ob_start();
session_start();
  $member_id = $_SESSION['member_id'];
  $password $_SESSION['password'];
ob_end_flush();
I think you want $password = $_SESSION['password'];
But on page2.php the variables are null.  Can anyone help me out with
this. I must be doing something really obvious wrong.
Where are you outputting the variables to see what they are? You might
want to add a print_r($_SESSION) to see what is there. The ob_*
functions don't cause any output of variables, they only output what 
you
output within them (if that makes sense). For example:

ob_start();
  echo 'Hi';
ob_end_flush();
- Brad
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Session variables not working

2004-05-14 Thread Andrew Wood
I'm trying to set the following two vars on one page then read their 
values on another like this:

page1.php...

ob_start();
session_start();
 $_SESSION['member_id'] = $member_id;
 $_SESSION['password'] = $password;
ob_end_flush();
page2.php...

ob_start();
session_start();
 $member_id = $_SESSION['member_id'];
 $password $_SESSION['password'];
ob_end_flush();
But on page2.php the variables are null.  Can anyone help me out with 
this. I must be doing something really obvious wrong.

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


Re: [PHP] Session variables not working

2004-05-14 Thread John W. Holmes

- Original Message - 
From: Andrew Wood [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, May 14, 2004 4:48 PM
Subject: [PHP] Session variables not working


 I'm trying to set the following two vars on one page then read their
 values on another like this:
[snip]
 But on page2.php the variables are null.  Can anyone help me out with
 this. I must be doing something really obvious wrong.

How are you getting from page 1 to page 2? Is a session cookie being set?
Are page 1 and page 2 on the same domain? Do you see a PHPSESSID in the URL?

---John Holmes...

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



Re: [PHP] Session variables not working

2004-05-14 Thread Andrew Wood
Using a cookie which is shown in my browser as PHPSESSID

Yes they're on the same domain but no there's nothing being passed 
accross the URL.  Should there be?

AW

On 14 May 2004, at 21:59, John W. Holmes wrote:

- Original Message -
From: Andrew Wood [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, May 14, 2004 4:48 PM
Subject: [PHP] Session variables not working

I'm trying to set the following two vars on one page then read their
values on another like this:
[snip]
But on page2.php the variables are null.  Can anyone help me out with
this. I must be doing something really obvious wrong.
How are you getting from page 1 to page 2? Is a session cookie being 
set?
Are page 1 and page 2 on the same domain? Do you see a PHPSESSID in 
the URL?

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


Re: [PHP] Session variables not working

2004-05-14 Thread John W. Holmes
From: Andrew Wood [EMAIL PROTECTED]

 Using a cookie which is shown in my browser as PHPSESSID

 Yes they're on the same domain but no there's nothing being passed
 accross the URL.  Should there be?

No, not normally. How are you getting from page 1 to page 2?

 page1.php...

 ob_start();
 session_start();
   $_SESSION['member_id'] = $member_id;
   $_SESSION['password'] = $password;
 ob_end_flush();


 page2.php...

 ob_start();
 session_start();
   $member_id = $_SESSION['member_id'];
   $password $_SESSION['password'];
 ob_end_flush();

What's with the output buffering functions? Are you sure $member_id and
$password have a value in the first script? I assume there is more code to
this, or no?

---John Holmes...

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



Re: [PHP] Session variables not working

2004-05-14 Thread Brad Pauly
On Fri, 2004-05-14 at 14:48, Andrew Wood wrote:
 I'm trying to set the following two vars on one page then read their 
 values on another like this:
 
 page1.php...
 
 ob_start();
 session_start();
   $_SESSION['member_id'] = $member_id;
   $_SESSION['password'] = $password;
 ob_end_flush();

Where are $member_id and $password coming from?

 page2.php...
 
 ob_start();
 session_start();
   $member_id = $_SESSION['member_id'];
   $password $_SESSION['password'];
 ob_end_flush();

I think you want $password = $_SESSION['password'];

 But on page2.php the variables are null.  Can anyone help me out with 
 this. I must be doing something really obvious wrong.

Where are you outputting the variables to see what they are? You might
want to add a print_r($_SESSION) to see what is there. The ob_*
functions don't cause any output of variables, they only output what you
output within them (if that makes sense). For example:

ob_start();
  echo 'Hi';
ob_end_flush();

- Brad

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



Re: [PHP] Session variables not working

2004-05-14 Thread Andrew Wood
Either typing the URL directly or by using a hyperlink.

On 14 May 2004, at 22:09, John W. Holmes wrote:

From: Andrew Wood [EMAIL PROTECTED]

Using a cookie which is shown in my browser as PHPSESSID

Yes they're on the same domain but no there's nothing being passed
accross the URL.  Should there be?
No, not normally. How are you getting from page 1 to page 2?

page1.php...

ob_start();
session_start();
  $_SESSION['member_id'] = $member_id;
  $_SESSION['password'] = $password;
ob_end_flush();
page2.php...

ob_start();
session_start();
  $member_id = $_SESSION['member_id'];
  $password $_SESSION['password'];
ob_end_flush();
What's with the output buffering functions? Are you sure $member_id and
$password have a value in the first script? I assume there is more 
code to
this, or no?

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


[PHP] session variables

2004-04-20 Thread Charles Collins
I have two test files running on a server, which is giving me a headache,
due to the fact the session variables are not been maintained across the two
pages.

The server is running ...

PHP Version  = 4.0.5
register_globals = ON
Session Support = Enabled
session.auto_start = Off
session.cache_expire =  180
session.cache_limiter = nocache
session.cookie_domain = inweb.net.uk
session.cookie_lifetime = 600
session.cookie_path =  /
session.cookie_secure = Off
session.entropy_file = no value
session.entropy_length = 0
session.gc_maxlifetime = 1440
session.gc_probability = 1
session.name = PHPSESSID
session.referer_check = no value
session.save_handler = files
session.save_path = /tmp
session.serialize_handler php
session.use_cookies = On

The two script files are as follows: -

Page #1:

?
 session_start();
 session_register(test);
 $test = Hullo World;
 print $test; // prints test
?

Page # 2

?
 session_start();
 print $test;// prints nothing, zip!
?

Can anyone tell me where I'm going wrong, works fine of test servers, etc.,
only screwed up when site was lauched.

Thanks in advance ...

Regards
Charlie.

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



RE: [PHP] session variables

2004-04-20 Thread Vincent DUPONT
I would do
script 1 :
$_SESSION['test'] = hello world;

and in script2 :
print($_SESSION['test']);


vincent

-Original Message-
From: Charles Collins [mailto:[EMAIL PROTECTED]
Sent: mardi 20 avril 2004 17:44
To: [EMAIL PROTECTED]
Subject: [PHP] session variables


I have two test files running on a server, which is giving me a headache,
due to the fact the session variables are not been maintained across the two
pages.

The server is running ...

PHP Version  = 4.0.5
register_globals = ON
Session Support = Enabled
session.auto_start = Off
session.cache_expire =  180
session.cache_limiter = nocache
session.cookie_domain = inweb.net.uk
session.cookie_lifetime = 600
session.cookie_path =  /
session.cookie_secure = Off
session.entropy_file = no value
session.entropy_length = 0
session.gc_maxlifetime = 1440
session.gc_probability = 1
session.name = PHPSESSID
session.referer_check = no value
session.save_handler = files
session.save_path = /tmp
session.serialize_handler php
session.use_cookies = On

The two script files are as follows: -

Page #1:

?
 session_start();
 session_register(test);
 $test = Hullo World;
 print $test; // prints test
?

Page # 2

?
 session_start();
 print $test;// prints nothing, zip!
?

Can anyone tell me where I'm going wrong, works fine of test servers, etc.,
only screwed up when site was lauched.

Thanks in advance ...

Regards
Charlie.

-- 
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 variables

2004-04-20 Thread Charles Collins
Dear Vincent,

Tried that as well as $HTTP_SERVER_VARS, $_SESSION, etc., still cannot get
the damn thing working.

Regards,
Charlie.

Vincent Dupont [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I would do
script 1 :
$_SESSION['test'] = hello world;

and in script2 :
print($_SESSION['test']);


vincent

-Original Message-
From: Charles Collins [mailto:[EMAIL PROTECTED]
Sent: mardi 20 avril 2004 17:44
To: [EMAIL PROTECTED]
Subject: [PHP] session variables


I have two test files running on a server, which is giving me a headache,
due to the fact the session variables are not been maintained across the two
pages.

The server is running ...

PHP Version  = 4.0.5
register_globals = ON
Session Support = Enabled
session.auto_start = Off
session.cache_expire =  180
session.cache_limiter = nocache
session.cookie_domain = inweb.net.uk
session.cookie_lifetime = 600
session.cookie_path =  /
session.cookie_secure = Off
session.entropy_file = no value
session.entropy_length = 0
session.gc_maxlifetime = 1440
session.gc_probability = 1
session.name = PHPSESSID
session.referer_check = no value
session.save_handler = files
session.save_path = /tmp
session.serialize_handler php
session.use_cookies = On

The two script files are as follows: -

Page #1:

?
 session_start();
 session_register(test);
 $test = Hullo World;
 print $test; // prints test
?

Page # 2

?
 session_start();
 print $test;// prints nothing, zip!
?

Can anyone tell me where I'm going wrong, works fine of test servers, etc.,
only screwed up when site was lauched.

Thanks in advance ...

Regards
Charlie.

--
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 variables

2004-04-20 Thread Daniel Clark
hum.  Try $_SESSION['test'] on page 2.

 I have two test files running on a server, which is giving me a headache,
 due to the fact the session variables are not been maintained across the
 two
 pages.

 The server is running ...

 PHP Version  = 4.0.5
 register_globals = ON
 Session Support = Enabled
 session.auto_start = Off
 session.cache_expire =  180
 session.cache_limiter = nocache
 session.cookie_domain = inweb.net.uk
 session.cookie_lifetime = 600
 session.cookie_path =  /
 session.cookie_secure = Off
 session.entropy_file = no value
 session.entropy_length = 0
 session.gc_maxlifetime = 1440
 session.gc_probability = 1
 session.name = PHPSESSID
 session.referer_check = no value
 session.save_handler = files
 session.save_path = /tmp
 session.serialize_handler php
 session.use_cookies = On

 The two script files are as follows: -

 Page #1:

 ?
  session_start();
  session_register(test);
  $test = Hullo World;
  print $test; // prints test
 ?

 Page # 2

 ?
  session_start();
  print $test;// prints nothing, zip!
 ?

 Can anyone tell me where I'm going wrong, works fine of test servers,
 etc.,
 only screwed up when site was lauched.

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



Re: [PHP] session variables

2004-04-20 Thread Daniel Clark
Does page1 call page2?
Or do you open another browser window and open page2?

My understanding is some browsers to NOT transfer the same session info to
another borwser window.

 Tried that as well as $HTTP_SERVER_VARS, $_SESSION, etc., still cannot get
 the damn thing working.

 Regards,
 Charlie.

 Vincent Dupont [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 I would do
 script 1 :
 $_SESSION['test'] = hello world;

 and in script2 :
 print($_SESSION['test']);


 vincent

 -Original Message-
 From: Charles Collins [mailto:[EMAIL PROTECTED]
 Sent: mardi 20 avril 2004 17:44
 To: [EMAIL PROTECTED]
 Subject: [PHP] session variables


 I have two test files running on a server, which is giving me a headache,
 due to the fact the session variables are not been maintained across the
 two
 pages.

 The server is running ...

 PHP Version  = 4.0.5
 register_globals = ON
 Session Support = Enabled
 session.auto_start = Off
 session.cache_expire =  180
 session.cache_limiter = nocache
 session.cookie_domain = inweb.net.uk
 session.cookie_lifetime = 600
 session.cookie_path =  /
 session.cookie_secure = Off
 session.entropy_file = no value
 session.entropy_length = 0
 session.gc_maxlifetime = 1440
 session.gc_probability = 1
 session.name = PHPSESSID
 session.referer_check = no value
 session.save_handler = files
 session.save_path = /tmp
 session.serialize_handler php
 session.use_cookies = On

 The two script files are as follows: -

 Page #1:

 ?
  session_start();
  session_register(test);
  $test = Hullo World;
  print $test; // prints test
 ?

 Page # 2

 ?
  session_start();
  print $test;// prints nothing, zip!
 ?

 Can anyone tell me where I'm going wrong, works fine of test servers,
 etc.,
 only screwed up when site was lauched.

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



Re: [PHP] session variables

2004-04-20 Thread Curt Zirzow
* Thus wrote Charles Collins ([EMAIL PROTECTED]):
 I have two test files running on a server, which is giving me a headache,
 due to the fact the session variables are not been maintained across the two
 pages.
 
 The server is running ...
 
 PHP Version  = 4.0.5
 register_globals = ON
 Session Support = Enabled

This looks like output from 'php -i'. The php module *can* have a
different config, check these values from phpinfo() in  a webpage
in the same directory as your scripts with

 ...
 
 ?
  session_start();
  session_register(test);
  $test = Hullo World;
  print $test; // prints test
 ?
 
 Page # 2
 
 ?
  session_start();
  print $test;// prints nothing, zip!
 ?
I would strongly suggest using the $_SESSION variable, even if
register_globals is on, that way sessions work regardless of its
setting.

page 1:
session_start();
$test = $_SESSION['test'] = 'Hullo World';
echo $test;

page 2:
session_start();
$test = $_SESSION['test'];
echo $test;


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



Re: [PHP] session variables

2004-04-20 Thread Curt Zirzow
* Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
 This looks like output from 'php -i'. The php module *can* have a
 different config, check these values from phpinfo() in  a webpage
 in the same directory as your scripts with

I fired my proofreader so I have to do this manually now :)

s/ with/.


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



Re: [PHP] Session variables as array

2004-03-24 Thread John W. Holmes
Joseph Ross Lee wrote:

Hello... Is there any example that I can look at that does a session
variable as an array? thanks
session_start();
$_SESSION['somekey'] = 'somevalue';
$_SESSION['someotherkey'] = array('one','two','three','four');

$_SESSION['yetanother'] = 
array(array('one','two','three'),array(1,2,3),array('foo','bar','blah'));

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


[PHP] Session variables as array

2004-03-23 Thread Joseph Ross Lee
Hello... Is there any example that I can look at that does a session
variable as an array? thanks

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



RE: [PHP] SESSION VARIABLES

2004-02-10 Thread Adam Bregenzer
On Tue, 2004-02-10 at 02:45, Ronald Ramos wrote:
 $_SESSION['username'];
 $_SESSION['password'];

Close, try this instead:
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;

 I edited page3.php but it still shows me nothing.

It looks great, now you just need to clear up your use of the $_SESSION
variable in page2.php.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



RE: [PHP] SESSION VARIABLES

2004-02-10 Thread Adam Bregenzer
On Tue, 2004-02-10 at 03:13, Ronald Ramos wrote:
 It Worked. Thanks Man!
 So I can use this to any other page?

Awesome!  You have access to the $_SESSION variables on any php page on
the same server.  Just make sure you call session_start() before you
access the $_SESSION array.

 Let's say I have two users, first one logged in, using ronald as
 username, while user ronald is still logged-in
 User nhadie also logged-in from somewhere, will the value of $username
 of user ronald be changed to nhadie?

No, with sessions there will essentially be multiple values for the
variables, one for each session.  When a user requests a page their
session id will be used to set the correct values in the $_SESSION
array.  For example, when ronald loads the page $_SESSION['username']
will be ronald.  When nhadie loads the page the $_SESSION['username']
variable will be nahdie.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



[PHP] SESSION VARIABLES

2004-02-09 Thread Ronald Ramos
Hi All,

I've created 3 sample scripts, pls see below.
My problem is that page3.php can't display the value $username and
$password
Or is it because it the variables were not importe to that page, that's
why
$username and $password has no value? If it is, how can I import it?

Thank you

- login.php -

html

body

form method=POST action=auth.php
  p
  USERNAME: input type=text name=uname size=20/p
  pPASSWORD: input type=password name=passwd size=20/p
  pinput type=submit value=Login name=login/p
/form
/body

/html


-- auth.php -

?php

$username = $_POST[uname];
$password = $_POST[passwd];

session_start();

if ($username == ronald AND $password == ronald) {

session_register(username);
session_register(password);

echohtml

head
script language=\javascript\

function bukas() {
window.open(\page3.php\,\_new\);
};
/script
/head
body onload=\bukas();\
p$username
/body
/html;
}

else {
echo INVALID, TRY AGAIN;
};
?

--- page3.php --

?php

echo $username;
echo #password;

?

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



Re: [PHP] SESSION VARIABLES

2004-02-09 Thread Adam Bregenzer
On Tue, 2004-02-10 at 00:43, Ronald Ramos wrote:
 Hi All,
 
 I've created 3 sample scripts, pls see below.
 My problem is that page3.php can't display the value $username and
 $password
 Or is it because it the variables were not importe to that page, that's
 why
 $username and $password has no value? If it is, how can I import it?

You need to have session_start() at the top of the third script as
well.  Also you have a typo:
 echo #password;

should be:
echo $password;

Consider using $_SESSION[1] instead of session_register[2].

[1] http://www.php.net/reserved.variables#reserved.variables.session
[2] http://www.php.net/session_register

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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



[PHP] session variables

2004-01-22 Thread Diana Castillo
If you store session variables , but the user has session cookies disabled,
is there any way to recuperate those session variables?


--
--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com

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



Re: [PHP] session variables

2004-01-22 Thread Matt Matijevich
snip
If you store session variables , but the user has session cookies
disabled,
is there any way to recuperate those session variables?
/snip

Yes, look at the  session.use_trans_sid variable.

http://www.php.net/session 

If cookies are disabled, php will pass the session id as a ur variable
or a hidden field.

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



Re: [PHP] session variables

2004-01-22 Thread John Nichel
Diana Castillo wrote:

If you store session variables , but the user has session cookies disabled,
is there any way to recuperate those session variables?
--
--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com
Session variables are stored on the web server.  A session cookie is 
used to carry the session id from page to page.  If the user has cookies 
disabled, the session can be passed in the URL.

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

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] session variables

2004-01-22 Thread Chris Shiflett
--- Diana Castillo [EMAIL PROTECTED] wrote:
 If you store session variables , but the user has session cookies
 disabled, is there any way to recuperate those session variables?

Cookies come in two types: session cookies and persistent cookies. Session
cookies have no set expiration date, so they expire as soon as the browser
session ends. Persistent cookies don't expire until the date indicated,
and this often involves persisting them in a file (cookies.txt, for
example).

So, I think you just mean to ask how to make sessions work when the user
has disabled cookies. Cookies are only used to propagate the session
identifier, so you don't lose session data. At worst, you would just be
unable to identify the user on the next request.

PHP handles this last potential problem for you with the
session.use_trans_sid php.ini directive. This will rewrite your URLs (in
links and such) to include the session identifier, and PHP will
automatically check both for the bookie and the URL variable. So, you will
probably not need to do anything special.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



[PHP] Session Variables Disappear and Reappear

2003-12-29 Thread Jerry Kita
New to PHP and I've checked previous posts and haven't seen similar problem.
Any ideas would be appreciated.

Have encounted an odd problem. Using session variables to allow users to log
in and out of my site. I've created a test system on my laptop. Apache
2.0.48,
PHP 4.3.4, MySQL and Windows 2000. On my test system everything works
perfectly. Sessions are created and maintained as long as the browser is
open.
I can also destroy sessions.

However when I load everything up to my site via FTP the results are very
sporadic. Sessions seem to drop and reappear. While a user is logged in I
display a Logged in as: X message at the top of the page. I can
continually refresh the page and occassionally the Logged in as X
message will disappear showing the Please Login Form. If I refresh again
(without logging in) the page shows the user is again Logged in.

Here's the script that I use to log users in:

?php
error_reporting (E_ALL ^ E_NOTICE);
//check for required fields from the form
if ((!$_POST[userid]) || (!$_POST[password])) {
header(Location: Salkehatchie_Home.php);
exit;
}
session_start();
//connect to server and select database
$conn = mysql_connect(x.x.x.x, xx, x) or
die(mysql_error());
//echo Connection is $conn br;
mysql_select_db(xx_salkehatchie,$conn)  or die(mysql_error());
//create and issue the query
$sql = select userid, password, privs from userlist where userid =
'$_POST[userid]' AND password = '$_POST[password]';
//echo USERID is $_POST[userid]br;
//echo PASSWORD is $_POST[password]br;
//echo SQL is $sqlbr;
$result = mysql_query($sql,$conn) or die(mysql_error());
//echo Result is $resultbr;
$rows = mysql_num_rows($result);
//echo Number of Rows are $rowsbr;
//get the number of rows in the result set; should be 1 if a match
if (mysql_num_rows($result) == 1) {
   //if authorized, get the values set the $_SESSION Variables -- userid,
password and privs
   $_SESSION[userid] = $_POST[userid];
   $_SESSION[password] = $_POST[password];
   $_SESSION[privs] = mysql_result($result, 0, 'privs');
   //Direct user to members page
   header(Location: Salkehatchie_Members_Home.php);
   exit;
   } else {
   //redirect back to login form if not authorized
   header(Location: Salkehatchie_Home.php);
   exit;
}
?

I start off each webpage with the following script:

?php
//Check for existence of Valid Login ID
error_reporting (E_ALL ^ E_NOTICE);
header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);
header(Expires:  . gmdate(D, d M Y H:i:s) .  GMT);
header(Cache-Control: no-store, no-cache, must-revalidate );
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);
session_start();
if (isset($_SESSION[userid])) {
   $validlogon = YES;
   } else {
   $validlogon = NO;
   }
echo $validlogon   //test to see if user has previously logged on

This all works perfectly on my test system but creates problems at my site.
If anyone would like to see this for themselves go to the following site:

http://www.salkehatchiehuntersville.com/Salkehatchie_Home.php

and log in using test/test as userid/password. When logged in go back to the
home page and then continually refresh that page. You will see that that the
user moves in and out of a logged in status. This will also show up on other
pages but since this site is under construction it's safest to stick to the
HOME page.

Other possibly helpful information. Web Hosting site is BlueDomino.

Thanks for your help.

Jerry Kita


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



[PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andy Higgins
Hello All,

I have been racking my head over a problem where a large percentage of users
are unable to log into my php site due to what seems to be a problem with
setting php session variables on certain end user browsers (certain versions
of AOL seem to be particularly problematic). Below are some snippets of code
that are used to do the authentication/ login.

Has anyone encountered the same problem and if so do you have a solution?
The only solution I can think of is to pass the session using PHPSESSION in
the URL however I would like to avoid this if at all possible as it involves
a major re-write of the code (as session variables are used elsewhere in the
session) and if I am not mistaken if a user accesses a non-php page then the
session is lost requiring them to log in again.

Currently the following code is used to check whether a user is logged in:

?php

$notAuthenticated = !isset($HTTP_SESSION_VARS['authenticatedUser']);

$notLoginIp = isset($HTTP_SESSION_VARS['loginIpAddress']) 
($HTTP_SESSION_VARS['loginIpAddress'] != $_SERVER[REMOTE_ADDR]);

if ($notAuthenticated || $notLoginIp) {

 if (!session_is_registered(targetURL))
   session_register(targetURL);

 $HTTP_SESSION_VARS['targetURL'] = $_SERVER[REQUEST_URI];

 header(Location: /smartbid/php/Login.php);

}

?

And in Login.php after doing a check on the username and password the
following session variables are set:

   session_start();

   session_register(authenticatedUser);
   $HTTP_SESSION_VARS['authenticatedUser'] = $userId;

   session_register(loginIpAddress);
   $HTTP_SESSION_VARS['loginIpAddress'] = $_SERVER[REMOTE_ADDR];

It is the setting of the above session variables in Login.php that appears
to be failing for some browsers resulting in users using these browsers
continually being redirected to the Login page when the above check to see
if they are logged in is done.

Any help that could be supplied would be greatly appreciated.

Thank you.

Regards,
Andy


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



RE: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andras Kende
-Original Message-
From: Andy Higgins [mailto:[EMAIL PROTECTED] 
Sent: Saturday, December 27, 2003 6:04 AM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Session Variables Not Being Set For Certain Browsers

Hello All,

I have been racking my head over a problem where a large percentage of users
are unable to log into my php site due to what seems to be a problem with
setting php session variables on certain end user browsers (certain versions
of AOL seem to be particularly problematic). Below are some snippets of code
that are used to do the authentication/ login.

Has anyone encountered the same problem and if so do you have a solution?
The only solution I can think of is to pass the session using PHPSESSION in
the URL however I would like to avoid this if at all possible as it involves
a major re-write of the code (as session variables are used elsewhere in the
session) and if I am not mistaken if a user accesses a non-php page then the
session is lost requiring them to log in again.

Currently the following code is used to check whether a user is logged in:

?php

$notAuthenticated = !isset($HTTP_SESSION_VARS['authenticatedUser']);

$notLoginIp = isset($HTTP_SESSION_VARS['loginIpAddress']) 
($HTTP_SESSION_VARS['loginIpAddress'] != $_SERVER[REMOTE_ADDR]);

if ($notAuthenticated || $notLoginIp) {

 if (!session_is_registered(targetURL))
   session_register(targetURL);

 $HTTP_SESSION_VARS['targetURL'] = $_SERVER[REQUEST_URI];

 header(Location: /smartbid/php/Login.php);

}

?

And in Login.php after doing a check on the username and password the
following session variables are set:

   session_start();

   session_register(authenticatedUser);
   $HTTP_SESSION_VARS['authenticatedUser'] = $userId;

   session_register(loginIpAddress);
   $HTTP_SESSION_VARS['loginIpAddress'] = $_SERVER[REMOTE_ADDR];

It is the setting of the above session variables in Login.php that appears
to be failing for some browsers resulting in users using these browsers
continually being redirected to the Login page when the above check to see
if they are logged in is done.

Any help that could be supplied would be greatly appreciated.

Thank you.

Regards,
Andy



-

Andy,

Not sure, but maybe AOL users on proxy and their ip address can change.

Andras Kende
http://www.kende.com

-







-- 
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] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andy Higgins
Hi Andras,

Yes, good point Thank you. It could be that the IP address of the user is
changing on each HTTP request that is made, which would explain the problem
(although that does seem quite odd). Can anyone confirm whether AOL (or any
other ISPs for that matter) change a user's IP address as seen by the web
server (for eample through a proxy) within the same session?

Assuming that the above is the problem, does any one know whether by
removing the check in the authentication to see whether the user is using
the same IP address as they logged in with comprises the security of the
login i.e. will it be possible for some one to hijack the login if this
check is not there? Or does anyone have any other suggesstions for doing
authentication?

Thank you.

Regards,
Andy

Andras Kende [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 -Original Message-
 From: Andy Higgins [mailto:[EMAIL PROTECTED]
 Sent: Saturday, December 27, 2003 6:04 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP Session Variables Not Being Set For Certain Browsers

 Hello All,

 I have been racking my head over a problem where a large percentage of
users
 are unable to log into my php site due to what seems to be a problem with
 setting php session variables on certain end user browsers (certain
versions
 of AOL seem to be particularly problematic). Below are some snippets of
code
 that are used to do the authentication/ login.

 Has anyone encountered the same problem and if so do you have a solution?
 The only solution I can think of is to pass the session using PHPSESSION
in
 the URL however I would like to avoid this if at all possible as it
involves
 a major re-write of the code (as session variables are used elsewhere in
the
 session) and if I am not mistaken if a user accesses a non-php page then
the
 session is lost requiring them to log in again.

 Currently the following code is used to check whether a user is logged in:

 ?php

 $notAuthenticated = !isset($HTTP_SESSION_VARS['authenticatedUser']);

 $notLoginIp = isset($HTTP_SESSION_VARS['loginIpAddress']) 
 ($HTTP_SESSION_VARS['loginIpAddress'] != $_SERVER[REMOTE_ADDR]);

 if ($notAuthenticated || $notLoginIp) {

  if (!session_is_registered(targetURL))
session_register(targetURL);

  $HTTP_SESSION_VARS['targetURL'] = $_SERVER[REQUEST_URI];

  header(Location: /smartbid/php/Login.php);

 }

 ?

 And in Login.php after doing a check on the username and password the
 following session variables are set:

session_start();

session_register(authenticatedUser);
$HTTP_SESSION_VARS['authenticatedUser'] = $userId;

session_register(loginIpAddress);
$HTTP_SESSION_VARS['loginIpAddress'] = $_SERVER[REMOTE_ADDR];

 It is the setting of the above session variables in Login.php that appears
 to be failing for some browsers resulting in users using these browsers
 continually being redirected to the Login page when the above check to see
 if they are logged in is done.

 Any help that could be supplied would be greatly appreciated.

 Thank you.

 Regards,
 Andy



 -

 Andy,

 Not sure, but maybe AOL users on proxy and their ip address can
change.

 Andras Kende
 http://www.kende.com

 -







 --
 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] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Gerard Samuel
On Saturday 27 December 2003 07:03 am, Andy Higgins wrote:
 Hello All,

 I have been racking my head over a problem where a large percentage of
 users are unable to log into my php site due to what seems to be a problem
 with setting php session variables on certain end user browsers (certain
 versions of AOL seem to be particularly problematic). Below are some
 snippets of code that are used to do the authentication/ login.

 Has anyone encountered the same problem and if so do you have a solution?
 The only solution I can think of is to pass the session using PHPSESSION in
 the URL however I would like to avoid this if at all possible as it
 involves a major re-write of the code (as session variables are used
 elsewhere in the session) and if I am not mistaken if a user accesses a
 non-php page then the session is lost requiring them to log in again.


Im just putting the finishing touches to my code, that I had to rewrite for 
similar reasons as you.
You're going to have to include the session id in the url for those users who 
do not allow cookies.
Using this fact about the constant SID
a)  If the user's browser accepts cookies, SID will be empty 
b)  If the user's browser does not accept cookies, SID will be PHPSESSID=xxx

So what I did, was append the constant SID to all urls/forms and php header() 
(for redirection) functions that point to the site that is serving the 
content (dont append SID to urls going to other sites).

So the final results will be
a) If the user's browser accepts cookies, urls/forms/php header() will be 
normal
b)  If the user's browser does not accept cookies, the session id is appended 
to urls/forms/php header()

OR 

you can take the easy way out, and turn on transparent ids with -
http://us2.php.net/manual/en/
install.configure.php#install.configure.enable-trans-sid

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



Re: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andy Higgins
Hi  Gerard,

Thank you very much for the response. Please can you clarify the following:

1. At the time of login will the login code need to check if the clients
browser accepts cookies and if not then append the SID as described? If so,
do you perhaps have a sample piece of code that does this?
2. Am I correct in understanding that if the client has logged in (with no
cookies enabled i.e. the SID needs to be passed) and the site contains other
static pages (that cannot pass the SID) that if the client browses any of
these static pages and then returns to a page that required the client to be
logged that they will have to log in again?
3. For forms, where the SID need to be passed, do you pass this as a hidden
form variable or do you do it on the URL?

You help is greatly appreciated.

Thanks again.

Regards,
Andy


Gerard Samuel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Saturday 27 December 2003 07:03 am, Andy Higgins wrote:
  Hello All,
 
  I have been racking my head over a problem where a large percentage of
  users are unable to log into my php site due to what seems to be a
problem
  with setting php session variables on certain end user browsers (certain
  versions of AOL seem to be particularly problematic). Below are some
  snippets of code that are used to do the authentication/ login.
 
  Has anyone encountered the same problem and if so do you have a
solution?
  The only solution I can think of is to pass the session using PHPSESSION
in
  the URL however I would like to avoid this if at all possible as it
  involves a major re-write of the code (as session variables are used
  elsewhere in the session) and if I am not mistaken if a user accesses a
  non-php page then the session is lost requiring them to log in again.
 

 Im just putting the finishing touches to my code, that I had to rewrite
for
 similar reasons as you.
 You're going to have to include the session id in the url for those users
who
 do not allow cookies.
 Using this fact about the constant SID
 a)  If the user's browser accepts cookies, SID will be empty 
 b)  If the user's browser does not accept cookies, SID will be
PHPSESSID=xxx

 So what I did, was append the constant SID to all urls/forms and php
header()
 (for redirection) functions that point to the site that is serving the
 content (dont append SID to urls going to other sites).

 So the final results will be
 a) If the user's browser accepts cookies, urls/forms/php header() will be
 normal
 b)  If the user's browser does not accept cookies, the session id is
appended
 to urls/forms/php header()

 OR

 you can take the easy way out, and turn on transparent ids with -
 http://us2.php.net/manual/en/
 install.configure.php#install.configure.enable-trans-sid

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



RE: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Mark Charette
 -Original Message-
 From: Andy Higgins [mailto:[EMAIL PROTECTED]
 Can anyone confirm whether
 AOL (or any
 other ISPs for that matter) change a user's IP address as seen by the web
 server (for eample through a proxy) within the same session?

It's been pointed out and confirmed many, many times here. An IP is not
useful for authentication in the general case (you may have a specific case
on an intranet, but major players like AOL put everything through load
balancing proxies that change from request to request).

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



Re: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andy Higgins
Hi Mark,

Thank you for confirming that for me. I am new to the list and did do a
search though past messages but did not find this point (obvioulsy I did not
look hard enough).

Thanks again.

Regards,
Andy


Mark Charette [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  -Original Message-
  From: Andy Higgins [mailto:[EMAIL PROTECTED]
  Can anyone confirm whether
  AOL (or any
  other ISPs for that matter) change a user's IP address as seen by the
web
  server (for eample through a proxy) within the same session?

 It's been pointed out and confirmed many, many times here. An IP is not
 useful for authentication in the general case (you may have a specific
case
 on an intranet, but major players like AOL put everything through load
 balancing proxies that change from request to request).

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



Re: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Gerard Samuel
On Saturday 27 December 2003 10:54 am, Andy Higgins wrote:

 1. At the time of login will the login code need to check if the clients
 browser accepts cookies and if not then append the SID as described? If so,
 do you perhaps have a sample piece of code that does this?

No, php does this for you.  Thats why I gave the explanation of the value of 
SID when browsers accept, or dont accept cookies.

Sample code
?php

session_start();
if (SID === '')
{
echo 'Cookie Exists';
}
else
{
echo 'Cookie doesnt exist';
}

echo 'pa href=' . $_SERVER['PHP_SELF'] . '?' . SID . 'CLICK ME/a/p';

?

If the browser does accept cookies, on the first page load, it will report 
Cookie doesn't exist because the cookie wont become available till the next 
page load.  After the initial page load, it will report Cookie Exists.
If the browser does not accept cookies, it will always say Cookie doesnt 
exists.

 2. Am I correct in understanding that if the client has logged in (with no
 cookies enabled i.e. the SID needs to be passed) and the site contains
 other static pages (that cannot pass the SID) that if the client browses
 any of these static pages and then returns to a page that required the
 client to be logged that they will have to log in again?

Yes that is correct.  The session id must stay in all urls within the site.
If you are able to direct them to a static page, you should still be able to 
pass the SID in the url/form/iframe/etc they click.

 3. For forms, where the SID need to be passed, do you pass this as a hidden
 form variable or do you do it on the URL?


I have it passing in the form's action attribute, so it stays in $_GET domain 
like regular links.
echo 'form action=foo.php' . SID . ' method=post

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



Re: [PHP] PHP Session Variables Not Being Set For Certain Browsers

2003-12-27 Thread Andy Higgins
Hi Gerard,

Thank you for your assistance you have been of enormous help.

Regards,
Andy

Gerard Samuel [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Saturday 27 December 2003 10:54 am, Andy Higgins wrote:

  1. At the time of login will the login code need to check if the clients
  browser accepts cookies and if not then append the SID as described? If
so,
  do you perhaps have a sample piece of code that does this?

 No, php does this for you.  Thats why I gave the explanation of the value
of
 SID when browsers accept, or dont accept cookies.

 Sample code
 ?php

 session_start();
 if (SID === '')
 {
 echo 'Cookie Exists';
 }
 else
 {
 echo 'Cookie doesnt exist';
 }

 echo 'pa href=' . $_SERVER['PHP_SELF'] . '?' . SID . 'CLICK
ME/a/p';

 ?

 If the browser does accept cookies, on the first page load, it will report
 Cookie doesn't exist because the cookie wont become available till the
next
 page load.  After the initial page load, it will report Cookie Exists.
 If the browser does not accept cookies, it will always say Cookie doesnt
 exists.

  2. Am I correct in understanding that if the client has logged in (with
no
  cookies enabled i.e. the SID needs to be passed) and the site contains
  other static pages (that cannot pass the SID) that if the client browses
  any of these static pages and then returns to a page that required the
  client to be logged that they will have to log in again?

 Yes that is correct.  The session id must stay in all urls within the
site.
 If you are able to direct them to a static page, you should still be able
to
 pass the SID in the url/form/iframe/etc they click.

  3. For forms, where the SID need to be passed, do you pass this as a
hidden
  form variable or do you do it on the URL?
 

 I have it passing in the form's action attribute, so it stays in $_GET
domain
 like regular links.
 echo 'form action=foo.php' . SID . ' method=post

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



[PHP] session variables scope problem. HELP!

2003-11-13 Thread Jim Gates
I've spent a few hours trying to resolve a problem with session variables.
The session variables are intended to ensure login and/or whether or not a
user is an administrator with other permissions. My intent is to test for
the variables, if not present, redirect to login page or deny access.

It seems that once a session is started and variables set, I can access the
variables on the page on which they are set, but on subsequent pages via
link or Header redirect the session variables are not set and cannot be
accesses.

I read that Header redirect dumps session variables, so I tried simply
painting a message that said Login successful. Proceed with a link on
proceed. After clicking the link and going to page 2, session variables are
not set.

I've read site helps, my books, and am at a loss. Code follows.

Any comments are GREATLY appreciated.

Jim Gates
[EMAIL PROTECTED]
www.gatesinteractive.com

PAGE 1

?
 if(!session_id()){
  session_start();
 }
 if(!isset($_SESSION[sUi])){
  session_register(sUi);
 }
 if(!isset($_SESSION[sAdmin])){
  session_register(sAdmin);
 }
 require(php_includes/incl_sqlConnect.php);
 $query = SELECT * FROM tblUser WHERE username = '$username' AND password =
'$password';
 $result = mysql_query($query);
 $num_results = mysql_num_rows($result);
 if($num_results  1)
 {
  Header (Location:dsp_login.php?errMsg=i);
 }
 else
 {
   $rows = mysql_num_rows($result);
   for ($i=0; $i$rows; $i++){
   $getUser = mysql_fetch_object($result);
   $_SESSION[sUi] = $getUser-userID;
   $_SESSION[sAdmin] = $getUser-admin;
  }
  Header (Location:dsp_memberMain.php);
also tried echo Login successful. a href=dsp_memberMain.phpProceed/a;
 }
?

PAGE 2

  ?
if (isset($_SESSION[sUi])  $_SESSION[sAdmin] == 1){
 echo $_SESSION[sUi] and $_SESSION[sAdmin];
 echo bra href=dsp_showUsers.phpShow users./a;
 }
 else
 {
 echo V no - developer test.;
 }
   ?

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



RE: [PHP] session variables scope problem. HELP!

2003-11-13 Thread Johnson, Kirk
 It seems that once a session is started and variables set, I 
 can access the
 variables on the page on which they are set, but on 
 subsequent pages via
 link or Header redirect the session variables are not set and 
 cannot be
 accesses.

Be sure you have session_start() at the top of *all* pages.

Kirk

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



[PHP] SOLVED RE: [PHP] SESSION variables losing data on WinXP?

2003-09-19 Thread Jami
In case anyone else runs into this problem, the way I solved it was by
reinstalling php with the windows installer from php.net. I'm not
exactly sure what the problem was, but reinstalling it this way solved
the problem. Hope this helps someone else.

Jami Moore
LightSpark Digital Designs
[EMAIL PROTECTED]
http://www.lightsparkdigital.com/


-Original Message-
From: Jami [mailto:[EMAIL PROTECTED] 


I'm working on a project, and up until recently was using my hosting
account to do projects, but decided to update PHP on my comp to be able
to work on projects locally. I'm running WindowsXP, PHP 4.3.2, Apache
1.3, and MySQL 3.23.53. The validation page is called on each page, but
if I go to a page other than the entry page (which the validation page
takes you to when you first log in), it throws me back to the login
page. Has anyone run into this and have you solved it? Anyone have a
suggestion?

 

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



[PHP] SESSION variables losing data on WinXP?

2003-09-17 Thread Jami
I'm working on a project, and up until recently was using my hosting
account to do projects, but decided to update PHP on my comp to be able
to work on projects locally. I'm running WindowsXP, PHP 4.3.2, Apache
1.3, and MySQL 3.23.53. The validation page is called on each page, but
if I go to a page other than the entry page (which the validation page
takes you to when you first log in), it throws me back to the login
page. Has anyone run into this and have you solved it? Anyone have a
suggestion? Code is rather lengthy, if you want it I can send it off
list.
 

Jami Moore
LightSpark Digital Designs
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 http://www.lightsparkdigital.com/ http://www.lightsparkdigital.com/

 


Re: [PHP] SESSION variables losing data on WinXP?

2003-09-17 Thread Larry_Li
I believe all pages in your site are protected by session variables. Try 
to login first, then go where you want to go. Or try to remark codes which 
check your login status. 






Jami [EMAIL PROTECTED]
09/17/2003 03:52 PM
Please respond to listmail
 
To: PHP General [EMAIL PROTECTED]
cc: 
Subject:[PHP] SESSION variables losing data on WinXP?
 


I'm working on a project, and up until recently was using my hosting
account to do projects, but decided to update PHP on my comp to be able
to work on projects locally. I'm running WindowsXP, PHP 4.3.2, Apache
1.3, and MySQL 3.23.53. The validation page is called on each page, but
if I go to a page other than the entry page (which the validation page
takes you to when you first log in), it throws me back to the login
page. Has anyone run into this and have you solved it? Anyone have a
suggestion? Code is rather lengthy, if you want it I can send it off
list.
 

Jami Moore
LightSpark Digital Designs
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 http://www.lightsparkdigital.com/ http://www.lightsparkdigital.com/

 



Re: [PHP] SESSION variables losing data on WinXP?

2003-09-17 Thread Larry_Li
Did you open register_globals = On in php.ini?







Larry Li/CNTR/APPLIED [EMAIL PROTECTED]
09/17/2003 04:04 PM
 
To: [EMAIL PROTECTED]
cc: PHP General [EMAIL PROTECTED]
Subject:Re: [PHP] SESSION variables losing data on WinXP?
 


I believe all pages in your site are protected by session variables. Try 
to login first, then go where you want to go. Or try to remark codes which 

check your login status. 






Jami [EMAIL PROTECTED]
09/17/2003 03:52 PM
Please respond to listmail
 
To: PHP General [EMAIL PROTECTED]
cc: 
Subject:[PHP] SESSION variables losing data on WinXP?
 


I'm working on a project, and up until recently was using my hosting
account to do projects, but decided to update PHP on my comp to be able
to work on projects locally. I'm running WindowsXP, PHP 4.3.2, Apache
1.3, and MySQL 3.23.53. The validation page is called on each page, but
if I go to a page other than the entry page (which the validation page
takes you to when you first log in), it throws me back to the login
page. Has anyone run into this and have you solved it? Anyone have a
suggestion? Code is rather lengthy, if you want it I can send it off
list.
 

Jami Moore
LightSpark Digital Designs
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 http://www.lightsparkdigital.com/ http://www.lightsparkdigital.com/

 




RE: [PHP] SESSION variables losing data on WinXP?

2003-09-17 Thread Jami
Knew I forgot to mention something. No, register_globals are off. Using
$_SESSION[] variables. I am logging in first. I log in fine, its when I
try to go to another page via a link on the entry page that I get booted
back to the login page. My scripts work fine on a Unix server, which is
what I reluctantly had to go back to using as this projects deadline is
too close not to do so. Its just on my computer locally that this does
not work. Code is below, it is fairly long.
 
Example Code:
 
//validation.php
include_once 'db.php';
include_once 'common.php'
 
 session_start();
 
 $uname = isset($_POST['username']) ? $_POST['username'] :
$_SESSION['username']; 
 $pwd = isset($_POST['password']) ? $_POST['password'] :
$_SESSION['password'];
 
 if(!isset($uname))
 {
  header(Location: login.php);
  exit;
 }
 
 $_SESSION['username'] = $uname; 
 $_SESSION['password'] = $pwd;
 
 dbConnect(db); 
 $sql = SELECT * FROM admin WHERE 
 admin_uname = '$uname' AND admin_pword = PASSWORD('$pwd');
 $result = mysql_query($sql); 
 
 if (!$result) { 
  error('A database error occurred while checking your login
details.\\nIf this error persists, please contact
[EMAIL PROTECTED]'); 
 }
 
 while($row = mysql_fetch_array($result))
 {
  $admin_id = $row['admin_id'];
 }
 
 $_SESSION['aid'] = $admin_id;
 
 if (mysql_num_rows($result) == 0) { 
   unset($_SESSION['username']); 
   unset($_SESSION['password']);
   
   header(Location:login.php?item=badlogin);
   exit;  
 }
 
___
//login.php
... this is an html page with the login form. When submitted it goes to
index.php.
 
___
//index.php
include('validation.php');
 
 if(!$_SESSION['aid'])
 {
  header(Location:login.php);
  exit;
 }
 rest of page is HTML with a php include for the navigation
___
//nav.php
.a href=admin_signup.phpAdd Admin/a
 
___
//admin_signup.php
include('validation.php');
 
 if(!$_SESSION['aid'])
 {
  header(Location:admin_login.php);
  exit;
 }
 rest of page is HTML with a form that goes to add_admin.php for
validation and submission to the database. Its when I try to go to this
page via the link that I get sent back to the login page.
 

Jami Moore
LightSpark Digital Designs
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
 http://www.lightsparkdigital.com/ http://www.lightsparkdigital.com/

 


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

Sent: Wednesday, September 17, 2003 3:08 AM


Did you open register_globals = On in php.ini? 


 -Original Message- 
Larry Li/CNTR/APPLIED [EMAIL PROTECTED] 
09/17/2003 04:04 PM   

I believe all pages in your site are protected by session variables. Try

to login first, then go where you want to go. Or try to remark codes
which 
check your login status. 


-Original Message-
Jami [EMAIL PROTECTED]
09/17/2003 03:52 PM

I'm working on a project, and up until recently was using my hosting
account to do projects, but decided to update PHP on my comp to be able
to work on projects locally. I'm running WindowsXP, PHP 4.3.2, Apache
1.3, and MySQL 3.23.53. The validation page is called on each page, but
if I go to a page other than the entry page (which the validation page
takes you to when you first log in), it throws me back to the login
page. Has anyone run into this and have you solved it? Anyone have a
suggestion? Code is rather lengthy, if you want it I can send it off
list.

Jami Moore
LightSpark Digital Designs
mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
http://www.lightsparkdigital.com/ http://www.lightsparkdigital.com/








Re: [PHP] SESSION variables losing data on WinXP?

2003-09-17 Thread Scott Fletcher
Speaking of your problem, you're using the header() function to exit the
webpage to the login page.  So, it all come down to the either one of these
two or both of these two

 if(!isset($uname)) {
 if (mysql_num_rows($result) == 0) {

Upon closer inspection on the script, it look like either the $_POST['***']
wasn't returning data or the $_SESSION['***'] doesn't have data in it that
tripped the header() function.  So, I'll take the assumption that the
$_POST['***'] does work as it alway does.  So, it narrow down to
$_SESSION['***'].

Since you mentioned that you use it on both Unix and Windows.  So, most
likely it all narrow down to php.ini.  Can you check to verify that the
filepath is correct for Windows and that there is no issue with file
permission.  Here's what I have that work for me on Windows 2000.

--clip--
[Session]
; Handler used to store/retrieve data.
session.save_handler = files

; Argument passed to save_handler.  In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
session.save_path = c:\tmp

; Whether to use cookies.
session.use_cookies = 1

; This option enables administrators to make their users invulnerable to
; attacks which involve passing session ids in URLs; defaults to 0.
; session.use_only_cookies = 1

; Name of the session (used as cookie name).
session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 0

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; The path for which the cookie is valid.
session.cookie_path = c:\tmp

; The domain for which the cookie is valid.
session.cookie_domain =

; Handler used to serialize data.  php is the standard serializer of PHP.
session.serialize_handler = php

; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_divisor,
; e.g. 1/100 means there is a 1% chance that the GC process starts
; on each request.

session.gc_probability = 1
session.gc_divisor = 1000

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

; PHP 4.2 and less have an undocumented feature/bug that allows you to
; to initialize a session variable in the global scope, albeit
register_globals
; is disabled.  PHP 4.3 and later will warn you, if this feature is used.
; You can disable the feature and the warning seperately. At this time,
; the warning is only displayed, if bug_compat_42 is enabled.

session.bug_compat_42 = 0
session.bug_compat_warn = 1

; Check HTTP Referer to invalidate externally stored URLs containing ids.
; HTTP_REFERER has to contain this substring for the session to be
; considered as valid.
session.referer_check =

; How many bytes to read from the file.
session.entropy_length = 0

; Specified here to create the session id.
session.entropy_file =

;session.entropy_length = 16

;session.entropy_file = /dev/urandom

; Set to {nocache,private,public,} to determine HTTP caching aspects.
; or leave this empty to avoid sending anti-caching headers.
session.cache_limiter = nocache

; Document expires after n minutes.
session.cache_expire = 180

; trans sid support is disabled by default.
; Use of trans sid may risk your users security.
; Use this option with caution.
; - User may send URL contains active session ID
;   to other person via. email/irc/etc.
; - URL that contains active session ID may be stored
;   in publically accessible computer.
; - User may access your site with the same session ID
;   always using URL stored in browser's history or bookmarks.
session.use_trans_sid = 0

; The URL rewriter will look for URLs in a defined set of HTML tags.
; form/fieldset are special; if you include them here, the rewriter will
; add a hidden input field with the info which is otherwise appended
; to URLs.  If you want XHTML conformity, remove the form entry.
; Note that all valid entries require a =, even if no value follows.
url_rewriter.tags =
a=href,area=href,frame=src,input=src,form=fakeentry--clip--

One thing I noticed is that I had to create a folder called 'tmp' for it to
work.

Hope that help..
 Scott F.


Jami [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Knew I forgot to mention something. No, register_globals are off. Using
 $_SESSION[] variables. I am logging in first. I log in fine, its when I
 try to go to another page via a link on the entry page that I get booted
 back to the login page. My scripts work fine on a Unix server, which is
 what I reluctantly had to go back to using as this projects deadline is
 too close not to do so. Its just on my computer locally that this does
 not work. Code is below, it is fairly long.

 Example Code:

 //validation.php
 include_once 'db.php';
 include_once 'common.php'

  session_start();

 

[PHP] STILL NOT SOLVED RE: [PHP] SESSION variables losing data on WinXP?

2003-09-17 Thread Jami
Scott,

thanks for the suggestion, but my php.ini is the same as yours. And I
still have the problem. Any idea why $_SESSION[] variables would loose
data on my server type and not on another?

Jami Moore
LightSpark Digital Designs
[EMAIL PROTECTED]
http://www.lightsparkdigital.com/


-Original Message-
From: Scott Fletcher [mailto:[EMAIL PROTECTED] 

Upon closer inspection on the script, it look like either the
$_POST['***']
wasn't returning data or the $_SESSION['***'] doesn't have data in it
that
tripped the header() function.  So, I'll take the assumption that the
$_POST['***'] does work as it alway does.  So, it narrow down to
$_SESSION['***'].

Since you mentioned that you use it on both Unix and Windows.  So, most
likely it all narrow down to php.ini.  Can you check to verify that the
filepath is correct for Windows and that there is no issue with file
permission.

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



Re: [PHP] Session Variables in a Class

2003-09-10 Thread micro brew
Thanks Curt,

You were absolutely correct.  Removing the
session_register() lines before the $_SESSION[] fixed
the problem.  By mixing the two before, it actually
would register the variable so I could later test for
the registered session variable but it did not retain
the value I assigned it.  Thanks again for the help.

Mike

* Thus wrote micro brew ([EMAIL PROTECTED]):
 Hi everyone,
 
 I've been experimenting with sessions.  I can make
 them work just fine in a normal PHP page.  But when
I
 create a class and try to define a session variable
 within a method in the class it won't work.  I've
 tried setting the session variable directly
 ($_SESSION['name']='somevalue') but that didn't
work. 
 The normal way of setting it -
 session_start();
 session_register('name'); 
 $name='somevalue';

You might want to read
  http://php.net/session

You are most likley running into a register_globals
issue.

A couple things to note:

  . You must not mix $_SESSION[] access with
session_register()
  anywhere in your script.

  . When you issue session_register('name') inside
your class it is
  declaring the global var $name as a session var,
not the $name in
 your script.



Curt

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: [PHP] Session Variables in a Class

2003-09-10 Thread CPT John W. Holmes
From: micro brew [EMAIL PROTECTED]

 Here's my class.  I start the session in the
 constructor and in later methods attempt to register
 session variables.  You can see I've tried a couple
 different methods but none of them maintain the
 session variable values.  Any suggestions?

Is register_globals ON or OFF? You shouldn't mix session_register() with
$_SESSION. Just use one other the other, but I recommend just using
$_SESSION.

$_SESSION['var'] = 'some value';

to set a session var, and

if(isset($_SESSION['var']))

to see if a variable is set.

Also, if you have a varible $foobar within a class method that you define as
a session var, you must make it global if you want to access it in other
methods. The same thing for HTTP_SESSION_VARS. I think you're just running
into a scope issue.

---John Holmes...

 Mike

 ?php

 class login {

 //This variable tells the browser where to redirect to
 the loginpage
 var
 $loginPage='http://www.somedomain.com/somepage.php';
 var
 $exitPage='http://www.somedomain.com/somepage.html';
 var $loggedIn;
 var $access;
 var $accesslevel;

  function login($loggedIn, $access, $accesslevel) {

   session_start();
   if ($loggedIn=='1') {
$this-checkLogin();
   }
   if ($access=='1') {
$this-checkAccess();
   }
   if ($access=='0'  $loggedIn=='0') {
$this-authenticateLogin();
   }
  }

 function checkLogin() {

   if (session_is_registered('user')!='True') {
session_register('unauthorizedaccess');
$unauthorizedaccess=http://; .
 $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'];
header(location: $this-loginPage);
exit();
   }
  }

  function checkAccess() {

if (session_is_registered('permission')=='True') {
 if
 ($HTTP_SESSION_VARS['permission']$this-accesslevel)
 {
  session_destroy();
  header(location: $this-exitPage);
  exit();
 }
}
else {
 session_register('unauthorizedaccess');
 $unauthorizedaccess=http://; .
 $_SERVER[SERVER_NAME] . $_SERVER[SCRIPT_NAME];
 header(location: $this-loginPage);
 exit();
}
  }

  function authenticateLogin() {

   if ((!$HTTP_POST_VARS['un']) ||
 (!$HTTP_POST_VARS['pw'])) {
session_register('loginError');
header(Location: $this-loginPage);
exit();
   }

   else {

include(includes/db_connect.inc);

//call db_connect function from db_connect.inc
db_connect() or trigger_error(MySQL error # .
 mysql_errno() . : . mysql_error());

$query=select * from users where username=\ .
 addslashes($HTTP_POST_VARS['un']) .\ and
 password=\ . addslashes($HTTP_POST_VARS['pw']) .
 \;

$result=mysql_query($query) or trigger_error(MySQL
 error # . mysql_errno() . : . mysql_error());

$foundCount = mysql_num_rows($result);

if ($foundCount==1) {
 session_register('user');
 session_register('permission');
 session_register('company');
 session_unregister('loginError');
 for ($i=0; $i  $foundCount; $i++) {
  $row=mysql_fetch_array($result);
  $_SESSION['user']=$row['userID'];
  $_SESSION['permission']=$row['permissionLevel'];

  $_SESSION['company']=$row['companyID'];
 }
 if
 (session_is_registered('unauthorizedaccess')=='True')
 {

 $location=$HTTP_SESSION_VARS['unauthorizedaccess'];
  session_unregister('unauthorizedaccess');
  header(Location: $location);
  exit();
 }
}
else {
 session_register('loginError');
 header(Location: $this-loginPage);
 exit();
}
   }
  }


 //closes class
 }

 ?

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



[PHP] Session Variables in a Class

2003-09-09 Thread micro brew
Hi everyone,

I've been experimenting with sessions.  I can make
them work just fine in a normal PHP page.  But when I
create a class and try to define a session variable
within a method in the class it won't work.  I've
tried setting the session variable directly
($_SESSION['name']='somevalue') but that didn't work. 
The normal way of setting it -
session_start();
session_register('name'); 
$name='somevalue';

- didn't work either (within the class).

Am I just missing something obvious?  Any suggestions?
 TIA.

Mike

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: [PHP] Session Variables in a Class

2003-09-09 Thread Marco Schuler
Am Die, 2003-09-09 um 10.19 schrieb micro brew:
 Hi everyone,
 
 I've been experimenting with sessions.  I can make
 them work just fine in a normal PHP page.  But when I
 create a class and try to define a session variable
 within a method in the class it won't work.  I've
 tried setting the session variable directly
 ($_SESSION['name']='somevalue') but that didn't work. 
 The normal way of setting it -
 session_start();
 session_register('name'); 
 $name='somevalue';
 
 - didn't work either (within the class).
 
 Am I just missing something obvious?  Any suggestions?

You have to include the class-definition _before_ you start the session.
Read about it in the manual:

http://www.php.net/manual/en/language.oop.serialization.php

Hope that helps.

--
 Marco


  TIA.
 
 Mike
 
 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.com
 
 -- 
 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 Variables in a Class

2003-09-09 Thread CPT John W. Holmes
From: micro brew [EMAIL PROTECTED]
 I've been experimenting with sessions.  I can make
 them work just fine in a normal PHP page.  But when I
 create a class and try to define a session variable
 within a method in the class it won't work.  I've
 tried setting the session variable directly
 ($_SESSION['name']='somevalue') but that didn't work.
 The normal way of setting it -
 session_start();
 session_register('name');
 $name='somevalue';

 - didn't work either (within the class).

didn't work isn't very helpful to us. How useful would it be for me to
just answer you with it worked for me.

Show us some code examples (short ones) as to how this doesn't work, please.

---John Holmes...

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



Re: [PHP] Session Variables in a Class

2003-09-09 Thread micro brew
Here's my class.  I start the session in the
constructor and in later methods attempt to register
session variables.  You can see I've tried a couple
different methods but none of them maintain the
session variable values.  Any suggestions?

Mike

?php

class login {

//This variable tells the browser where to redirect to
the loginpage
var
$loginPage='http://www.somedomain.com/somepage.php';
var
$exitPage='http://www.somedomain.com/somepage.html';
var $loggedIn;
var $access;
var $accesslevel;

 function login($loggedIn, $access, $accesslevel) {   

  session_start();
  if ($loggedIn=='1') {
   $this-checkLogin();
  }
  if ($access=='1') {
   $this-checkAccess();
  }
  if ($access=='0'  $loggedIn=='0') {
   $this-authenticateLogin();
  }
 }
 
function checkLogin() { 
  
  if (session_is_registered('user')!='True') {
   session_register('unauthorizedaccess');
   $unauthorizedaccess=http://; .
$_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'];
   header(location: $this-loginPage);
   exit();
  }
 }
 
 function checkAccess() { 
   
   if (session_is_registered('permission')=='True') {
if
($HTTP_SESSION_VARS['permission']$this-accesslevel)
{
 session_destroy();
 header(location: $this-exitPage);
 exit();
}
   }
   else {
session_register('unauthorizedaccess');
$unauthorizedaccess=http://; .
$_SERVER[SERVER_NAME] . $_SERVER[SCRIPT_NAME];
header(location: $this-loginPage);
exit();
   }
 }

 function authenticateLogin() { 

  if ((!$HTTP_POST_VARS['un']) ||
(!$HTTP_POST_VARS['pw'])) {
   session_register('loginError');
   header(Location: $this-loginPage);
   exit();
  }

  else {

   include(includes/db_connect.inc);

   //call db_connect function from db_connect.inc
   db_connect() or trigger_error(MySQL error # .
mysql_errno() . : . mysql_error());

   $query=select * from users where username=\ .
addslashes($HTTP_POST_VARS['un']) .\ and
password=\ . addslashes($HTTP_POST_VARS['pw']) .
\;

   $result=mysql_query($query) or trigger_error(MySQL
error # . mysql_errno() . : . mysql_error());

   $foundCount = mysql_num_rows($result);

   if ($foundCount==1) {
session_register('user');
session_register('permission');
session_register('company');
session_unregister('loginError');
for ($i=0; $i  $foundCount; $i++) {
 $row=mysql_fetch_array($result); 
 $_SESSION['user']=$row['userID'];  
 $_SESSION['permission']=$row['permissionLevel']; 

 $_SESSION['company']=$row['companyID'];
}
if
(session_is_registered('unauthorizedaccess')=='True')
{

$location=$HTTP_SESSION_VARS['unauthorizedaccess'];
 session_unregister('unauthorizedaccess');
 header(Location: $location);
 exit();
}
   }
   else {
session_register('loginError');
header(Location: $this-loginPage);
exit();
   }
  }
 }


//closes class
}

?

--- CPT John W. Holmes [EMAIL PROTECTED]
wrote:
 From: micro brew [EMAIL PROTECTED]
  I've been experimenting with sessions.  I can make
  them work just fine in a normal PHP page.  But
 when I
  create a class and try to define a session
 variable
  within a method in the class it won't work.  I've
  tried setting the session variable directly
  ($_SESSION['name']='somevalue') but that didn't
 work.
  The normal way of setting it -
  session_start();
  session_register('name');
  $name='somevalue';
 
  - didn't work either (within the class).
 
 didn't work isn't very helpful to us. How useful
 would it be for me to
 just answer you with it worked for me.
 
 Show us some code examples (short ones) as to how
 this doesn't work, please.
 
 ---John Holmes...
 


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Re: [PHP] Session Variables in a Class

2003-09-09 Thread Curt Zirzow
* Thus wrote micro brew ([EMAIL PROTECTED]):
 Hi everyone,
 
 I've been experimenting with sessions.  I can make
 them work just fine in a normal PHP page.  But when I
 create a class and try to define a session variable
 within a method in the class it won't work.  I've
 tried setting the session variable directly
 ($_SESSION['name']='somevalue') but that didn't work. 
 The normal way of setting it -
 session_start();
 session_register('name'); 
 $name='somevalue';

You might want to read
  http://php.net/session

You are most likley running into a register_globals issue.

A couple things to note:

  . You must not mix $_SESSION[] access with session_register()
  anywhere in your script.

  . When you issue session_register('name') inside your class it is
  declaring the global var $name as a session var, not the $name in
  your script.



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



Re: [PHP] Session Variables in a Class

2003-09-09 Thread Curt Zirzow
* Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
 * Thus wrote micro brew ([EMAIL PROTECTED]):
  Hi everyone,
  
  I've been experimenting with sessions.  I can make
  them work just fine in a normal PHP page.  But when I
  create a class and try to define a session variable
  within a method in the class it won't work.  I've
  tried setting the session variable directly
  ($_SESSION['name']='somevalue') but that didn't work. 
  The normal way of setting it -
  session_start();
  session_register('name'); 
  $name='somevalue';
 
 You might want to read
   http://php.net/session
 
 You are most likley running into a register_globals issue.
 
 A couple things to note:
 
   . You must not mix $_SESSION[] access with session_register()
   anywhere in your script.
 
   . When you issue session_register('name') inside your class it is
   declaring the global var $name as a session var, not the $name in
   your script.
 ^^

should be 'function'

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 variables

2003-09-01 Thread Diana Castillo
I am having a weird problem, when I close all my browser windows and restart
my application, the session variable which I set comes back suddenly, but
only when I call a certain class .
As far as I know the session variables should disappear when I close the
browser.  Why would they suddenly come back?
thank you

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



RE: [PHP] session variables

2003-09-01 Thread Binay Agarwal
Check out session.cookie_lifetime .. 
if lifetime =0 then session should disappear once you close the browser else it will 
stay the time specified in lifetime options.

Hope this helps and let me know.

Binay

Diana Castillo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 I am having a weird problem, when I close all my browser windows and restart
 my application, the session variable which I set comes back suddenly, but
 only when I call a certain class .
 As far as I know the session variables should disappear when I close the
 browser.  Why would they suddenly come back?
 thank you



[PHP] session variables

2003-08-29 Thread Diana Castillo
I am having a weird problem, when I close all my browser windows and restart
my application, the session variable which I set comes back suddenly, but
only when I call a certain class .

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



[PHP] Session Variables and Posting

2003-04-04 Thread Van Andel, Robbert
Is there a way that I can prevent session variables getting values from
query strings.  I want them to receive values only from posted forms.


Robbert van Andel 

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



Re: [PHP] Session Variables and Posting

2003-04-04 Thread Kevin Stone

- Original Message -
From: Van Andel, Robbert [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 04, 2003 4:00 PM
Subject: [PHP] Session Variables and Posting


 Is there a way that I can prevent session variables getting values from
 query strings.  I want them to receive values only from posted forms.


 Robbert van Andel


You should be accessing the $_GET, $_POST and $_SESSION arrays directly
rather than relying on request vars to be parsed automatically.  This will
allow you to be much more discriminatory in your code.

Read up on Predefined Variables in the manual..
http://www.php.net/manual/en/reserved.variables.php

HTH,
Kevin



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



Re: [PHP] Session Variables and Posting

2003-04-04 Thread Leif K-Brooks
http://www.php.net/manual/en/security.registerglobals.php

Van Andel, Robbert wrote:

Is there a way that I can prevent session variables getting values from
query strings.  I want them to receive values only from posted forms.
Robbert van Andel 

 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


[PHP] session variables

2003-03-19 Thread Pag
	HI,

	Am trying to give controlled access to who logs in to my site. Have a 
quick doubt:

	I register a session var named $tu (value is taken from the DB) when a 
user logs in, how can i reference to that var? I mean, if i want to check 
its value, if i do print($tu);, it doesnt seem to work.
	Thanks.

	Pag



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


RE: [PHP] session variables

2003-03-19 Thread daniel
u have to start the session first then check with $_SESSION['tu'];
= Original Message From Pag [EMAIL PROTECTED] =
   HI,

   Am trying to give controlled access to who logs in to my site. Have a
quick doubt:

   I register a session var named $tu (value is taken from the DB) when a
user logs in, how can i reference to that var? I mean, if i want to check
its value, if i do print($tu);, it doesnt seem to work.
   Thanks.

   Pag



--
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 variables

2003-03-13 Thread Shaun van den Berg
Hi,

Is it wise or wrong to put long strings into a session variable ? Is it
better to keep the values short ?

Thanks
Shaun

--
Novtel Consulting
Tel: +27 21 9822373
Fax: +27 21 9815846
Please visit our website:
www.novtel.co.za



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



RE: [PHP] session variables

2003-03-13 Thread John W. Holmes
 Is it wise or wrong to put long strings into a session variable ? Is
it
 better to keep the values short ?

The more data you put into your session, the more data that has to be
read and written to a file on your server each time someone accesses a
page. More data is going to slow things down. 

If it's your only option, then use it. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



Re: [PHP] Session Variables

2003-01-27 Thread Leif K-Brooks
$HTTP_SESSION_VARS and $_SESSION don't magically update when you add a 
session variable with session_register().

Jed R. Brubaker wrote:

I have a quirky problem that should be a breeze for someone who is smarter
than I.

I have a script where I am registering a HTML form post variable as a
session variable and then echo it. In the real script I use it in a MySQL
query, but for the sake of this post, here is the script:

$user1 = $HTTP_POST_VARS[user1];
session_register(user1);
echo $HTTP_SESSION_VARS[user1];

This doesn't work, however, if I hit the refresh button the var miraculously
appears!
What am I doing wrong?



 


--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




[PHP] Session Variables

2003-01-26 Thread Jed R. Brubaker
I have a quirky problem that should be a breeze for someone who is smarter
than I.

I have a script where I am registering a HTML form post variable as a
session variable and then echo it. In the real script I use it in a MySQL
query, but for the sake of this post, here is the script:

$user1 = $HTTP_POST_VARS[user1];
session_register(user1);
echo $HTTP_SESSION_VARS[user1];

This doesn't work, however, if I hit the refresh button the var miraculously
appears!
What am I doing wrong?



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




Re: [PHP] session variables

2002-12-18 Thread Antti
Justin French wrote:

1. the opposite of 
session_register('varname') is
session_unregister('varname') NOT
unset($varname)


2. Are you on PHP = 4.1 ??

If so, move away from things like:

?
session_start();
$variable = 'foo';
session_register('variable');
session_unregister('variable')
?

and into:

?
session_start();
$_SESSION['variable'] = 'foo';
$_SESSION['variable'] = 'bah';
unset($_SESSION['variable']);
?

MUCH cleaner to work with :)


Justin



on 17/12/02 10:35 PM, Antti ([EMAIL PROTECTED]) wrote:


How can I change the values of session variables
(session_register('variable');) in a session. Do I just
unset($variable); and do session_register() again and give it a new
value. I tried this and it seems that it doesn't work.

Antti




Justin French

http://Indent.com.au
Web Development  
Graphic Design


Neather this seem to work

$_SESSION['some_variable']=$variable;

nor this:

$_SESSION['today']= date('Y-m-d h:m:s');

antti



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




Re: [PHP] session variables

2002-12-18 Thread Antti
Justin French wrote:

1. the opposite of 
session_register('varname') is
session_unregister('varname') NOT
unset($varname)


2. Are you on PHP = 4.1 ??

If so, move away from things like:

?
session_start();
$variable = 'foo';
session_register('variable');
session_unregister('variable')
?

and into:

?
session_start();
$_SESSION['variable'] = 'foo';
$_SESSION['variable'] = 'bah';
unset($_SESSION['variable']);
?

MUCH cleaner to work with :)


Justin



on 17/12/02 10:35 PM, Antti ([EMAIL PROTECTED]) wrote:


How can I change the values of session variables
(session_register('variable');) in a session. Do I just
unset($variable); and do session_register() again and give it a new
value. I tried this and it seems that it doesn't work.

Antti




Justin French

http://Indent.com.au
Web Development  
Graphic Design


Neather this seem to work

$_SESSION['ses_name']=$variable;

nor this:

$_SESSION['today']= date('Y-m-d h:m:s');

antti



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




Re: [PHP] session variables

2002-12-18 Thread Justin French
on 19/12/02 2:25 AM, Antti ([EMAIL PROTECTED]) wrote:

 Neather this seem to work
 
 $_SESSION['some_variable']=$variable;
 
 nor this:
 
 $_SESSION['today']= date('Y-m-d h:m:s');
 
 antti

What do you mean don't work... what are you trying to do?


page1.php
?
session_start();
$_SESSION['today']= date('Y-m-d h:m:s');
?
html
body
a href=page.2.phpclick to go to page 2/a
/body
/html

page2.php
?
session_start();
?
html
body
The value of $_SESSION['today'] is ?=$_SESSION['today']?.
/body
/html


This code assumes you either have trans-sid compiled OR are allowing cookies
on your browser AND cookies is a method that PHP sessions use (it is by
default) in php.ini.



Justin French

http://Indent.com.au
Web Development  
Graphic Design



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




[PHP] session variables

2002-12-17 Thread Antti
How can I change the values of session variables 
(session_register('variable');) in a session. Do I just 
unset($variable); and do session_register() again and give it a new 
value. I tried this and it seems that it doesn't work.

Antti


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



Re: [PHP] session variables

2002-12-17 Thread Justin French
1. the opposite of 
session_register('varname') is
session_unregister('varname') NOT
unset($varname)


2. Are you on PHP = 4.1 ??

If so, move away from things like:

?
session_start();
$variable = 'foo';
session_register('variable');
session_unregister('variable')
?

and into:

?
session_start();
$_SESSION['variable'] = 'foo';
$_SESSION['variable'] = 'bah';
unset($_SESSION['variable']);
?

MUCH cleaner to work with :)


Justin



on 17/12/02 10:35 PM, Antti ([EMAIL PROTECTED]) wrote:

 How can I change the values of session variables
 (session_register('variable');) in a session. Do I just
 unset($variable); and do session_register() again and give it a new
 value. I tried this and it seems that it doesn't work.
 
 Antti
 

Justin French

http://Indent.com.au
Web Development  
Graphic Design



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




[PHP] Session Variables Not Being Passed

2002-12-01 Thread Jami
The code that I have is as such:

//header.php
if(isset($_POST['login'])){
  $checkuser = mysql_query(SELECT * FROM mainacct WHERE username = 
'{$_POST['username']}' AND password = '{$_POST['password']}' , $connection) or die 
(Couldn't find user.);
  if (mysql_num_rows($checkuser)  0){
   while ($row = mysql_fetch_array($checkuser)){
$_SESSION['UN'] = $row['username'];
$_SESSION['UserLoggedIn'] = True;
   } 
  } else {
  header(Location:login.php);
   exit;
  }
}

This file is then used as an include in main.php. As long as the variables are used 
ONLY in the header.php file, it works. But when I try to call the session variables in 
main.php, it doesn't show the values of UN or UserLoggedIn. session_start() is called 
in main.php. Is this a quirk with sessions, or is there something more I am supposed 
to be doing? Running Apache 2 w/PHP 4.2.3 on WindowsXP.

Jami



RE: [PHP] Session Variables Not Being Passed

2002-12-01 Thread John W. Holmes


 -Original Message-
 From: Jami [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, December 01, 2002 3:53 AM
 To: PHP General
 Subject: [PHP] Session Variables Not Being Passed
 
 The code that I have is as such:
 
 //header.php
 if(isset($_POST['login'])){
   $checkuser = mysql_query(SELECT * FROM mainacct WHERE username =
 '{$_POST['username']}' AND password = '{$_POST['password']}' ,
 $connection) or die (Couldn't find user.);
   if (mysql_num_rows($checkuser)  0){
while ($row = mysql_fetch_array($checkuser)){
 $_SESSION['UN'] = $row['username'];
 $_SESSION['UserLoggedIn'] = True;
}
   } else {
   header(Location:login.php);
exit;
   }
 }

You're only expecting one row to be returned, right? You could test like
this:

if($row = mysql_fetch_array($checkuser))
{
  $_SESSION['UN'] = $row['username'];
  $_SESSION['UserLoggedIn'] = TRUE;
}
else
{
  header(Location: http://yourdomain.com/login.php;);
  exit();
}

You should use an absolute URI for your header() call, not a relative
one. 

 This file is then used as an include in main.php. As long as the
variables
 are used ONLY in the header.php file, it works. But when I try to call
the
 session variables in main.php, it doesn't show the values of UN or
 UserLoggedIn. session_start() is called in main.php. Is this a quirk
with
 sessions, or is there something more I am supposed to be doing?
Running
 Apache 2 w/PHP 4.2.3 on WindowsXP.

Well, Apache 2 and PHP aren't stable together yet. It's not recommended
you use them together and that could be causing your problem.

Are you including this file before or after session_start()? If you call
session_start(), include the above code, and then $_SESSION['UN'] is not
available later in the main.php page, then it's a bug...

---John Holmes...



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




[PHP] Session variables

2002-07-08 Thread Steve Fitzgerald

I am designing a form using sessions in which the user inputs their
details on page 1 and after submitting they are directed to page 2 for
confirmation. They then have the option of editing their input (ie they
are returned to page 1) where their previous input is reflected in the
form fields by
value ='?php echo $var ?'
This works fine except if the input type is a drop down box, in which
case the default option is shown. Is there any way around this? How
can I show the user their previous choice in these boxes?
Any insights would be appreciated.
Steve


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




RE: [PHP] Session variables

2002-07-08 Thread Rudolf Visagie

Generate a select structure dynamically with PHP, something like this:

?
$OptionValue[0] = something 1;
$OptionValue[1] = something 2;
$OptionValue[2] = something 3;

$Option[0] = List Option 1;
$Option[1] = List Option 2;
$Option[2] = List Option 3;

function GenerateSelect ($Name, $OptionValue, $Option, $SelectedValue) {

/*
The Select function writes an HTML SELECT statement.
$OptionValue = array with option values
$Option = array with the option wording in the pull down
menu
$SelectedValue = the option value that is currently selected
by the user
*/

echo SELECT name='.$Name.' SIZE='1';
for ($i = 0; $i = count($OptionValue) - 1; $i++) {
if ($SelectedValue !=   $OptionValue[$i] ==
$SelectedValue) {
echo OPTION VALUE='.$OptionValue[$i].'
SELECTED.$Option[$i]./OPTION;
} else {
echo OPTION
VALUE='.$OptionValue[$i].'.$Option[$i]./OPTION;
}
}
echo /SELECT;
return 0;
}
?
html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body bgcolor=#FF text=#00
form name=form1 method=post action=test.php
/form
/body
/html
html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body bgcolor=#FF text=#00
form name=form1 method=post action=
?
echo You chose .$MyList.br;
GenerateSelect (MyList, $OptionValue, $Option, $MyList)
?
br
input type=submit name=Submit value=Submit
/form
/body
/html

Regards

Rudolf Visagie
Principal Software Developer
Digital Healthcare Solutions
mailto:[EMAIL PROTECTED]
Tel: 011 2655478
Cell: 082 895 1598
 

-Original Message-
From: Steve Fitzgerald [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 08, 2002 1:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Session variables


I am designing a form using sessions in which the user inputs their
details on page 1 and after submitting they are directed to page 2 for
confirmation. They then have the option of editing their input (ie they
are returned to page 1) where their previous input is reflected in the
form fields by
value ='?php echo $var ?'
This works fine except if the input type is a drop down box, in which
case the default option is shown. Is there any way around this? How
can I show the user their previous choice in these boxes?
Any insights would be appreciated.
Steve


-- 
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 variables

2002-07-08 Thread Justin French

SELECT name=day
OPTION value=please select ? if(empty($day)) { echo selected; }
?
OPTION value=monday ? if($day == monday) { echo selected; } ?
OPTION value=tuesday ? if($day == tuesday) { echo selected; }
?
OPTION value=wednesday ? if($day == wednesday) { echo selected;
} ?
OPTION value=thursday ? if($day == thursday) { echo selected; }
?
OPTION value=friday ? if($day == friday) { echo selected; } ?
/SELECT

Obviously this is labourios to code... you can do this a lot smarter/quicker
with an array for the entire select box... have an array of days, and do a
foreach loop which writes the all the options for you, with the if
statements, etc etc.

By the way, this has nothing to do with sessions :)

It's purely about how to populate drop-down menus from an array, and how to
have the correct value selected if it exists, else showing a default
selection.

Cheers,

Justin French



on 08/07/02 9:36 PM, Steve Fitzgerald ([EMAIL PROTECTED]) wrote:

 I am designing a form using sessions in which the user inputs their
 details on page 1 and after submitting they are directed to page 2 for
 confirmation. They then have the option of editing their input (ie they
 are returned to page 1) where their previous input is reflected in the
 form fields by
 value ='?php echo $var ?'
 This works fine except if the input type is a drop down box, in which
 case the default option is shown. Is there any way around this? How
 can I show the user their previous choice in these boxes?
 Any insights would be appreciated.
 Steve
 


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




Re: [PHP] Session variables

2002-07-08 Thread Steve Fitzgerald

Thanks Justin, your solution is spot-on!
Regards
Steve

Justin French wrote:

 SELECT name=day
 OPTION value=please select ? if(empty($day)) { echo selected; }
 ?
 OPTION value=monday ? if($day == monday) { echo selected; } ?
 OPTION value=tuesday ? if($day == tuesday) { echo selected; }
 ?
 OPTION value=wednesday ? if($day == wednesday) { echo selected;
 } ?
 OPTION value=thursday ? if($day == thursday) { echo selected; }
 ?
 OPTION value=friday ? if($day == friday) { echo selected; } ?
 /SELECT

 Obviously this is labourios to code... you can do this a lot smarter/quicker
 with an array for the entire select box... have an array of days, and do a
 foreach loop which writes the all the options for you, with the if
 statements, etc etc.

 By the way, this has nothing to do with sessions :)

 It's purely about how to populate drop-down menus from an array, and how to
 have the correct value selected if it exists, else showing a default
 selection.

 Cheers,

 Justin French

 on 08/07/02 9:36 PM, Steve Fitzgerald ([EMAIL PROTECTED]) wrote:

  I am designing a form using sessions in which the user inputs their
  details on page 1 and after submitting they are directed to page 2 for
  confirmation. They then have the option of editing their input (ie they
  are returned to page 1) where their previous input is reflected in the
  form fields by
  value ='?php echo $var ?'
  This works fine except if the input type is a drop down box, in which
  case the default option is shown. Is there any way around this? How
  can I show the user their previous choice in these boxes?
  Any insights would be appreciated.
  Steve
 


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




Re[2]: [PHP] Session variables

2002-07-08 Thread Michal Dvoracek

 SELECT name=day
 OPTION value=please select ? if(empty($day)) { echo selected; }
 ?
 OPTION value=monday ? if($day == monday) { echo selected; } ?
 OPTION value=tuesday ? if($day == tuesday) { echo selected; }
 ?
 OPTION value=wednesday ? if($day == wednesday) { echo selected;
 } ?
 OPTION value=thursday ? if($day == thursday) { echo selected; }
 ?
 OPTION value=friday ? if($day == friday) { echo selected; } ?
 /SELECT

better is (IMHO):
OPTION value=please select?php echo empty($day) ? ' selected' : ''; ?
OPTION value=monday?php echo $day == 'monday' ? ' selected' : '';?

Regards,
Michal Dvoracek  [EMAIL PROTECTED]


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




Re: Re[2]: [PHP] Session variables

2002-07-08 Thread BB

and to bring it up another level:
OPTION value=please select?=((empty($day)) ? ' selected' : ''); ?
OPTION value=monday?=(($day == 'monday') ? ' selected' : '');?

:oP

Michal Dvoracek [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  SELECT name=day
  OPTION value=please select ? if(empty($day)) { echo
selected; }
  ?
  OPTION value=monday ? if($day == monday) { echo selected; }
?
  OPTION value=tuesday ? if($day == tuesday) { echo
selected; }
  ?
  OPTION value=wednesday ? if($day == wednesday) { echo
selected;
  } ?
  OPTION value=thursday ? if($day == thursday) { echo
selected; }
  ?
  OPTION value=friday ? if($day == friday) { echo selected; }
?
  /SELECT

 better is (IMHO):
 OPTION value=please select?php echo empty($day) ? ' selected' : '';
?
 OPTION value=monday?php echo $day == 'monday' ? ' selected' : '';?

 Regards,
 Michal Dvoracek  [EMAIL PROTECTED]




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




[PHP] session variables in OOP....

2002-06-14 Thread Wilbert Enserink

Hi all,


I'm busy building a site which uses OOP. 
Several classes are used to constuct different sections of the final page to be 
displayed. 
The overall class is called class.basepage.php
This is the page which outputs HTML and calls other classes to construct other parts 
of the page.
Now I have this problem: In one of the objects I use session variables. However i get 
the famous error :Cannot send session cookie - headers already sent by (output 
started 


Is there a way to overcome this problem? I mean: the session variable is registered in 
the main part of the page after the class $this-header is called (which writes 
HTML)... now, I don't think I can register the sessionvariable at the top of my script 
since the value of the session var is determined in the main.class...or can I?

I hope you understand my problem and have some tips for me. Below is some code 
snippets I'm using:

thx and regards 

Wilbert Enserink



class.basebape.php---
  ?php $this-header(); ?// includes a php file which writes HTMLcode functioning as 
the header of the HTML page (i.e. navigation menu)
 ?php $this-main(); ? // includes a php file (main.php) which writes the main part 
of the HTML data
---

---main.php--
echo a lot of HTML depending on queries and stuff;
session_register($variable);



output browser--
Warning: Cannot send session cookie - headers already sent by (output started at 
/opt/guide/www.designmatcher.com/HTML/wwwtest/class.basepage.php:125) in 
/opt/guide/www.abc.com/HTML/wwwtest/phpincludes/main/main.php on line 400
-

-
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-


Re: [PHP] session variables in OOP....

2002-06-14 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then Wilbert Enserink declared
 I hope you understand my problem and have some tips for me. Below is some code 
snippets I'm using:

Actually it's a little tricky to understand ;-)
Have you considered output buffering?
- -- 
Nick Wilson //  www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE9Cdq/HpvrrTa6L5oRAqmzAJ99bcz64l6/lfcIqLz4iGKlTLeJHQCeOmsH
e0lahzjczcVE3aFql/+G6+M=
=Fl/c
-END PGP SIGNATURE-

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




Re: [PHP] session variables in OOP....

2002-06-14 Thread W. Enserink

Hi all,


Nick: thx for the tip, it removed the error, and might further be a good
idea: except:
do you know if I can declare session variables and use them in between the
output buffer statements
like this: (i tried it but it doesn't seem to work)??

greetings Wilbert


include (class.basepage.php);
ob_start();//start the outputbuffering
$object= new basepage; //object basepage which determines which HTML
to output (due to queries and calcultaions)
session_register($variable);
$extra_variable=$variable+1;
echo $extra_variable;
ob_get_contents();//show the buffer
ob_end_flush() ;//clear the buffer




- Original Message -
From: Nick Wilson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 14, 2002 1:59 PM
Subject: Re: [PHP] session variables in OOP


 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1


 * and then Wilbert Enserink declared
  I hope you understand my problem and have some tips for me. Below is
some code snippets I'm using:

 Actually it's a little tricky to understand ;-)
 Have you considered output buffering?
 - --
 Nick Wilson //  www.explodingnet.com



 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.0.6 (GNU/Linux)

 iD8DBQE9Cdq/HpvrrTa6L5oRAqmzAJ99bcz64l6/lfcIqLz4iGKlTLeJHQCeOmsH
 e0lahzjczcVE3aFql/+G6+M=
 =Fl/c
 -END PGP SIGNATURE-

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

- 
Pas de Deux 
Van Mierisstraat 25 
2526 NM Den Haag 
tel 070 4450855 
fax 070 4450852 
http://www.pdd.nl 
[EMAIL PROTECTED] 
-

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




Re: [PHP] session variables in OOP....

2002-06-14 Thread 1LT John W. Holmes

If you want to do it right, don' t output anything, obviously. Instead of
using ECHO, assign all output to a variable within your class. Then, at the
end of the processing, after everything is done, echo out that variable
(which will contain the entire page). Then you can set cookies, sessions,
whatever, at any point.

Or you can use output buffering...

---John Holmes...

- Original Message -
From: Wilbert Enserink [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 14, 2002 7:44 AM
Subject: [PHP] session variables in OOP


Hi all,


I'm busy building a site which uses OOP.
Several classes are used to constuct different sections of the final page to
be displayed.
The overall class is called class.basepage.php
This is the page which outputs HTML and calls other classes to construct
other parts of the page.
Now I have this problem: In one of the objects I use session variables.
However i get the famous error :Cannot send session cookie - headers
already sent by (output started 


Is there a way to overcome this problem? I mean: the session variable is
registered in the main part of the page after the class $this-header is
called (which writes HTML)... now, I don't think I can register the
sessionvariable at the top of my script since the value of the session var
is determined in the main.class...or can I?

I hope you understand my problem and have some tips for me. Below is some
code snippets I'm using:

thx and regards

Wilbert Enserink



class.basebape.php---
  ?php $this-header(); ?// includes a php file which writes HTMLcode
functioning as the header of the HTML page (i.e. navigation menu)
 ?php $this-main(); ? // includes a php file (main.php) which writes the
main part of the HTML data
---

---main.php--
echo a lot of HTML depending on queries and stuff;
session_register($variable);



output browser--
Warning: Cannot send session cookie - headers already sent by (output
started at
/opt/guide/www.designmatcher.com/HTML/wwwtest/class.basepage.php:125) in
/opt/guide/www.abc.com/HTML/wwwtest/phpincludes/main/main.php on line 400
-

-
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-


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




Re: [PHP] session variables in OOP....

2002-06-14 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then W. Enserink declared
 Nick: thx for the tip, it removed the error, and might further be a good
 idea: except:
 do you know if I can declare session variables and use them in between the
 output buffer statements
 like this: (i tried it but it doesn't seem to work)??

Sorry, not sure, I've never actually had cause to use output buffering.
You might want to ask the question specifically in a new thread. In
fact: Please do, I'd be very interested to hear what the others think
;-)
- -- 
Nick Wilson //  www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE9ChHWHpvrrTa6L5oRAiucAJ9Zpydunune2hmPjaBvyMAE9GpYCQCfSJZy
/2SzYVUDutkYu5821iyjscI=
=rBgs
-END PGP SIGNATURE-

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




[PHP] session variables and classes?

2002-05-01 Thread John Ngo

does anyone know if a session variable set within a class is accessible
outside the class and by other pages?



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




RE: [PHP] session variables and classes?

2002-05-01 Thread Jay Blanchard

[snip]
does anyone know if a session variable set within a class is accessible
outside the class and by other pages?
[/snip]

I have not tested this, but I do use sessions quite a bit. All session
variables are registered as global variables and therefore should be
available to other processes and pages. You could perform an easy test by
creating a class containing a registered session variable and attempt to
call that variable from another page.

Jay Blanchard



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




[PHP] Session Variables

2002-04-16 Thread Phil Powell

I understand the concept of session variables, so I want to know the best
methodology of approaching this:

1) HTML redirect to PHP page
2) PHP page looks for session
  a) If found, show some stuff
  b) If not found, prompt user for username and password
3) If no session, prompt user for username and password, once entered  is
ok, set session and redirect

Following is a code snippet I borrowed that I think would work, correct me
if I'm wrong:

// Setting a name for our session.
session_name(hasLoggedIn);
// Starting Session.
session_start();
// Register vars into session
session_register(username);
// Setting values for session vars.
$HTTP_SESSION_VARS[username]=$HTTP_POST_VARS[username];
// Referring a session info to another PHP.
echo A HREF=\somefile.php? . session_name() . = . session_id() .
%s\text/A;

Thanx!!
Phil




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




RE: [PHP] Session Variables

2002-04-16 Thread .ben

I have a function that i call at the beginning of each page (well, those
that require user auth).

checkLogin()

this checks for a positive integer value in a session variable called
intUserID

$_SESSION['intUserID'];

is that isn't a positive integer, i redirect to the login page.

the login is split into two script, prompt and process.  prompt is a form
which  POSTs data to the process script which in turn verifys the
username/password and if valid, assigns $_SESSION['intUserID'] the value of
the users user ID.

all looks fine to me.

 .b

p.s. is it just me or is the reply-to on this list a little odd?

 -Original Message-
 From: Phil Powell [mailto:[EMAIL PROTECTED]]
 Sent: 16 April 2002 22:50
 To: [EMAIL PROTECTED]
 Subject: [PHP] Session Variables


 I understand the concept of session variables, so I want to know the best
 methodology of approaching this:

 1) HTML redirect to PHP page
 2) PHP page looks for session
   a) If found, show some stuff
   b) If not found, prompt user for username and password
 3) If no session, prompt user for username and password, once entered  is
 ok, set session and redirect

 Following is a code snippet I borrowed that I think would work, correct me
 if I'm wrong:

 // Setting a name for our session.
 session_name(hasLoggedIn);
 // Starting Session.
 session_start();
 // Register vars into session
 session_register(username);
 // Setting values for session vars.
 $HTTP_SESSION_VARS[username]=$HTTP_POST_VARS[username];
 // Referring a session info to another PHP.
 echo A HREF=\somefile.php? . session_name() . = . session_id() .
 %s\text/A;

 Thanx!!
 Phil




 --
 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 variables and unset

2002-04-10 Thread Valdas Andrulis

Hello,

I have 3 scripts:

## i2.php
?php
session_start();
$counter = 1;
session_register(counter);
header(Location: /i.php);
?

## i.php
?php
session_start();
$counter = 0;
### uncomment this to see the difference
# session_unregister(counter);
session_register(counter);
unset($counter);
$counter = 4;
session_register(counter);
header(Location: /i1.php);
?

## i1.php
?php
session_start();
print $counter;

?

When I open http://host/i2.php on my browser I get 0, though I expect it
to be 4. If I uncomment session_unregister(counter); I get 4 as
expected.

PHP version 4.1.2.

Anyone can explain this behavior? Also can anyone try this with say
4.0.5 or older version of PHP?

Good luck,

Valdas



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




[PHP] session variables

2002-04-04 Thread Lee, Ford

I seem to have configuration problemsi just can't seem to get
session variables written to in files under win2000, NTFS w/ Apache and
PHP..i've already done everything from session_start() on every page
to making var globalanybody can help??  thanksbtw, i got the
same system on a Linux box running apache and php and it works fine


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




Re: [PHP] session variables

2002-04-04 Thread Wolfram Kriesing

On Thursday 04 April 2002 19:15, Lee, Ford wrote:
 I seem to have configuration problemsi just can't seem to get
 session variables written to in files under win2000, NTFS w/ Apache and
 PHP..i've already done everything from session_start() on every page
 to making var globalanybody can help??  thanksbtw, i got the
 same system on a Linux box running apache and php and it works fine

this is a bug in PHP 4.1.2 on win
   http://bugs.php.net/?id=16423
i am also looking for a workaround  :-(
-- 
Wolfram

... translating template engine 
  http://sf.net/projects/simpletpl

... authentication system 
  http://sf.net/projects/auth

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




RE: [PHP] session variables

2002-04-04 Thread Lee, Ford

I've even tried the new php4apache.dll that was on that bug list and
still did not work.  I'm suprised nobody else has this session problem
on Windows 2000 and Apache...

-Original Message-
From: Wolfram Kriesing [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 04, 2002 12:21 PM
To: Lee, Ford; [EMAIL PROTECTED]
Subject: Re: [PHP] session variables


On Thursday 04 April 2002 19:15, Lee, Ford wrote:
 I seem to have configuration problemsi just can't seem to get
 session variables written to in files under win2000, NTFS w/ Apache
and
 PHP..i've already done everything from session_start() on every
page
 to making var globalanybody can help??  thanksbtw, i got the
 same system on a Linux box running apache and php and it works
fine

this is a bug in PHP 4.1.2 on win
   http://bugs.php.net/?id=16423
i am also looking for a workaround  :-(
-- 
Wolfram

... translating template engine 
  http://sf.net/projects/simpletpl

... authentication system 
  http://sf.net/projects/auth


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




RE: [PHP] session variables

2002-04-04 Thread Lee, Ford

Apparently under the bug report database for bug number 16043, my
exactly problem was described.  According to the PHP team, this
windows/apache1.3.23/php4.1.2 session not writing to file bug has been
fixed in the 4.2.0RC1 binaries.  I've patched my php4apache.dll with the
ones from 4.2.0RC1 AND it still doesn't work!!!  Anyone who used
4.2.0RC1 came across this problem and made it work?


-Original Message-
From: SHEETS,JASON (Non-HP-Boise,ex1) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 04, 2002 12:43 PM
To: Lee, Ford
Subject: RE: [PHP] session variables


This isn't limited to windows 2000, I've seen it on nt and xp as well.
I
believe it is just a php on windows bug in general.  I've heard 4.1.1
was
not broken however 4.1.1 has a security hole, if you are just using
windows
as a test/development platform you may consider trying 4.1.1.

Jason

-Original Message-
From: Lee, Ford [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 04, 2002 10:33 AM
To: Wolfram Kriesing
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] session variables


I've even tried the new php4apache.dll that was on that bug list and
still did not work.  I'm suprised nobody else has this session problem
on Windows 2000 and Apache...

-Original Message-
From: Wolfram Kriesing [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 04, 2002 12:21 PM
To: Lee, Ford; [EMAIL PROTECTED]
Subject: Re: [PHP] session variables


On Thursday 04 April 2002 19:15, Lee, Ford wrote:
 I seem to have configuration problemsi just can't seem to get
 session variables written to in files under win2000, NTFS w/ Apache
and
 PHP..i've already done everything from session_start() on every
page
 to making var globalanybody can help??  thanksbtw, i got the
 same system on a Linux box running apache and php and it works
fine

this is a bug in PHP 4.1.2 on win
   http://bugs.php.net/?id=16423
i am also looking for a workaround  :-(
-- 
Wolfram

... translating template engine 
  http://sf.net/projects/simpletpl

... authentication system 
  http://sf.net/projects/auth


-- 
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 variables

2002-04-04 Thread heinisch

At 04.04.2002  13:18, you wrote:
Apparently under the bug report database for bug number 16043, my
exactly problem was described.  According to the PHP team, this
windows/apache1.3.23/php4.1.2 session not writing to file bug has been
fixed in the 4.2.0RC1 binaries.  I've patched my php4apache.dll with the
ones from 4.2.0RC1 AND it still doesn't work!!!  Anyone who used
4.2.0RC1 came across this problem and made it work?
snip

This isn't limited to windows 2000, I've seen it on nt and xp as well.
I
believe it is just a php on windows bug in general.  I've heard 4.1.1
was
not broken however 4.1.1 has a security hole, if you are just using
windows
as a test/development platform you may consider trying 4.1.1.
snip

You´re on the wrong list, windowsPHPuser is the right one!
This is php-general.
HTH Oliver


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




[PHP] Session Variables

2002-03-25 Thread Chad Gilmer

Hi There,

I am a beginner to PHP and I am tring to use session variables on my site.

I am trying to use Session Variables in PHP on the iPLANIT.tv site

When I use the following code:

?php
 $ses_counter++;

 session_register(ses_counter);

?

I get the following error

Warning: Cannot send session cookie - headers already sent by (output
started at /home/iplanit/public_html/php/login.php:8) in
/home/iplanit/public_html/php/login.php on line 11

Warning: Cannot send session cache limiter - headers already sent (output
started at /home/iplanit/public_html/php/login.php:8) in
/home/iplanit/public_html/php/login.php on line 11

Any Ideas???

Cheers

Chad



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




RE: [PHP] Session Variables

2002-03-25 Thread Rick Emery

it means you've already output some HTML or a blank line


-Original Message-
From: Chad Gilmer [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 12:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Session Variables


Hi There,

I am a beginner to PHP and I am tring to use session variables on my site.

I am trying to use Session Variables in PHP on the iPLANIT.tv site

When I use the following code:

?php
 $ses_counter++;

 session_register(ses_counter);

?

I get the following error

Warning: Cannot send session cookie - headers already sent by (output
started at /home/iplanit/public_html/php/login.php:8) in
/home/iplanit/public_html/php/login.php on line 11

Warning: Cannot send session cache limiter - headers already sent (output
started at /home/iplanit/public_html/php/login.php:8) in
/home/iplanit/public_html/php/login.php on line 11

Any Ideas???

Cheers

Chad



-- 
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 variables in functions....

2001-11-20 Thread wim van houts

Somebody knows why I cannot reach the $HTTP_SESSION_VARS in a function 

For example, why does this not output the en-US string three times:

?
  session_register(LangID);
  $HTTP_SESSION_VARS[LangID] = en-US;
  echo($HTTP_SESSION_VARS[LangID]);
  echo(**);
  function CurrentLang(){
$language = $HTTP_SESSION_VARS[LangID];
echo($language);
  }
  CurrentLang();
  echo(**);
  echo($HTTP_SESSION_VARS[LangID]);

?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




<    1   2   3   >