Location: PHPKode > projects > Mummi (Multi-user MOD_MP3 Interface) > mummi.0.6/lib/overseer.inc
<?
class OVERSEER extends MYSQL_DB{

	// For the session cookies.
	var $o_cookie_user_name;
	var $o_cookie_time;
	var $o_db_time;

	// For the logger.
	var $l_time;
	var $l_ip_address;
	var $l_port;
	var $l_script;
	var $l_user_agent;

	function OVERSEER(){
		$this->o_cookie_array = $GLOBALS[login_active];
		$this->o_cookie_user_name = $GLOBALS[user_name];
		$this->o_cookie_time = $GLOBALS[current_utime];

		$this->l_time = $GLOBALS[current_utime];
		$this->l_ip_address = getenv(REMOTE_ADDR);
		$this->l_port = getenv(REMOTE_PORT);
		$this->l_script = getenv(SCRIPT_NAME);
		$this->l_user_agent = addslashes(getenv(HTTP_USER_AGENT));
	}//eo constructor


	function encipher($input,$key){
		$td = mcrypt_module_open(MCRYPT_BLOWFISH, "", MCRYPT_MODE_CFB, "");
		$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
		@mcrypt_generic_init($td, $key, $iv);
		$encrypted_data = mcrypt_generic($td, serialize($input));
		mcrypt_generic_end($td);
		return rawurlencode(serialize($encrypted_data . $iv));
	}

	function decipher($input,$key){
		$input = unserialize(rawurldecode($input));
		$td = mcrypt_module_open(MCRYPT_BLOWFISH, "", MCRYPT_MODE_CFB, "");
		$iv = substr("$input", - @mcrypt_enc_get_iv_size($td), @mcrypt_enc_get_iv_size($td));
		@mcrypt_generic_init($td, $key, $iv);
		$decrypted_data = mdecrypt_generic($td, $input);
		mcrypt_generic_end($td);
		return unserialize($decrypted_data);
	}


	function db_log($l_user_name="anonymous",$table="access_log"){
		$query = "INSERT INTO $table VALUES('NULL','$this->l_time','$this->l_ip_address','$this->l_port','$this->l_script','$this->l_user_agent','$l_user_name')";
		if(!$this->affected_rows($query))return false;
		else return true;
	}


	// addded 03.01.2002 by jack mays.. this will return the array to merge
	// based on user prefrence of what navbox they want to see.. this will also
	// take load off the server by not having to process as many navboxes.
	function get_navbox_array($user_name, $table="user_prefrences"){
		$query = "SELECT user_navbox_array FROM $table WHERE user_name='$user_name'";
		$result = $this->fetch_numeric($query);
		$result2 = $this->decipher($result[0][0], $GLOBALS[secret_key]);
		$i=0;
		while(list($key,$val) = @each($result2)){
			$return_array[$i] = $val;
		$i++;
		}
		return $return_array; //$return_array;
	}




}//eo overseer class
?>
Return current item: Mummi (Multi-user MOD_MP3 Interface)