Get help on this challenge


Please read this explanation before attempting debugging challenges.

This php should log me in when I enter the username "BOB" and the password "bobspass", but it always says "You are not logged in." when I do it. What's wrong?

Here is the file "debugging13-1.php".

//By ynori7
if(isset($_POST['username']) && isset($_POST['password'])){
  if($_POST['username']==="BOB" && $_POST['password']==="bobspass"){
    $_SESSION['login'] = "T";
    $_SESSION['user'] = "BOB";
if(!isset($_SESSION['login']) || $_SESSION['login']!=='T'){
  echo "<html>
<form action='' method='post'>
 Username: <input type='text' name='username'><br/>
 Password: <input type='password' name='password'><br/>
 <input type='submit' name='submit' value='submit'>
  header("Location: debugging13-2.php");

Here is the file "debugging13-2.php".

//By ynori7
  echo "<p>Welcome {$_SESSION['user']}.</p>\n";
  $date = gmdate("M d Y H:i:s");
  echo "<p>The current date and time is $date GMT.</p>\n";
  echo "<p>You are not logged in.</p>\n";

Downloadable source code can be found here and here.

You must be logged in to play. Login or register here

Challenge by ynori7.