[PHP] Re: session_id() is not passed to the next page

2011-01-04 Thread Al



On 1/3/2011 11:46 PM, Michelle Konzack wrote:

Hello,

I am rewriting currently a login script and I encountered a problem with
sessions.  While reading the two pages

 
 

I have not found a solution for my problem:

8<--
function fncLogin($user, $pass, $redirect, $type='pam') {

   if ($user != '' and $pass != '') {

 $TEXT  = "Error\n";
 $TEXT .= "\n";
 $TEXT .= "The username does not exist or the password is wrong.\n";
 $TEXT .= "\n";
 $TEXT .= "Please goback  and 
try it again.\n";

 if ($type == 'pam') {

   if (pam_auth($user, $pass,&$PAM_ERR) === FALSE) {
 fncError('2', $TEXT, $errpage='false');
 exit();
   }

 } elseif ($type == 'shadow') {

   $shadow_file = DIR_HOST . "/.shadow";
   if (is_file($shadow_file)) {

 $SHADOW = exec("grep \"^" . $user . ":\" " . DIR_HOST . "/.shadow |cut -d: 
-f2");
 if (empty($SHADOW)) {
 }

 $SALT=exec("grep \"^$user:\" " . DIR_HOST . "/.shadow |cut -d: -f2 |cut -d$ 
-f1-3");
 $ENCRYPTED=crypt($pass, $SALT);
 if ($SHADOW != $ENCRYPTED) {
   fncError('2', $TEXT, $errpage='false');
   exit();
 }

   } else {
 $TEXT  = "Error\n";
 $TEXT .= "\n";
 $TEXT .= "This is a system error. I can not authenticate du to a missing 
config.\n";
 $TEXT .= "\n";
 $TEXT .= "Please inform thesysadmin  and 
try it later again.\n";
 fncError('1', $TEXT, $errpage='false');
 exit();
   }
 }

 session_register('sess_user');
 session_register('sess_timeout');
 $sess_user= $user;
 $sess_timeout = time() + 900;
 session_write_close();
 header("Location: " . $redirect);
   }
   exit();
}
8<--

which call the following page correctly, but the two vars $sess_user and
$sess_timeout are empty.

Can someone please tell me how to do this?

Thanks, Greetings and nice Day/Evening
 Michelle Konzack



Firefox has a great add-on that lets you see the server/client handshaking 
headers httpFox e.g., Cookie:   PHPSESSID=fc310ca5f2c708988bf456f691cc58c2


Thus you can easily see if PHPSESSID is set and returned to the server.

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



[PHP] Re: session_id() is not passed to the next page

2011-01-03 Thread Michelle Konzack
Hello Adam Richardson,

Am 2011-01-04 00:14:30, hacktest Du folgendes herunter:
> session_register() registers global variables, but you're inside a function.
> 
> Set the session values using this technique instead:
> 
> $_SESSION['sess_timeout'] = time() + 900;

Thanks, I have already tried this and it does not work...

> Adam

Thanks, Greetings and nice Day/Evening
Michelle Konzack

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsyst...@tdnet France EURL   itsyst...@tdnet UG (limited liability)
Owner Michelle KonzackOwner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz Kinzigstraße 17
67100 Strasbourg/France   77694 Kehl/Germany
Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

  
 

Jabber linux4miche...@jabber.ccc.de
ICQ#328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/


signature.pgp
Description: Digital signature