$status = $userDAO->insert($user);
                if ($status) {
                    $token = new AuthToken();
                    $token->setUser($user);
                    $tokenDAO = AuthTokenDAO::getInstance();
                    $status = $tokenDAO->insert($token);
                    if ($status) {
                        $session->setMessage("Registration started. Check your email for a message to continue");
                        if (defined("SMTP_HOST") && strcmp(SMTP_HOST, "") != 0) {
                            $from_addr = EMAIL_ADDRESS;
                            //$to = "*****@*****.**";
                            $to = "{$form_values["ulid"]}@" . User::ISU_EMAIL_DOMAIN;
                            $subject = "Verify registration with " . SITE_NAME;
                            $body = "To start the next step of the registration process, click the verify link below and enter the requested information. If the URL does not appear as a link, copy the URL, paste it into your browser's address bar and proceed to the web page.\n\n" . joinPath(BASE_URL, "verify.php") . "?token={$token->getToken()}\n";
                            $headers = array("From" => $from_addr, "To" => $to, "Subject" => $subject);
                            $stmp = Mail::factory("smtp", array("host" => SMTP_HOST, "auth" => true, "username" => SMTP_USERNAME, "password" => SMTP_PASSWORD));
                            $mail = $stmp->send($to, $headers, $body);
                        }
                        header("Location: " . BASE_URL);
                        return;
                    }
                }
            }
        }
        $user = $session->getUser();
        $this->template->render(array("title" => "Register", "main_page" => "register_tpl.php", "user" => $user, "session" => $session, "form_errors" => $form_errors, "form_values" => $form_values));
    }
}
$controller = new RegisterController();
$controller->run();
示例#2
0
<?php

//try {
include "includer.php";
$url = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
//echo "URL: $url <br>";
$urlPieces = split("/", $url);
//print_r($urlPieces);
if (count($urlPieces) < 2) {
    $control = "none";
} else {
    $control = $urlPieces[2];
}
switch ($control) {
    case "login":
        LoginController::run();
        break;
    case "register":
        RegisterController::run();
        break;
    default:
        HomeView::show();
}
//} catch (Exception $ex) {
//}
?>