コード例 #1
0
ファイル: login.php プロジェクト: rhencke/mozilla-cvs-history
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */
require_once '../config.inc.php';
require_once $config['base_path'] . '/includes/iolib.inc.php';
require_once $config['base_path'] . '/includes/db.inc.php';
require_once $config['base_path'] . '/includes/contrib/smarty/libs/Smarty.class.php';
require_once $config['base_path'] . '/includes/security.inc.php';
printheaders();
if (!isset($_SESSION['login']) || $_SESSION['login'] != true) {
    if (isset($_POST['do_login'])) {
        $login = false;
        $db = NewDBConnection($config['db_dsn']);
        $db->SetFetchMode(ADODB_FETCH_ASSOC);
        $login = $securitylib->login($_POST['username'], $_POST['password']);
        $db->Close();
        if ($login === true) {
            header('Location: ' . $config['base_url']);
            exit;
        }
        $content = initializeTemplate();
        $content->assign('error', 'Incorrect Username or Password');
    }
    if (!isset($content)) {
        $content = initializeTemplate();
    }
    displayPage($content, 'login', 'login.tpl');
    exit;
} else {
    header('Location: ' . $config['base_url']);
}
コード例 #2
0
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
    switch ($errno) {
        case E_USER_ERROR:
            $content = initializeTemplate();
            $content->assign('title', "Error");
            $content->assign('message', $errstr);
            displayPage($content, 'error', 'error.tpl');
            exit(1);
            break;
        case E_USER_WARNING:
            echo "<b>My WARNING</b> [{$errno}] {$errstr}<br />\n";
            break;
        case E_USER_NOTICE:
            echo "<b>My NOTICE</b> [{$errno}] {$errstr}<br />\n";
            break;
        default:
            //            echo "Unkown error type: [$errno] $errstr<br />\n";
            break;
    }
}