Location: PHPKode > projects > GROUP-E Collaboration Software > group-e_v1.720_RC3/group-e/etc/phplib/lib/local.inc
<?php
/*

* Session Management for PHP3
 *
 * Copyright (c) 1998,1999 NetUSE GmbH
 *                    Boris Erdmann, Kristian Koehntopp
 *
 * $Id: local.inc,v 1.31 1999/10/29 13:55:13 kk Exp $
 *
 * All functions in this file are example classes, which can be used
 * by your application to get you going. Once you get the hang of it,
 * you should backup this file and start over with a clean local.inc
 * which contains only your own classes and only the classes you need.
 */


########################groupie START ################################

class DB_groupie extends DB_Sql {
    var $Database =GE_DB;
    var $Host = "localhost";
    var $User = "groupe";
    var $Password = 'YOUR_GROUPE_PASSWORD';

    function DB_groupie() {
		if (defined('GE_DBHost')) $this->Host=GE_DBHost;
		if (defined('GE_DBUser')) $this->User=GE_DBUser;
		if (defined('GE_DBPassword')) $this->Password=GE_DBPassword;
    }
	function nextid($seq_name) {
		$nextid=parent::nextid($seq_name);
		if (defined('GE_GROUPEInstanz')) {
			$nextid.=str_pad(GE_GROUPEInstanz,3,"0", STR_PAD_LEFT);
		}
		return $nextid;
	}
}
class groupie_CT_Sql extends CT_Sql {
	var $database_class = "DB_groupie";          ## Which database to connect...
	var $database_table = "active_sessions"; ## and find our session data in this table.
}
class groupie_Session extends Session {
	var $classname = "groupie_Session";
	#var $module="files";         ## use this for php4 sessions
	var $cookiename     = "";                ## defaults to classname
	var $magic          = "grouup-e_magic_session";      ## ID seed
	var $mode           = "cookie";          ## We propagate session IDs with cookies
	var $fallback_mode  = "get";
	var $lifetime       = 0;                 ## 0 = do session cookies, else minutes
	var $that_class     = "groupie_CT_Sql"; ## name of data storage container class -- delete this for php4 sessions
	var $gc_probability = 5;
	var $allowcache     = "no";              ## "public", "private", or "no"
	//  var $auto_init      = "groupie.inc";
}
class groupie_User extends User {
	var $classname = "groupie_User";
	var $magic          = "grouup-e_magic_user";     ## ID seed
	var $that_class     = "groupie_CT_Sql";  ## name of data storage container class
}
class groupie_Auth extends Auth {
	var $classname      = "groupie_Auth";
	var $lifetime       =  120;
	var $mode           = "log";  ## also try "reg"
	var $database_class = "DB_groupie";
	var $database_table = "auth_user_md5";
	var $nobody       = false;

	function auth_loginform() {
		global $auth,$frm,$_PHPLIB,$VERSION;
		$DB_version=$frm->getVersion('group-e');
		if (defined('GE_CHARSET')) header('Content-Type: text/html; charset='.strtolower(GE_CHARSET));
		include($_PHPLIB["libdir"] . "loginform_group-e.ihtml");
	}
	function auth_validatelogin() {
		global $frm;
		$uid = false;
		if(isset($_POST['username'])) {
			$username=strtolower(trim($_POST['username']));
			$this->auth["uname"]=$username;        ## This provides access for "loginform.ihtml"
			if ($this->auth["uname"]=='config') {
				if ($frm->checkConfigPassword($_POST['password'])) {
					$uid=-1;
					if (!$frm->checkUserIpAccess($uid)) {
						$uid = false;
						$this->auth["error"] = "You ar not allowed to login from this Host.";
					}
				}
			} else {
				if (defined('GE_userDomainSuffix') && GE_userDomainSuffix && $GLOBALS['CFG']['USER_CLASS']=='ldap_full') {
					$this->auth["uname"]=$username.'_'.GE_userDomainSuffix;
				} elseif (GE_DOMAIN && $GLOBALS['CFG']['USER_CLASS']=='ldap_full') {
					$this->auth["uname"]=$username.'_'.str_replace('.','_',GE_DOMAIN);
				}
				$uid=$frm->checkPassword($this->auth["uname"],$_POST['password']);
				if ($uid == false) {
						$this->auth["error"] = "Either your username or password are invalid.<br>Please try again.";
				} else {
					if (!$frm->checkUserIpAccess($uid)) {
						$uid = false;
						$this->auth["error"] = "You ar not allowed to login from this Host.";
					} else {
						SetCookie("auth_username",$this->auth["uname"], pow(2, 31)-1, "/");
						$this->auth["password"]=$_POST['password'];
						$this->auth["uid"]=$uid;
						$query="DELETE FROM UserMsg WHERE FKUserID='$uid'";
						$this->db->query($query);
					}
				}
			}
		}
		return $uid;
	}
	function auth_preauth() {
		if ($_COOKIE["auth_username"]) {
			$this->auth["uname"] = $_COOKIE["auth_username"];
			$this->mode = "log";
		}
		return false;
	}
}

Return current item: GROUP-E Collaboration Software