<?php $username = $_POST["username"]; $password = $_POST["password"]; $loginengine = new ExtendedAuthenticationEngine(); if (!$loginengine->login($username, $password)) { header('Location: ?mod=mod_login&loginfail=1'); } else { if (empty($_POST["targetpage"])) { $target = "."; } else { $target = $_POST["targetpage"]; } header('Location: ' . $target); //Redirect to blog main view BlogView(Vm) }
<?php $Authen = new ExtendedAuthenticationEngine(); $E = new BlogEngine(); if (!$Authen->isLoggedIn()) { header("Location: ."); } ?> <!DOCTYPE html> <html> <head> <title>Welcome To My Blog</title> <meta charset="UTF-8"> <style> <?php MWF_ViewLoader::Load("mod_core_design", "base_css"); ?> </style> </head> <body> <?php MWF_ViewLoader::Load("mod_core_design", "headerbar"); ?> <?php if ($Authen->isAuthorized(1)) { echo '<p><a href="?mod=mod_adminpage&view=add_entry">Create new blog entry</a></p>'; } ?> <hr> <?php if (!isset($_GET["page"])) {
<?php if (isset($Authen)) { $_VARIABLE_TMP = $Authen; } $Authen = new ExtendedAuthenticationEngine(); ?> <div class="headerbar"> <ul class="tabs"> <li><a href=".">Main Page</a></li> <?php if (!$Authen->isLoggedIn()) { ?> <li class="space"></li> <li><a href="?mod=mod_login">Login</a></li> <?php } else { ?> <li><a href="?mod=mod_adminpage"><?php $data = $Authen->getLoginData(); echo $data["NAME"] . " " . (strlen($data["SURNAME"]) <= 10 ? $data["SURNAME"] : $data["SURNAME"][0]) . "."; ?> </a></li> <!-- <li><a href="#">My Profile</a></li> --> <li class="space"></li> <li><a href="?mod=mod_login&view=logout">Logout</a></li> <?php } ?> </ul> </div>
<?php $Authen = new ExtendedAuthenticationEngine(); if (!$Authen->isAuthorized(3)) { header('Location: ?mod=mod_adminpage'); die; } $E = new BlogEngine(); $post = $E->getPost($_POST["POST_ID"]); $LoginData = $Authen->getLoginData(); if ($LoginData["USER_ID"] != $post->getPostOwner() && !$Authen->isAuthorized(4)) { header('Location: ?mod=mod_adminpage'); } else { $data = $E->delPost($_POST["POST_ID"]); if ($data) { header("Location: ?mod=mod_adminpage"); } else { echo "Delete Post Failed"; } }
<?php $Authen = new ExtendedAuthenticationEngine(); if (!$Authen->isAuthorized(1)) { header('Location: ?mod=mod_adminpage'); die; } $blogengine = new BlogEngine(); $PostData = new PostData(NULL, $_POST["title"], $_POST["data"], NULL); // New Post Object with Given Data ($_POST) $success = $blogengine->newPost($PostData); if (!$success) { header('Location: ?mod=mod_adminpage&view=add_entry&success=0'); } else { header('Location: ?mod=mod_adminpage'); }
<?php $Authen = new ExtendedAuthenticationEngine(); $Authen->logout(); header("Location: .");