Обсуждение: login script

Поиск
Список
Период
Сортировка

login script

От
angelo Rigo
Дата:
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.

Re: login script

От
Ernest E Vogelsinger
Дата:
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@lists.php.net).


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