Hi,
I have some basic code that I place at the header of every page to make sure that the user is logged in. I was hoping someone could take a look at it and give me some suggestions:
if ($_SESSION['logged_in'] == 1) {
$handle = dbconnect::init;
$result = $handle->select()->from('session_id')
->where('session_id=?', $_SESSION['SID'])
->columns('ip');
$check = $result->fetchAll();
if ($check[0]->ip != $_SERVER['REMOTE_ADDR']) { //user has changed networks
// or someone is trying
// to switch cookies on us
return false;
}
} else {
return false;
}
Thanks!