Yes that line is in register.php, but I mean that $reg hasn't been assigned to anything. If you enable your error reporting:
Code:
ini_set('display_errors', 1);
error_reporting(E_ALL);
You should trigger the error:
Code:
Notice: Undefined variable: $reg in xx/register.php on line ?
Therefore assigning $_SESSION['user_id'] to null. Null will not pass an isset check, so the loggedin will return false.