Example #1
0
<?php

// global $plog_level; $plog_level=1;
include 'core/Page.php';
if (!Session::logged_in()) {
    Page::Redirect('login');
}
plog("New page!");
$p = new Page();
if (!$p->ajax) {
    $p->HTML('header.html', array("###MENU###" => Dropdown_menu($p)));
}
$p->title = "Your Website";
$p->CSS("main.css");
$p->Jquery();
$getpost = getpost();
$p->HTML('<BR>');
global $auth_database;
plog("Get mods!");
$m = new Modification($auth_database);
$mods = $m->All('ORDER BY Timestamp DESC');
$m_auth = new Auth($auth_database);
if (!false_or_null($mods)) {
    $datatemp = array();
    foreach ($mods as $mod) {
        $user = $m_auth->Get($mod['r_Auth']);
        if (!isset($datatemp[$user['username']])) {
            $datatemp[$user['username']] = 1;
        } else {
            $datatemp[$user['username']] += 1;
        }
Example #2
0
}
if (isset($getpost['new'])) {
    $p->JS('notifier.js');
    $p->JS('Notifier.info("Editing new Item");');
}
$p->HTML('<BR>');
global $auth_database;
$profile_model = new Profile($auth_database);
$auth_model = new Auth($auth_database);
$a = $auth_model->Get($getpost['ID']);
if (false_or_null($a)) {
    Page::Redirect('profiles');
}
$pro = $profile_model->Get($a['r_Profile']);
if (false_or_null($pro)) {
    Page::Redirect('profiles');
}
$p->HTML('<span class="breadcrumbs">Editing Profile #' . $pro['ID'] . ' and Auth #' . $a['ID'] . '</span>');
$p->HTML('<span class="breadcrumbs-link"><a href="profiles" class="bare">&larr; Profiles</a></span>');
$p->Bind_LoadPlugins();
$p->HTML('<div class="formboundary">');
$p->HTML('<div class="formgroup wide">');
$p->HTML('Username');
$p->BindString("Auth", $a['ID'], "username", $a['username'], "Enter username", FALSE, "texty");
$p->HTML('</div>');
$p->HTML('<div class="formgroup wide">');
$p->HTML('First');
$p->BindString("Profile", $pro['ID'], "first_name", $pro['first_name'], "Enter first", FALSE, "texty");
$p->HTML('Last');
$p->BindString("Profile", $pro['ID'], "last_name", $pro['last_name'], "Enter first", FALSE, "texty");
$p->HTML('</div>');
Example #3
0
 public function Redirect($url)
 {
     $this->page->Redirect($url);
 }
Example #4
0
<?php

include 'core/Page.php';
if (!Session::logged_in()) {
    Page::Redirect('login');
}
if (!Auth::ACL("admin") && !Auth::ACL("su")) {
    Page::Redirect('dash');
}
global $auth_database, $auth;
$profile_model = new Profile($auth_database);
$p_id = $profile_model->Insert(array('first_name' => "John", 'last_name' => 'Dowe'));
$auth_model = new Auth($auth_database);
$new_id = $auth_model->Insert(array('username' => 'new', 'acl' => 'locked', 'r_Profile' => $p_id));
Page::Redirect('profile.edit?new=1&ID=' . $new_id);
Example #5
0
<?php

/*
* Get current users information */
$session = Session::Instance();
# Sample Data
$array = array("user_name" => $session["User"]["vnd_first_name"] . $session["User"]["vnd_last_name"]);
# Render if authorized, otherwise, not.
if (!Security::Authorized()) {
    Page::Redirect("login", "You must be logged in!");
}
$Smarty->assign("users", $array);
$Smarty->display('SiteDashboard.tpl');
Example #6
0
<?php

//global $plog_level; $plog_level=1;
include 'core/Page.php';
plog('File: ' . __FILE__);
global $session_model, $auth_model, $auth;
$getpost = getpost();
if (!(isset($getpost['username']) && isset($getpost['password']))) {
    Page::Redirect("login?m=1");
}
$auth = $auth_model->byUsername($getpost['username']);
plog('$getpost: ' . vars($getpost));
plog('$auth: ' . vars($auth));
if (!is_array($auth)) {
    Page::Redirect("login?m=2");
}
if (strlen($auth['password']) == 0 || matches(ourcrypt($getpost['password']), $auth['password'])) {
    plog('Password matched!  User has authenticated.');
    if (Auth::ACL('locked')) {
        plog('Account is locked, logging user ' . $auth['ID'] . ' off.');
        $session_model->Logout();
        Page::Redirect("login?m=4");
        die;
    }
    $session_model->Create($auth['ID']);
    Page::Redirect("dash");
} else {
    Page::Redirect("login?m=1");
}
Example #7
0
///////////////////////////////////////////////////////////
// CATCH	: "trigger-login"
// ACTION	: Try to log in user based on username and pass.
if (Request::Wants("trigger-login")) {
    # Load username and password from request
    $username = Request::Field("username");
    $password = Request::Field("password");
    # Save attempt to temp var
    $attempt = Login::Attempt($username, $password);
    # If other than false, register with session
    if ($attempt !== false) {
        # Set up the array for registry
        $register = array("User" => array("UID" => $attempt["vnd_id"], "Access" => $attempt["vnd_access_level"], "Type" => $attempt["vnd_user_type"], "FirstName" => $attempt["vnd_first_name"], "LastName" => $attempt["vnd_last_name"]));
        Session::Register($register);
        Page::Redirect("dashboard");
    } else {
        Message::Log("Could not log you in! Please check your credentials.");
    }
}
// If action says to logout
if (Request::Wants("action")) {
    $action = Request::Field("action");
    switch ($action) {
        case "logout":
            Session::Dump();
            unset($_SESSION["SITE"]["User"]);
            Message::Log("You have been logged out!");
            break;
    }
}
Example #8
0
File: logout.php Project: h3rb/page
<?php

include 'core/Page.php';
global $session_model, $session;
if (!is_null($session) && !$session_model->LoggedOut($session)) {
    $session_model->Logout($session);
}
Page::Redirect("login");
Example #9
0
 public function Active($refresh = TRUE)
 {
     global $session_model, $auth_model, $profile_model;
     global $is_logged_in;
     global $session;
     global $user;
     global $auth;
     $session = $this->Get(base64_decode($_COOKIE['session']));
     if (!is_array($session) || !isset($session['r_Auth'])) {
         return $is_logged_in = false;
     }
     if ($this->LoggedOut($session)) {
         return $is_logged_in = false;
     }
     $auth = $auth_model->Get($session['r_Auth']);
     if (!is_array($auth) || !isset($auth['r_Profile'])) {
         return $is_logged_in = false;
     } else {
         $user = $profile_model->Get($auth['r_Profile']);
     }
     if (!is_array($user)) {
         return $is_logged_in = false;
     }
     if ($auth_model->ACL('locked')) {
         plog('Account is locked, logging user ' . $auth['ID'] . ' off.');
         $this->Logout();
         $is_logged_in = false;
         Page::Redirect("login?m=4");
     }
     $this->Refresh($session);
     $url = current_page_url();
     // Ignore any ajaxy stuff
     if (stripos($url, "ajax.") === FALSE) {
         $this->Set($session['ID'], array('last_url' => current_page_url()));
     }
     return $is_logged_in = true;
 }