The error is here:
if($admin_username && $admin_password && $admin_token == session_id())
It seems quite likely this is line 63. The problem is you are only defining $admin_username
if $_SESSION['admin_username']
is set.
Although you don’t show it in your code example, I’d presume that the same thing is true of $signin_username
.
Solution #1 – use isset
There are a number of solutions to your problem. The first, and perhaps simplest, is to check that the variables are set before checking their value.
if (isset($admin_username, $admin_password, $admin_token) && session_id() == $admin_token)
Solution #2 – define defaults
If there are default values for the variables before checking to see if the corresponding $_SESSION
variables exist, no error can occur:
$admin_username = $admin_password = $admin_token = FALSE;
if(isset($_SESSION['admin_username'])){ $admin_username = $_SESSION ['admin_username']; }
if(isset($_SESSION['admin_password'])){ $admin_password = $_SESSION['admin_password']; }
if(isset($_SESSION['admin_token'])){ $admin_token = $_SESSION['admin_token']; }
Solution #3 – define when missing
If these variables are defined irrespective of whether the relevant $_SESSION
variable exists, again these error cannot occur:
$admin_username = isset($_SESSION['admin_username']) ? $_SESSION['admin_username'] : FALSE;
$admin_password = isset($_SESSION['admin_password']) ? $_SESSION['admin_password'] : FALSE;
$admin_token = isset($_SESSION['admin_token']) ? $_SESSION['admin_token'] : FALSE;
2
solved Notice: Undefined variable: [closed]