login script - Mailing list pgsql-php

From angelo Rigo
Subject login script
Date
Msg-id 20030618135038.82409.qmail@web14803.mail.yahoo.com
Whole thread Raw
Responses Re: login script  (Ernest E Vogelsinger <ernest@vogelsinger.at>)
List pgsql-php
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.

pgsql-php by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Cleaning up aborted transactions
Next
From: Ernest E Vogelsinger
Date:
Subject: Re: login script