thank you for your help
That's exactly what i think i'm doing. The problem is that with register_globals OFF it works, and because in my host they'r ON, then it doesnt work; while i wait for a response from them, i use cookies...
here's my code:
<?php session_start();
$checkbox=$_POST['cookieuser'];
if (isset($checkbox)) {
$expiry = 60*60*24*365;
setcookie('uid', $_POST['uid'], time()+$expiry, "/" );
setcookie('pwd', $_POST['pwd'], time()+$expiry, "/" );
}
$uid=isset($_POST['uid']) ? $_POST['uid'] : $_SESSION['uid'];
$pwd=isset($_POST['pwd']) ? $_POST['pwd'] : $_SESSION['pwd'];
if (isset($_POST['uid'])) {
$_SESSION['uid'] = $_POST['uid'];
$_SESSION['pwd'] = $_POST['pwd'];
}
include("common.php"

;
include("db.php"

;
if ($_COOKIE['uid']) { $uid=($_COOKIE['uid']);
$pwd=($_COOKIE['pwd']);
}
if(!isset($uid)) {
?>
<html>
<head>
<title>Login</title>
<link rel = "Stylesheet" type="text/css" href = "php.css" />
</head>
<body>
<div class = "beta">
<?php
include ("a.php"

;
?>
<h2>Registo obrigatório</h2>
<div class = "central"><p>Tem de fazer login para aceder a esta área do site.</p>
<form method="post" action="<?=$_SERVER['$PHP_SELF']?>">
<table>
<tr>
<td align="right">Nome:</td>
<td><input type="text" name="uid" size="8"></td>
</tr>
<tr>
<td align="right">Palavra passe:</td>
<td><input type="password" name="pwd" SIZE="8"></td>
</tr>
<tr><td align="right">Guardar os meus dados</td>
<td><input type="checkbox" name="cookieuser" checked /></td> </tr>
<tr>
<td></td>
<td><input type="submit" value="Login"></td>
</tr>
</table>
</form></div></div>
</body>
</html>
<?php
exit;
}
$_SESSION['uid'] = $uid;
$_SESSION['pwd'] = $pwd;
dbConnect("***"

;// function that deals with database credentials
$sql = "SELECT * FROM autores WHERE nome = '$uid' AND palavrapasse = '$pwd'";
$result = mysql_query($sql);
if (!$result) {
error("Ocorreu um erro na base de dados ao verificar os seus dados".
".\\nSe este erro persistir ".
"contacte webmaster@***."

;
}
$id=mysql_result($result,0,"id"

;
$_SESSION['id'] = $id;
$idcategoria=mysql_result($result,0,"idcategoria"

;
$_SESSION['idcategoria'] = $idcategoria;
if (mysql_num_rows($result) == 0) {
if (isset($checkbox)) {
setcookie('uid', $uid, time()-$expiry, "/" );
setcookie('pwd', $pwd, time()-$expiry, "/" );
}
unset($_SESSION['uid']);
unset($_SESSION['pwd']);
?>
<html>
<head>
<title>Acesso negado</title>
<link rel = "Stylesheet" type="text/css" href = "php.css" />
</head>
<body>
<div class = "beta">
<?php
include ("a.php"

;
?>
<h2 class="v">Acesso negado</h2>
<p>O seu nome ou palavra passe estão incorrectos, ou então não é um utilizador registado neste site. Para tentar novamente, clique
<a href="<?=$_SERVER['PHP_SELF']?>">aqui</a>. Para se registar imediatamente, clique <a href="signup.php">aqui</a>.</p>
</div>
</body>
</html>
<?php
exit;
}
$username = mysql_result($result,0,"nomecompleto"

;
?>