home *** CD-ROM | disk | FTP | other *** search
Wrap
<?php /* Copyright Intermesh 2003 Author: Merijn Schering <mschering@intermesh.nl> Version: 1.0 Release date: 08 July 2003 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. */ if(!file_exists("Group-Office.php")) { header("Location: install.php"); exit(); }elseif(is_writable("Group-Office.php")) { echo '<font color="red"><b>Group-Office.php is writable please chmod 755 Group-Office.php and change the ownership to any other user then the webserver user.</b></font>'; exit(); } require("Group-Office.php"); $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : ''; $lang = isset($_COOKIE['lang']) ? $_COOKIE['lang'] : $GO_LANGUAGE->default_language; require($GO_LANGUAGE->get_language_file('login')); if ($task == "logout") { SetCookie("GO_UN","",time()-3600,"/","",0); SetCookie("GO_PW","",time()-3600,"/","",0); unset($_SESSION); unset($_COOKIE); $GO_SECURITY->logout(); } //when the user is logged in redirect him. if ($GO_SECURITY->logged_in == true) { $start_module = $GO_MODULES->get_module($_SESSION['GO_SESSION']['start_module']); if (isset($_REQUEST['return_to'])) { $link = $_REQUEST['return_to']; }elseif ($start_module && ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $start_module['acl_read']) || $GO_SECURITY->has_permission($GO_SECURITY->user_id, $start_module['acl_write']))) { $link = $GO_CONFIG->host.$start_module['path']; }else { //todo make nice startpage $link = $GO_CONFIG->host.'about.php'; } //header('Location: '.$link); require($GO_THEME->theme_path."frames.inc"); exit(); } //if form was posted user wants to login //set cookies to remember login before headers are sent if ($_SERVER['REQUEST_METHOD'] == "POST" || (isset($_COOKIE['GO_UN']) && isset($_COOKIE['GO_PW']))) { if ($_SERVER['REQUEST_METHOD'] != "POST") { $remind = true; $password = $_COOKIE['GO_PW']; $username = $_COOKIE['GO_UN']; echo $auth_mail_server_key = isset($_COOKIE['GO_AUTH_MAIL_SERVER_KEY']) ? $_COOKIE['GO_AUTH_MAIL_SERVER_KEY'] : ''; }else { $remind = isset($_POST['remind']) ? true : false; $username = $_POST['username']; $password = $_POST['password']; } //check if both fields were filled if (!$username || !$password) { $feedback = "<p class=\"Error\">".$login_missing_field."</p>"; }else { $auth_mail_server_key = isset($_POST['auth_mail_server_key']) ? $_POST['auth_mail_server_key'] : -1; SetCookie("GO_AUTH_MAIL_SERVER_KEY",$auth_mail_server_key,time()+3600*24*30,"/",'',0); $_COOKIE['auth_mail_server_key'] = $auth_mail_server_key; //attempt login using security class inherited from index.php if ($GO_SECURITY->login($username,$password, $auth_mail_server_key)) { //login is correct final check if login registration was ok if ($GO_SECURITY->logged_in == true) { if ($remind) { SetCookie("GO_UN",$username,time()+3600*24*30,"/",'',0); SetCookie("GO_PW",$password,time()+3600*24*30,"/",'',0); } if ($_SESSION['GO_SESSION']['first_name'] == '' || $_SESSION['GO_SESSION']['last_name'] == '' || $_SESSION['GO_SESSION']['email'] == '') { header("Location: ".$GO_CONFIG->host."configuration/account/index.php"); exit(); }else { $start_module = $GO_MODULES->get_module($_SESSION['GO_SESSION']['start_module']); if (isset($_REQUEST['return_to'])) { $link = $_REQUEST['return_to']; }elseif ($start_module && ($GO_SECURITY->has_permission($GO_SECURITY->user_id, $start_module['acl_read']) || $GO_SECURITY->has_permission($GO_SECURITY->user_id, $start_module['acl_write']))) { $link = $GO_CONFIG->host.$start_module['path']; }else { //todo make nice startpage $link = $GO_CONFIG->host.'about.php'; } //redefine theme $GO_THEME = new GO_THEME(); require($GO_THEME->theme_path."frames.inc"); exit(); } }else { $feedback = "<p class=\"Error\">".$login_registration_fail."</p>"; } }else { $feedback = "<p class=\"Error\">".$login_bad_login."</p>"; } } } require('login.inc'); ?>