Beispiel #1
0
    //get username if sended
    $password = sotf_Utils::getParameter('password');
    //get password if sended
    $a_number = sotf_Utils::getParameter('a_number');
    //get activisation number
}
if (isset($portal_id)) {
    if (isset($username) and isset($password)) {
        $user = new portal_user($portal_id, $username, $password);
        //create user object with given data
        if (isset($a_number)) {
            if (!$user->activateUser($portal_id, $username, $password, $a_number)) {
                $page->redirect($_SERVER["PHP_SELF"] . "?login=1&activate=1&uname={$username}");
            } else {
                //create new user object
                $user = new portal_user($portal_id, $username, $password);
            }
        }
        //create user object with given data
        if ($user->loggedIn()) {
            $page->redirect($_SERVER["PHP_SELF"]);
        }
        //redirect page
        if ($user->getActivated()) {
            $page->redirect($_SERVER["PHP_SELF"] . "?login=1&activate=1&uname={$username}");
        } else {
            $page->redirect($_SERVER["PHP_SELF"] . "?login=2&uname={$username}");
        }
        //redirect to login page if bad login
    } else {
        $user = new portal_user($portal_id);
require "init.inc.php";
require "{$classdir}/sotf_Portal.class.php";
if (strpos($_SERVER['PHP_SELF'], "portal_login.php")) {
    $page->redirect($rootdir . "/portals.php");
}
//if called directly
$portal_name = substr($_SERVER["PATH_INFO"], 1);
//if (!isset($_SERVER["PATH_INFO"]) OR ($portal_name == "")) die("Error 404!");	//needs the information which portal
$portal = new sotf_Portal($portal_name);
$portal_id = $portal->getId();
if ($portal_id == NULL) {
    $page->redirect($rootdir . "/portals.php");
}
////user login and logout////
$username = sotf_Utils::getParameter('username');
//get username if sended
$password = sotf_Utils::getParameter('password');
//get password if sended
if (isset($username) and isset($password)) {
    $user = new portal_user($portal_id, $username, $password);
    //create user object with given data
    if ($user->loggedIn()) {
        $page->redirect($_SERVER["PHP_SELF"]);
    } else {
        $page->redirect($_SERVER["PHP_SELF"] . "?login=1");
    }
    //redirect to login page
} else {
    $user = new portal_user($portal_id);
}
//create user object with (in session) saved username