示例#1
0
             $_SESSION['username'] = $_POST['username'];
             $message = msgSignedIn($_POST['username']);
             include_once 'views/list.php';
         } else {
             $error = "Username or password is not correct";
             include_once 'views/login.php';
         }
         exit;
     }
     break;
 case 'logout':
     session_destroy();
     session_start();
     $db = new PDO(DB_INFO, DB_USER, DB_PASS);
     $dreams = new Dreams($db);
     $d = $dreams->getDreams();
     // Send the user back to their last location
     $message = msgSignedOut();
     include_once 'views/list.php';
     break;
 case 'addcomment':
     if (!empty($_POST['content'])) {
         // Include database connection
         $db = new PDO(DB_INFO, DB_USER, DB_PASS);
         $comments = new Comments($db);
         $comments->addcomment($_POST);
         header('location: ' . $loc);
         exit;
     }
     break;
 case 'deletecomment':