Example #1
0
function doAuth()
{
    global $txp_user;
    $txp_user = NULL;
    $message = doTxpValidate();
    if (!$txp_user) {
        doLoginForm($message);
    }
    ob_start();
}
Example #2
0
<?php

/*
This is Textpattern
Copyright 2004 by Dean Allen
www.textpattern.com
All rights reserved
Use of this software indicates acceptance of the Textpattern license agreement 
*/
unset($txp_user);
$message = doTxpValidate();
if (!$txp_user) {
    doLoginForm($message);
}
ob_start();
// -------------------------------------------------------------
function txp_validate($user, $password)
{
    $safe_user = strtr(addslashes($user), array('_' => '\\_', '%' => '\\%'));
    $r = safe_field("name", "txp_users", "name = '{$safe_user}'\n\t\t\t\t\t\t\tand pass = password(lower('{$password}')) and privs > 0");
    if ($r) {
        // update the last access time
        safe_update("txp_users", "last_access = now()", "name = '{$safe_user}'");
        return true;
    }
    return false;
}
// -------------------------------------------------------------
function doLoginForm($message)
{
    global $txpcfg;