RE: [PHP] Sessions and login

2003-06-12 Thread Ford, Mike [LSS]
 -Original Message-
 From: Angelo Zanetti [mailto:[EMAIL PROTECTED]
 Sent: 11 June 2003 14:09
 
 session_register('user');
$_SESSION['user'] = ebusUser;

Just one other quick point here: if you use the $_SESSION array, you don't
need to -- and, in fact, should not -- use session_register() and friends.

Cheers!

Mike

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

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



RE: [PHP] Sessions and login

2003-06-11 Thread Wim Paulussen
page 1 : login.php

input user name - Post veriable
input password- post variable

page 2 : verify.php
session_start()

// supposing name is entered
if (!$_POST['password'] == )
{
// verification against database
if (successfully authenticated)
{
$_SESSION['user']   = $_POST['user'];
header(location: authPage.php);
}
}
header(location: login.php); // returns back to login page

-Oorspronkelijk bericht-
Van: Angelo Zanetti [mailto:[EMAIL PROTECTED]
Verzonden: Wednesday, June 11, 2003 3:09 PM
Aan: [EMAIL PROTECTED]
Onderwerp: [PHP] Sessions and login


Hi guys kinda new to php.

Ok I have a php page that a user has to enter a pw to gain access to another
page (lets call it authPage).However before I i can grant access to authPage
I want to verify 1. that a pw was entered and 2. that it is correct. So I
thought it would be better NOT to do the auth in authPage but rather have
another page that does the authorization. Lets call that page verifyPage. On
here if the password is entered and is correct according to the DB then I
want to create and register a session. This is how ive done the session
section:

session_register('user');
   $_SESSION['user'] = ebusUser;


Then I want the session to call authPage (because the pw is correct)
together with the session variable. The way I am doing this (doesnt seem to
be working) is to call authPage with as a header call eg:

header(Location: authPage.php);

The problem I think I am having is that the session variable isnt being
passed to the authPAge. How else can I call the authPage from verifyPage so
that the session variable gets passed. BTW I have register_globals = on;

Any help would be greatly appreciated.

Angelo


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



Re: [PHP] Sessions and login

2003-06-11 Thread Mario Oberrauch
... [shortened]

 Then I want the session to call authPage (because the pw is correct) together with 
 the session variable. The way I am doing this (doesnt seem to be working) is to call 
 authPage with as a header call eg: 
 header(Location: authPage.php);
 
 The problem I think I am having is that the session variable isnt being passed to 
 the authPAge. How else can I call the authPage from verifyPage so that the session 
 variable gets passed. BTW I have register_globals = on;

...

Hi

try one of the following:
- header(Location: authPage.php?. session_name() .=. session_id());
- enabling session.use_trans_sid in php.ini

IMO latter is unpreferable.

, mario



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



RE: [PHP] Sessions and login

2003-06-11 Thread Ford, Mike [LSS]
 -Original Message-
 From: Wim Paulussen [mailto:[EMAIL PROTECTED]
 Sent: 11 June 2003 14:28
 
 page 1 : login.php
 
 input user name - Post veriable
 input password- post variable
 
 page 2 : verify.php
 session_start()
 
 // supposing name is entered
 if (!$_POST['password'] == )

Strange syntax -- I'd prefer:

  if ($_POST['password'] != )

 {
   // verification against database
   if (successfully authenticated)
   {
   $_SESSION['user']   = $_POST['user'];
   header(location: authPage.php);

To cover all bases, you need to include the SID constant here, so it still
works for people who don't accept cookies.  Oh, and the header name must be
Location (note capital L) to conform with the standard, and the URL should
be an absolute one -- some fussy browsers won't do the redirection properly
if this isn't 100% correct:

header(Location: http://your.site.name/path/to/authPage.php?.SID);

Cheers!

Mike

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

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