Salve, io ho attivato la gestione degli errori ,
solo che alcune volte mi saltano fuori questi:
Notice: Undefined index: logged_in in D:\xampp\htdocs\01_login\functions.php on line 8
Il codice è questo:
Mi dite come valorizzo i valori e per far che dopo ci pensa php a riempirli?
Grazie mille.
solo che alcune volte mi saltano fuori questi:
Notice: Undefined index: logged_in in D:\xampp\htdocs\01_login\functions.php on line 8
Il codice è questo:
PHP:
function checkLogin($levels)
{
global $db;
if(!$_SESSION['logged_in']) // dovrebbe essere questa.
{
$access = FALSE;
}
else {
$kt = explode(' ', $levels);
$query = $db->query('SELECT Level_access FROM users WHERE ID = "'.mysql_real_escape_string($_SESSION['user_id']).'"');
$row = mysql_fetch_assoc($query);
$access = FALSE;
while(list($key,$val)=each($kt))
{
if($val==$row['Level_access'])
{//if the user level matches one of the allowed levels
$access = TRUE;
}
}
}
if($access==FALSE)
{
header("Location: login.php");
}
else {
//do nothing: continue
}
}
Mi dite come valorizzo i valori e per far che dopo ci pensa php a riempirli?
Grazie mille.