BzzWare AS, Norway This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ require_once ('functions.php') ; if (!validate()) { header("Location: ldaperror.php"); } loadConfig () ; require('/usr/share/php/smarty/Smarty.class.php') ; session_start() ; loadLocale () ; ob_start (); $smarty = new Smarty(); $smarty->template_dir = $smarty_templ ; $smarty->compile_dir = $smarty_compile ; $authenticated = false ; $key = lwat_key () ; $ldap = lwat_ldap () ; if (isset($_SESSION['usuario'])){ $usuario=$_SESSION['usuario']; $packstring = $_COOKIE['xorstring'] ; $xorstring = pack ("H*", $packstring); $adminpw = xorstring ($key, $xorstring) ; }else{ $usuario=readKey('admindn'); $adminpw =readKey('adminpw'); } if ($_GET['action'] == 'logout') { setcookie ('admindn', '', time () + 1800) ; setcookie ('xorstring', '', time () + 1800) ; unset($_SESSION['usuario']); } else $authenticated = lwat_login ($ldap, $usuario, $adminpw,$key) ; //echo $usuario." ".$adminpw." "; //echo $authenticated; if ($authenticated) { $_SESSION['usuario']=$usuario; $smarty->assign ('profile', get_profile($ldap,$usuario)); $smarty->assign ('fullname', get_fullname($ldap,$usuario)); $smarty->assign ('user', $usuario); $smarty->assign ('servermode', $GLOBALS["servermode"]); $smarty->display('menu.tpl'); }else $smarty->display('login.tpl'); ldap_close ($ldap) ; ?>