示例#1
0
             header('location: ' . $loc);
             exit;
         }
         $dreams->addDream($_POST);
         header('location: /get-lucid/dreams/' . $url);
     }
 case 'dreams':
     // Include database connection
     $db = new PDO(DB_INFO, DB_USER, DB_PASS);
     $dreams = new Dreams($db);
     $comments = new Comments($db);
     if ($url == NULL) {
         $d = $dreams->getDreams();
         include_once 'views/list.php';
     } else {
         $d = $dreams->getDream($url);
         $c = $comments->getComments($d['id']);
         include_once 'views/dream.php';
     }
     break;
 case 'adduser':
     if (isset($_GET['action'])) {
         include_once 'views/adduser.php';
     } else {
         if ($_POST['submit'] == "Cancel") {
             // Check if the user clicked cancel, if so don't submit
             header('location: ' . $loc);
             exit;
         }
         // Include database connection
         $db = new PDO(DB_INFO, DB_USER, DB_PASS);