From: angelo Rigo <angelo_rigo@yahoo.com.br>
To: pgsql-php@postgresql.org
Subject: login script
Date: Wed, 18 Jun 2003 10:50:38 -0300 (ART)
Message-ID: <20030618135038.82409.qmail@web14803.mail.yahoo.com> (raw)
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 work anymore with php4.2.2?
Is there an alternative to do this?
thank´s in advance
<?php
$db = pg_connect("dbname=db user=user");
$nome = $_POST['nome'];
$senha = $_POST['senha'];
$sql = "SELECT * FROM usuario WHERE nome ='$nome';";
$resultado = pg_exec($db, $sql);
$linhas = pg_numrows($resultado);
if($linhas==0) //testa se a consulta retornou algum registro
{
echo"<html><body>";
echo"<p align=\"center\">User not found!</p>";
echo"<p align=\"center\"><a href=\"index.html\">Voltar</a></p>";
echo"</body></html>";
}
else
{
if ($senha != pg_result($resultado, 0, "senha")) //confere senha
{
echo"<html><body>";
echo"<p align=\"center\">Incorrect password</p>";
echo"<p align=\"center\"><a href=\"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ço, mais segurança e gratuito: caixa postal de 6MB, antivírus, proteção contra spam.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: angelo_rigo@yahoo.com.br
Subject: Re: login script
In-Reply-To: <20030618135038.82409.qmail@web14803.mail.yahoo.com>
References: <20030618135038.82409.qmail@web14803.mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox