function run($template) { $dbuser = new User(); if (isREQUEST("logout")) { $dbuser->logout(); } if (isREQUEST("user") && isREQUEST("password")) { $usr = $dbuser->logout()->login(REQUEST("user"), REQUEST("password")); } if (!($usr = $dbuser->logedin())) { $template->view("login"); return; } $template->add("usr", $usr); // für die User Infos oben Rechts //$t = new Termin(); //$template->add("byuser", $t->allbyuser($usr["id"])); //$template->add("bymitglied", $t->allbymitglieder($usr["id"])); $template->view("user"); }
function register($template) { $dbuser = new User(); if (isREQUEST("logout")) { $dbuser->logout(); } if (isREQUEST("user") && isREQUEST("password")) { $usr = $dbuser->logout()->login(REQUEST("user"), REQUEST("password")); if (!$usr) { $template->add("error", "Login fehlgeschlagen"); } } if ($usr = $dbuser->logedin()) { $template->redirect("."); return; } // Alle Angaben korrekt? if (!isREQUEST("email") || !preg_match("/[a-z0-9-]*@[a-z0-9-]*\\.[a-z]*/i", REQUEST("email"))) { $template->add("regerror", "EMail nicht angegeben oder falsch"); $template->view("login"); return; } if (!isREQUEST("nick")) { $template->add("regerror", "Nick nicht angegeben"); $template->view("login"); return; } if (!isREQUEST("password1") || !isREQUEST("password2") || REQUEST("password1") != REQUEST("password2")) { $template->add("regerror", "Passswort nicht angegeben oder ungleich"); $template->view("login"); return; } // Existiert der Benuter schon? if ($dbuser->exist(REQUEST("nick"), REQUEST("email"))) { $template->add("regerror", "Nick oder Mail existieren schon"); $template->view("login"); return; } // Benutzer anlegen $activationpass = str_shuffle(md5(rand())); $dbuser->create(REQUEST("nick"), REQUEST("email"), REQUEST("password1"), $activationpass); $mail = new Mail(); global $CONFIG; $mail->userActivation(REQUEST("nick"), REQUEST("email"), $CONFIG["ServerDir"] . "?activate=" . $activationpass); $template->add("regsuccess", "Mail wurde versandt"); $template->view("login"); }
<?php // grullist nr5MpjEYAvWnVuY8 require_once "config/config.php"; require_once "libs/get_post.lib.php"; require_once "libs/user.class.php"; require_once "libs/termin.class.php"; $u = new User(); if (isREQUEST("user") && isREQUEST("passwd")) { $u->login(REQUEST("user"), REQUEST("passwd")); } if ($usr = $u->logedin()) { $ret = array(); switch (REQUEST("action", REQUEST("a", ""))) { case "user": $ret = $usr; break; case "dateadd": $t = new Termin(); $ret = $t->dateadd(REQUEST("t"), $usr["id"], REQUEST("z")); break; case "vote": $t = new Termin(); $ret = $t->vote(REQUEST("t"), $usr["id"], REQUEST("z"), REQUEST("v")); break; default: $ret = array("error" => "action: " . (isset($_GET["action"]) ? $_GET["action"] : "undefined")); } echo json_encode($ret); } else { header("HTTP/1.0 401 Unauthorized");