Jump to content
Sign in to follow this  
pipaspfma

Session não actualiza

Recommended Posts

pipaspfma

Boas, estou com um problema, estou a criar um site mas quando o utilizador faz login o valor das SESSION não se altera,não compreendo porque :S

na pagina da verificação tenho

<?php
if(!isset($_SESSION))
{
session_start();
$_SESSION["login"] = 0;
$_SESSION['id_user'] = 0;        
$_SESSION['user'] = 0;
}

quando verifico o nome de utilizador e password tenho

while($row = mysql_fetch_array($result))
  {
  if (($user == $row['user']) and ($pass == $row['pass'])){
	$_SESSION['login'] = 1;
	$_SESSION['id_user'] = $row['id_user'];        
	$_SESSION['user'] = $row['user'];  
	header("Location: index.php");
}

o que mais me chateia nisto é que se puser header("Location: index.php?a=".$_SESSION['login']); ele escreve o valor 1

Depois na pagina index ele atribui o valor de 0 a cada session =(

Share this post


Link to post
Share on other sites
pipaspfma

Já resolvi :S

<?php
session_start();
if(!isset($_SESSION))
{
$_SESSION["login"] = 0;
$_SESSION['id_user'] = 0;        
$_SESSION['user'] = 0;
}

// tinha o session_start dentro do if -.-

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.