} $_SESSION['user_ip'] = $_SERVER['REMOTE_ADDR']; $_SESSION['referer'] = BASE_URL; // validation if ($username == '') { $errors['username'] = '******'; } if ($password == '') { $errors['password'] = '******'; } // no errors, go to review page if (empty($errors)) { require_once APP_PATH . '_lib/class.Admin.php'; $admin = new CAdmin(); if ($admin->login($username, $password)) { $_SESSION['AdminId'] = $admin->getId(); redirect_to(BASE_URL . 'home/'); exit; } else { $errors['incorrect'] = 'Incorrect username or password'; $smarty->assign('errors', $errors); } } else { $smarty->assign('errors', $errors); } } $template = 'login.tpl'; $smarty->assign('ENABLE_RECAPTCHA', $captcha_enabled); if ($captcha_enabled) { $smarty->assign('the_captcha', recaptcha_get_html(CAPTCHA_PUBLIC_KEY)); }