* * Christoph Becker <*****@*****.**> * * June 2005 - March 2006 * * */ // do main initialization (db, db-checkup, debug, smarty) include "init.php"; require_once I_PATH . "auth.class.php"; require_once I_PATH . "press_user.class.php"; $PU = new press_user(&$SQL, &$DBG, new auth()); // Anmeldung - session $DBG->send_message("* * * Anmeldung * * *"); // <--- Debug-Meldung $authenticated = $PU->auth(); // <- Anmeldedaten prüfen (Formular oder Session) // show login form if ($authenticated == false) { include T_PATH . "login.php"; // <-Anmeldeformular $DBG->send_message("* * * Anmeldung zurückgewiesen * * * died."); // stop debugging, close mysql-connection if wanted include "init.php"; die; } $DBG->send_message("* * * Anmeldung ok * * *"); // ------------------------ // Anmeldung - ende // menu -> Hier wird entschieden, was gemacht werden soll. require I_PATH . "menu.inc.php";
// nutzer nochmal anlegen $ret = $PUSER->create_user("theo", "testtest"); it("create user, already existing", $ret, false); // 2. nutzer anlegen $ret = $PUSER->create_user("theo2", "test"); it("create user, too short password", $ret, false); // 2. Nutzer nochmals anlegen $ret = $PUSER->create_user("theo2", "testtest"); it("create 2nd user, id incremented", $ret, $ret1 + 1); /**/ /* * * * auth * * * */ echo "<h2>AUTHENTICATE USER</h2>"; // FIXME: bad: $PUSER->error_cmsg = ""; # echo "<br>session: ".session_id()." user: theo pass: "******"testtest")."<br>"; $ret = $PUSER->auth("theo", "testtest"); it("right auth", $ret, true); # echo "<br>session: ".session_id()."<br>"; $ret = $PUSER->auth("theo", "passtest"); it("wrong auth (old pass accepted, wenn nicht-OK)", $ret, false); $ret = $PUSER->auth("theo", "testtest"); it("right auth", $ret, true); $ret = $PUSER->auth(); # echo "<br>session: ".session_id(); it("same auth, but with session cannot auth because of wrong auth, session is destroyed", $ret, false); // angemeldet? und fehlerhafte wiederanmeldung $ret = $PUSER->auth("theo", "testtest00"); it("false auth", $ret, false); it(" and session killed", session_id(), ""); // neu anmelden $ret = $PUSER->auth("theo", "testtest");