header('Location: /hpw_notify.php'); exit; set_include_path("lib"); require_once("config.php"); require_once("BaseVO.php"); require_once("BaseDAO.php"); require_once("AdvertisersVO.php"); require_once("AdvertisersDAO.php"); session_start(); // check to see if the advertiser is already logged in if(isset($_SESSION['advertiser_logged_in']) && (strval($_SESSION['advertiser_logged_in']) == 'Y')) { header("Location: /aaccount"); exit; } $action = strval($_POST['action']); if($action == "login") { if(formErrors()) { $showerrors = true; } else { // create a DAO $a_dao = new AdvertisersDAO(); $a_vo = $a_dao->validateLogin($_POST['username'], $_POST['passwd']); // if we successfully login, then set the session information needed for the control panel if($a_vo) { $_SESSION['advertiser_logged_in'] = "Y"; $_SESSION['advertiser_idAdvertisers'] = $a_vo->getPK(); $_SESSION['advertiser_username'] = $a_vo->getUsername(); $_SESSION['advertiser_firstname'] = $a_vo->getFirstname(); $_SESSION['advertiser_lastname'] = $a_vo->getLastname(); $_SESSION['advertiser_mac'] = md5($a_vo->getPasswd()); if(isset($_POST['remember']) && (strlen($_POST['remember']) > 0)) { // set this as a permanant settings $username = strval($_POST['username']); setcookie("advertisers_remember", "Y", time()+31536000); setcookie("advertisers_remember_username", "$username", time()+31536000); } else { // clear the permanant settings setcookie("advertisers_remember", ''); setcookie("advertisers_remember_username", ''); } session_write_close(); header("Location: /aaccount"); exit; } else { header("Location: advertiser_login_fail.php"); exit; } } } else { // if the remember flag is set in the permanant cookie then pre-propegate this field so // the tick appears on first loading of the form if(isset($_COOKIE['advertisers_remember']) && (strlen($_COOKIE['advertisers_remember']) > 0)) { $_POST['remember'] = "Y"; $_POST['username'] = $_COOKIE['advertisers_remember_username']; } } function fieldCheck($field) { global $_POST; switch ($field) { case 'username': if(strlen($_POST['username']) < 1) { return "^ Enter your username"; } else { return ""; } break; case 'passwd': if(strlen($_POST['passwd']) < 1) { return "^ Enter your password"; } else { return ""; } break; } // end switch } // end function fieldCheck function formErrors() { $errors = 0; if(fieldCheck('username') != '') $errors++; if(fieldCheck('passwd') != '') $errors++; return $errors; } // end function formErrors function showError($showerrors, $text, $addtextstart, $addtextend) { if(($text != "") && ($showerrors)) { return $addtextstart . "" . $text . "" . $addtextend; } else { return ""; } } ?> $TITLE_STRING = "Advertiser Login"; $CSS_PAGES = ""; include_once "header_open.php" ?>
Existing advertisers enter your username and password below to access your control panel. New advertisers can register now for an account.
If you have forgotten your details we can send you a reminder email.