Re: destroing $PHP_AUTH_USER and $PHP_AUTH_PASS

From: Date: Thu, 29 Jun 2000 22:10:06 +0000
Subject: Re: destroing $PHP_AUTH_USER and $PHP_AUTH_PASS
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-3917@lists.php.net to get a copy of this message
On Thu, 29 Jun 2000, you wrote: Sorry for the fast send. made some mistakes in typing. It's $PHP_AUTH_PW wherever you see $PHP_AUTH_PASS. My mistake, should have double checked the mail before sending. The problem, still is that when the authentification is wrong, I want to unset $PHP_AUTH_USER, and PHP isn't doing it. Am I doing something wrong? > I have a piece of code that asks for a user name and password usin html 4.0's > www-authenticate header. The problem is that I cant unset the username and > password for a new authentification, if it fails. the code is like this: > > <? > if (! isset($PHP_AUTH_USER)) { > // User doesn't exist. Encourage user to enter username and password. > > Header("WWW-Authenticate: carga basica=\"Carga de datos\""); > Header("HTTP/1.0 401 Unauthorized"); > echo "No se puede cargar datos si no es un usuario autorizado.\n"; > exit; > }else{ > $usuario=$PHP_AUTH_USER; > > // encrypt password > > $passfr=md5($PHP_AUTH_PASS); > $conn_id=ifx_pconnect("diario","informix","password"); > > // look if the username and password is in database. > > $q_auth=sprintf("SELECT u_nombre,u_password FROM usuario > WHERE u_nombre=\"%s\" AND u_password=\"%s\" ", > $usuario,$passfr); > $q_id=ifx_query($q_auth,$conn_id); > $q_ar_auth=ifx_fetch_row($q_id); > if (! $q_ar_auth){ > > // user + pass is not in the database. destroy $PHP_AUTH_USER and reload > // index.php > > unset($PHP_AUTH_USER); > header("location: index.php"); > }else{ > > // destroy the password holding variable and redirect to diario.php > > unset($PHP_AUTH_PASS); > header("Location: diario.php"); > } > } > ?> > > Any idea? > > -- > "And I'm happy, because you make me feel good, about me." - Melvin Udall > ----------------------------------------------------------------- > Martín Marqués email: martin@math.unl.edu.ar > Santa Fe - Argentina http://math.unl.edu.ar/~martin/ > Administrador de sistemas en math.unl.edu.ar > ----------------------------------------------------------------- > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- "And I'm happy, because you make me feel good, about me." - Melvin Udall ----------------------------------------------------------------- Martín Marqués email: martin@math.unl.edu.ar Santa Fe - Argentina http://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar -----------------------------------------------------------------

« previous php.general (#3917) next »