<?php
/**
* (c) 2000, 2001, 2002 Remistech Sdn Bhd. All Rights Reserved.
*  Developed by John Lim
*  Licensed to Natsoft (M) Sdn Bhd to distribute and support. Refer to LICENSE document.
*/

function PHPLENS_qb_RootPath()
{
GLOBAL $HTTP_SERVER_VARS;

	if (isset($HTTP_SERVER_VARS['DOCUMENT_ROOT'])) { // APACHE and PWS
		$_p_file = (str_replace('\\\\','/',$HTTP_SERVER_VARS['DOCUMENT_ROOT'])); // compat for php4.02 on windows
		return (str_replace('\\','/',$_p_file));
	}
	if (isset($HTTP_SERVER_VARS['APPL_PHYSICAL_PATH'])) { // IIS
		$_p_file = (str_replace('\\\\','/',$HTTP_SERVER_VARS['APPL_PHYSICAL_PATH'])); // compat for php4.02 on windows
		return (str_replace('\\','/',$_p_file));
	}
	print "<p>Unable to find document root</p>"; // happens in CGI mode IIS
	return '';
} //function

function undomq(&$m) 
{
	if (get_magic_quotes_gpc()) {
		// undo the damage
		$m = str_replace('\\\\','\\',$m);
		$m = str_replace('\"','"',$m);
		$m = str_replace('\\\'','\'',$m);
	}
	return $m;
}

function lens_qb_gen_id()
{
	$t = sprintf("%x",time());

	$t .= sprintf("%x",rand());
	return substr(md5($t),0,8);
}

function start_sessions()
{
session_register('lens_qb_id');
session_register('lens_qb_drivername');
session_register('lens_qb_driver');
session_register('lens_qb_server');
session_register('lens_qb_database');
session_register('lens_qb_user');
session_register('lens_qb_pwd');
session_register('lens_qb_master');
session_register('lens_qb_detail');
session_register('lens_qb_master_key');
session_register('lens_qb_detail_key');
}

?>