Example #1
0
    $mentors = $db->getMentors();
    // close helper
    $db->close();
    // no session
} else {
    // check if loggin in
    if (array_key_exists("login", $_POST) && $_POST["login"] == 1) {
        // check if username and login exists
        if (array_key_exists("username", $_POST) && array_key_exists("password", $_POST)) {
            // get data
            $username = $_POST["username"];
            $password = $_POST["password"];
            // create helper
            $db = new DBHelperClass();
            // check if correct login
            if ($db->login($username, $password)) {
                // correct, so set cookie
                setcookie("t9hacks_login", "1", time() + 60 * 60 * 24);
                // close helper
                $db->close();
                // relocate to same page without post data
                header('Location: view.php');
            }
            // close helper
            $db->close();
        }
    }
}
//echo '<pre>' . print_r($participants, true) . '</pre>';
?>