<?php
if(!function_exists('IsAdminDirectoryRequested_install_check'))
{
function IsAdminDirectoryRequested_install_check()
{
//Validate Admin
$lbresult = false;
$lsRequestPath = $_SERVER['SCRIPT_NAME'];
//stript string after last slash /
//so string will http://localhost:8081/sscMemberSite/admin/admin_admin_m.php to
//http://localhost:8081/sscMemberSite/admin
$lsRequestPath = substr($lsRequestPath,0,strripos($lsRequestPath,'/'));
//strip string before slash now so only "admin" will be there
$lsRequestPath = substr($lsRequestPath,strripos($lsRequestPath,'/')+1,strlen('admin'));
if(strtolower($lsRequestPath)=='admin')
$lbresult = true;
return $lbresult;
}
}
if(!function_exists('IsMemberDirectoryRequested_install_check'))
{
function IsMemberDirectoryRequested_install_check()
{
/***update by nikunj for getting requested dir name */
/*******************************************************************************/
$result=false;
$scriptPath= $_SERVER['SCRIPT_NAME'];
$revstring=strrev($scriptPath);
$revstring;
$position=0;
$dirRequested="";
$position=stripos($revstring,"/");
$len=strlen($revstring);
for($i=$position+1;$i<=$len;$i++)
{
$trimedCharacter=substr($revstring,$i,1);
if($trimedCharacter=="/")
break;
else
$dirRequested=$dirRequested.$trimedCharacter ;
}
$requestedDir=strrev($dirRequested);
if(strtolower($requestedDir)=="member")
$result=true;
else
$result=false;
return $result;
/*******************************************************************************/
}
}
if(!function_exists('Redirect_installation'))
{
function Redirect_installation($pUrl='', $pEndResponse=false)
{
if(trim($pUrl)=='')
return false;
echo("<script language='javascript'>\n" .
"window.location.href='".$pUrl."'\n" .
"</script>");
if($pEndResponse) die;
return false;
}
}
if(!function_exists('is__writable_installation_check'))
{
function is__writable_installation_check($path)
{
if ($path{strlen($path)-1}=='/')
return is__writable_installation_check($path.uniqid(mt_rand()).'.tmp');
if (file_exists($path)) {
if (!($f = @fopen($path, 'r+')))
return false;
fclose($f);
return true;
}
if (!($f = @fopen($path, 'w')))
return false;
fclose($f);
unlink($path);
return true;
}
}
$template_checkfile=PHYSICAL_DIR."/templates_c/";
if(!file_exists($template_checkfile))
die("MembersGear Error occured : templates_c folder not found in the root of your website.Please create it and apply read write permission on it and try again. ");
if(!is__writable_installation_check($template_checkfile))
die("MembersGear Error occured : Please allow read write permission on templates_c folder in the root of your website and try again. ");
//magic quotes gpc settings
if (get_magic_quotes_gpc())
{
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process))
{
foreach ($val as $k => $v)
{
unset($process[$key][$k]);
if (is_array($v))
{
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
}
else
{
$process[$key][stripslashes($k)] = stripslashes($v);
}
}
}
unset($process);
}
?>