Jump to content
Fórum Script Brasil
  • 0

Ai Galera Erro Em Sessao


setokaiba

Question

alguém sabe por que esse erro????????

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/kennel/public_html/db.php:19) in /home/kennel/public_html/livro2/logon_confirm.php on line 17

$userid="$userid";
$d="$pass";
include("../db.php");

$resultado = mysql_query("SELECT * FROM cliente WHERE nome='$userid' and codigo = '$d'");
$num_linhas = mysql_num_rows($resultado);
if ($num_linhas == 0){
    echo "Usuário ou senha inválidos<br>";
    echo "<a href=javascript:history.go(-1)>Voltar</a>";
}else{
    while ($linha=mysql_fetch_array($resultado)){

        $id_user=$linha["nome"];
        $nome_user=$linha["id"];
        session_start();
        session_register('id_user','nome_user');
$se = true;
}

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

inicie sua página com session_start(); deve ficar mais ou menos assim

session_start();
if (!session_is_registered('nome_user'){
$userid="$userid";
$d="$pass";
include("../db.php");
$resultado = mysql_query("SELECT * FROM cliente WHERE nome='$userid' and codigo = '$d'");
$num_linhas = mysql_num_rows($resultado);
if ($num_linhas == 0){
   echo "Usuário ou senha inválidos<br>";
   echo "<a href=javascript:history.go(-1)>Voltar</a>";
}else{
   while ($linha=mysql_fetch_array($resultado)){

       $id_user=$linha["nome"];
       $nome_user=$linha["id"];
       //session_start(); tinha q tirar daqui, editei o post
       session_register('id_user','nome_user');
       $se = true;
}
if ($se){
sessão OK, vai p outra pg?
}
 }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      651.8k
×
×
  • Create New...