function CheckLogin($user, $pass) { $Frontend = new FrontEnd(); //Manually pull updated info $uid = $Frontend->findUserID($user); if (streq($uid, '0')) { return false; } $Frontend->pullUserInfo($uid); $dbuser = new Lan_users(); $dbuser->username = $dbuser->escape($user); $dbuser->password = $pass; $dbuser->find(); return 0 != $dbuser->count(); }
<?php include_once 'core.php'; include 'skins/' . Config::$theme . '/setup.php'; include_once 'integration/integration.php'; //Pull through user ID $frontend = new FrontEnd(); setCurrentUser($frontend->getUserId()); startSession(getCurrentUID(), $frontend->getName(getCurrentUID())); //Check user is in db and run checks. $frontend->pullUserInfo(getCurrentUID()); $frontend->checkGroups(getCurrentUID(), getCurrentLID()); $frontend->disconnect(); $page = new Lan_pages(); $page->name = GETSafe('page'); $page->find(); if ($page->fetch()) { $file = 'modules/' . $page->module . '/' . $page->file . '.php'; if (file_exists($file)) { include $file; $master->RenderPage($page->module . '.' . $page->file . '.htm'); } else { $master->AddError("The file for this page does not exist!"); } } else { $master->AddError("Unknown page!"); } if ($master->HasFatalError()) { $master->RenderPage('error.htm'); } $master->RenderSite('master.integration.htm');
if (isset($_POST["Register"])) { //Register button clicked global $master; $master->AddWarning("Register on the <a href=\"http://lanops.co.uk/signup.php\">main web site *click here*</a>."); return; } $login = $_POST["user"]; $password = $_POST["password"]; $loginOK = checkLogin($login, $password); if ($loginOK) { startSession($loginOK->user_id, $loginOK->username); //header( 'Location: intranet.php' ) ; } else { $Frontend = new FrontEnd(); if (!streq("0", $Frontend->getUserId())) { $Frontend->pullUserInfo($Frontend->getUserId()); $loginOK = checkLogin($login, $password); if ($loginOK) { startSession($loginOK->user_id, $loginOK->username); //header( 'Location: intranet.php' ) ; } else { $displayError = true; } } else { $displayError = true; } /** echo "nok"; //Login failed, so check remote site. $rpc = new RPC; $Frontend = new FrontEnd;