Jump to content
Fórum Script Brasil
  • 0

Criar e destruir SESSION


Marcos Guiga

Question

Estou com um problema, toda vez que um usuario faz o login e criada uma session, porem na consigo encerrar a session

deem uma olha no cod e me ajudem:

LOGIN.PHP

<title>Conferindo Dados</title>
<?php
$user = $_POST['user'];
$pass = $_POST['pass'];
$id   = rand(1,999999);
 include("bd.php");
if(($user==$user) && ($senha==$senha)){
  $_SESSION['login'] = $l;
 echo "<script>location.href='main.php?usuario=$user$id'</script>";
} else{
 echo "<font face=verdana size=2>";
 echo "Usuário ou senha incorretos!";
 echo "<br>";
 echo "<a href=login.html>";
 echo "Clique aqui</a> para tentar novamente.";
 echo "</a></font>";
 }
?>
MAIN.PHP
<?php     include("bd.php");
echo "<div align=right><font size=2px>Olá <b>$nome</b>, Bem Vindo! | <a href=suaconta.php>Configurações</a> | <a href=logout.php>Sair</a></font></div>"; 
$_SESSION['login'];
else{
echo '<meta http-equiv="refresh" content="0;url=login.html">';
exit; 
}
?>
LOGOUT.php
<?php

session_start();
session_destroy();
header("location:index.html");

?>

qaundo clico para fazer o logout ele rederiona pra index como combinado, porem quando vou fazer o login o usuario anterior ainda esta logado

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

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
      652k
×
×
  • Create New...