login script

--0-220997998-1055944238=:81214
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi !

I do have a login script in pgsql/php
and it is not working anymore. i develop in php 4.0.6 and now i am using =
php4.2.2. My doubt is about these lines:
setcookie("");
header("Location:http://www.domain.com/pg_inic.php");

that are set when the user and pass are correct. These lines does not wo=
rk anymore with php4.2.2?
Is there an alternative to do this?
thank=B4s in advance


<?php
$db =3D pg_connect("dbname=3Ddb user=3Duser");
$nome =3D $_POST['nome'];
$senha =3D $_POST['senha'];
$sql =3D "SELECT * FROM usuario WHERE nome =3D'$nome';";
$resultado =3D pg_exec($db, $sql);
$linhas =3D pg_numrows($resultado);
if($linhas=3D=3D0) //testa se a consulta retornou algum registro
{
echo"<html><body>";
echo"<p align=3D\"center\">User not found!</p>";
echo"<p align=3D\"center\"><a href=3D\"index.html\">Voltar</a></p>";
echo"</body></html>";
}
else
{
if ($senha !=3D pg_result($resultado, 0, "senha")) //confere senha
{
echo"<html><body>";
echo"<p align=3D\"center\">Incorrect password</p>";
echo"<p align=3D\"center\"><a href=3D\"index.html\">Voltar</a></p>";
echo"</body></html>";
}
else {
setcookie("");
setcookie("");
header("Location:http://www.comain.com/pg_inic.php");
}
}
pg_close($db);
?>



---------------------------------
Yahoo! Mail
Mais espa=E7o, mais seguran=E7a e gratuito: caixa postal de 6MB, antiv=ED=
rus, prote=E7=E3o contra spam.
--0-220997998-1055944238=:81214
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

<DIV>Hi !</DIV>
<DIV> </DIV>
<DIV>I do have a login script in pgsql/php </DIV>
<DIV>and it is not working anymore. i develop in php 4.0.6 and now i am u=
sing php4.2.2. My doubt is about these lines:
<DIV> </DIV>
<DIV>   setcookie("");<BR>  header("Location:htt=
p://www.domain.com/pg_inic.php");</DIV>
<DIV> </DIV> that are set when the user and pass are correct. These =
lines does not work anymore with php4.2.2?</DIV>
<DIV>Is there an alternative to do this?</DIV>
<DIV>thank=B4s in advance</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><?php</DIV>
<DIV>$db =3D pg_connect("dbname=3Ddb user=3Duser");<BR>$nome =3D $_POST['=
nome'];<BR>$senha =3D $_POST['senha'];</DIV>
<DIV>$sql =3D "SELECT * FROM usuario WHERE nome =3D'$nome';";<BR>$resulta=
do =3D pg_exec($db, $sql);<BR>$linhas =3D pg_numrows($resultado);<BR>if($=
linhas=3D=3D0)    //testa se a consulta retornou algu=
m registro<BR> {<BR>  echo"<html><body>";<BR>&=
nbsp; echo"<p align=3D\"center\">User not found!</p>";<B=
R>  echo"<p align=3D\"center\"><a href=3D\"index.html\=
">Voltar</a></p>";<BR>  echo"</body></h=
tml>";<BR> }<BR> else<BR> {<BR>  if ($senha !=
=3D pg_result($resultado, 0, "senha"))   //confere senha</DIV>
<DIV> {<BR>  echo"<html><body>";<BR> &nbs=
p;echo"<p align=3D\"center\">Incorrect password</p>";<BR>&nbs=
p; echo"<p align=3D\"center\"><a href=3D\"index.html\">V=
oltar</a></p>";<BR>  echo"</body></html>=
;";<BR> }<BR> else  {<BR>  setcookie("");<BR>&nb=
sp; setcookie("");<BR>  header("Location:http://www.comain=
..com/pg_inic.php");<BR>  }<BR> }<BR> pg_close($db);<B=
R>?></DIV><p><br><hr size=3D1><b><a href=3D"http://br.mail.yahoo.com/"=
>Yahoo! Mail </a></b><br>
Mais espa=E7o, mais seguran=E7a e gratuito: caixa postal de 6MB, antiv=ED=
rus, prote=E7=E3o contra spam.
--0-220997998-1055944238=:81214--
angelo_rigo [ Mi, 18 Juni 2003 15:50 ] [ ID #46354 ]

Re: login script

At 15:50 18.06.2003, angelo Rigo said:
--------------------[snip]--------------------
>Hi !
>
>I do have a login script in pgsql/php
>and it is not working anymore. i develop in php 4.0.6 and now i am using
>php4.2.2. My doubt is about these lines:
>
> setcookie("");
> header("Location:http://www.domain.com/pg_inic.php");
--------------------[snip]--------------------

AFAIK you need to have a blank between "Location:" and the actual URL.

This should work:
header("Location: http://www.domain.com/pg_inic.php");

Or... what exactly do you mean with "it is not working anymore"? You might
also consider asking on the PHP General list (php-general [at] lists.php.net).


--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html
Ernest E Vogelsinger [ Mi, 18 Juni 2003 15:56 ] [ ID #46355 ]
Datenbanken » gmane.comp.db.postgresql.php » login script

Vorheriges Thema: Making PHP and Postgres easy
Nächstes Thema: Cleaning up aborted transactions