checkAuth()) { // Tell smarty pants that we've logged in $smarty->assign('logged_in', 1); // Get the name of the user and pass to smarty $username = $auth->getUserName(); $user_info = $auth->getUserInfo(); // Update the time the user last logged in $user_data = array('last_login'=>date("Y-m-d H:i:s")); $auth->editUser($user_data); $organisation_id = $user_info['organisation_id']; if (empty($organisation_id)) { $auth->logout(); } $db =& connectDB(); $q = "SELECT organisation.name FROM organisation WHERE organisation.organisation_id = '".$organisation_id."'"; $group_name = $db->getOne($q); $smarty->assign('group_name'); $smarty->assign('username'); // Check to see how much of the 8 mile form has been completed $db =& connectDB(); $q = "SELECT * FROM organisation WHERE organisation.organisation_id = '".$organisation_id."'"; $organisation_details = $db->getAll($q); $smarty->assign('organisation_details'); // Finally we need to get all pieces of news for the organisation $news_conditions = array('organisation_id'=>$organisation_id); // Create a new object for news $news = New Model_News(); // Need to set the fetch mode to assoc for this bit $news->setFetchmode('assoc'); $organisation_news = $news->findAll($news_conditions); $smarty->assign('organisation_id'); $smarty->assign('organisation_news'); } elseif ($_POST['email'] && $_POST['password']) { // existing customer trying to login? if (!empty($_POST['email']) && !empty($_POST['password'])) { $email = $_POST['email']; $password = $_POST['password']; if ($auth->getAuth($email, $password)) { // They are a valid user so we set logged in as true $login = 1; } else { // can't find customer record $error = showErrorBox('

Incorrect Username or Password

You can try again below or follow this link to have your login details emailed to you.

If your group has not been approved, you will not be able to login.

'); } } if ($login) { // Get the name of the user and pass to smarty $username = $auth->getUserName(); $smarty->assign('username'); $smarty->assign('logged_in', 1); header("Location: members.php"); } else { $error = showErrorBox('

Incorrect Username or Password

You can try again below or follow this link to have your login details emailed to you.

If your group has not been approved, you will not be able to login.

'); } $smarty->assign('error'); } $smarty->assign('page_title'); $smarty->assign('page_label'); $smarty->display('members.tpl'); ?>