Example #1
0
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * 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;
Example #2
0
function openDB()
{
    global $config;
    $db = NewDBConnection($config['db_dsn']);
    $db->SetFetchMode(ADODB_FETCH_ASSOC);
    $db->debug = false;
    // no good reason to ever let this be true, since it breaks things
    return $db;
}