Example #1
0
<?php

// Standard AJAX post for DataForm and FormHelper shreds
// global $plog_level; $plog_level=1;
include 'core/Page.php';
$ajax = AJAX::FormPost();
plog('--- $ajax: ' . vars($ajax));
// var_dump($ajax); die;
if (!isset($ajax['map'])) {
    echo 'AJAX error!';
    die;
}
$post_types = array(1 => 'changeMyPassword');
$modes = array();
foreach ($ajax['map'] as $form => $elements) {
    $mode = matchvalue($post_types, $form);
    if ($mode !== FALSE) {
        $modes[] = $mode;
    }
}
plog('--- detected ajax modes ' . vars($modes));
global $database;
foreach ($modes as $mode) {
    switch ($mode) {
        default:
            Page::Redirect('dash?nosuchform');
            break;
        case 1:
            if (!Session::logged_in()) {
                Page::Redirect('login');
            }