postBack() public method

Check if page load is a post back.
public postBack ( )
Ejemplo n.º 1
0
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "settings.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "account.class.php";
$common = new common();
$settings = new settings();
$account = new account();
// Check if the user is already logged in.
if ($account->isAuthenticated()) {
    if (isset($_REQUEST['origin'])) {
        // Redirect the authenticated visitor to their original destination.
        header("Location: " . urldecode($_REQUEST['origin']));
    } else {
        // Redirect the user to the administration homepage.
        header("Location: index.php");
    }
}
if ($common->postBack()) {
    $validToken = FALSE;
    // Look up the login using the supplied token.
    $login = $account->getLoginUsingToken($_POST['token']);
    if (!is_null($login)) {
        $validToken = TRUE;
        // Check the length of the password.
        $tooShort = TRUE;
        if (isset($_POST['password1']) && strlen($_POST['password1']) >= $settings::sec_length) {
            $tooShort = FALSE;
        }
        // Check that the supplied new passwords match.
        $notMatching = TRUE;
        if ($_POST['password1'] == $_POST['password2']) {
            $notMatching = FALSE;
        }
Ejemplo n.º 2
0
// SOFTWARE.                                                                       //
/////////////////////////////////////////////////////////////////////////////////////
session_start();
// Load the require PHP classes.
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "account.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "blog.class.php";
$common = new common();
$account = new account();
$blog = new blog();
// Check if the user is logged in.
if (!$account->isAuthenticated()) {
    // The user is not logged in so forward them to the login page.
    header("Location: login.php");
}
if ($common->postBack()) {
    // Delete the selected blog post.
    $blog->deletePostByTitle(urldecode($_GET['title']));
    // Forward the user to the blog management index page.
    header("Location: /admin/blog/");
}
// Get titles and dates for all blog posts.
$post = $blog->getPostByTitle(urldecode($_GET['title']));
////////////////
// BEGIN HTML
require_once '../includes/header.inc.php';
?>
            <h1>Blog Management</h1>
            <hr />
            <h2>Delete Blog Post</h2>
            <h3><?php 
Ejemplo n.º 3
0
// SOFTWARE.                                                                       //
/////////////////////////////////////////////////////////////////////////////////////
session_start();
$passwordIncorrect = FALSE;
$didNotMatch = FALSE;
// Load the require PHP classes.
require_once '../classes/common.class.php';
require_once '../classes/account.class.php';
$common = new common();
$account = new account();
// Check if the user is logged in.
if (!$account->isAuthenticated()) {
    // The user is not logged in so forward them to the login page.
    header("Location: login.php?origin=" . urlencode('account.php'));
}
if ($common->postBack()) {
    // Check that the user supplied a password matching the one currently stored in administrators.xml.
    $authenticated = $account->authenticate($_SESSION['login'], $_POST['password'], FALSE, FALSE);
    if (!$authenticated) {
        $passwordIncorrect = TRUE;
    }
    if ($_POST['password1'] != $_POST['password2']) {
        $didNotMatch = TRUE;
    }
    if ($authenticated && $_POST['password1'] == $_POST['password2']) {
        // Change the password stored in administrators.xml related to this users login.
        $account->changePassword($_SESSION['login'], $_POST['password1']);
        // Since the password has changed we will log the user out to clear older session variables.
        $account->logout();
    }
}
Ejemplo n.º 4
0
// Load the require PHP classes.
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "account.class.php";
$common = new common();
$account = new account();
// Check if the user is already logged in.
if ($account->isAuthenticated()) {
    if (isset($_REQUEST['origin'])) {
        // Redirect the authenticated visitor to their original destination.
        header("Location: " . urldecode($_REQUEST['origin']));
    } else {
        // Redirect the user to the administration homepage.
        header("Location: index.php");
    }
}
if ($common->postBack()) {
    // Check that a vailid login was supplied.
    $validLogin = $account->loginExists($_POST['login']);
    $emailSent = FALSE;
    if ($validLogin) {
        // Set a new token for the user.
        $token = $account->setToken($_POST['login']);
        // Create and send the email.
        $subject = $common->getSetting("siteName") . " Password Reset Request";
        $message = "A password reset request has been received by your ADS-B portal.\r\n";
        $message .= "\r\n";
        $message .= "If you did not request this password reset simply disregard this email.\r\n";
        $message .= "If in fact you did request a password reset follow the link below to do so.\r\n";
        $message .= "\r\n";
        $message .= "http://" . $_SERVER['HTTP_HOST'] . "/admin/reset.php?token=" . $token . "\r\n";
        $message .= "\r\n";
Ejemplo n.º 5
0
// Load the require PHP classes.
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "common.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . "classes" . DIRECTORY_SEPARATOR . "account.class.php";
$common = new common();
$account = new account();
// Check if the user is already logged in.
if ($account->isAuthenticated()) {
    if (isset($_REQUEST['origin'])) {
        // Redirect the authenticated visitor to their original destination.
        header("Location: " . urldecode($_REQUEST['origin']));
    } else {
        // Redirect the user to the administration homepage.
        header("Location: index.php");
    }
}
if ($common->postBack()) {
    // Try to authenticate the user using the credentials supplied.
    $remember = isset($_POST['remember']) ? TRUE : FALSE;
    $origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : NULL;
    $authenticated = $account->authenticate($_POST['login'], $_POST['password'], $remember, TRUE, $origin);
}
/////////////////////
// BEGIN HTML BODY //
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" />