<?php
if(!isset($chk_for_cookie_js))
require_once INCLUDE_DIR."/users_class.php";
function get_root_domain($weburl)
{
if( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
$server_request="https://";
else
$server_request="http://";
$url_parts=parse_url($weburl);
return $server_request.$url_parts['host'];
}
function is__writable($path) {
if ($path{strlen($path)-1}=='/')
return is__writable($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;
}
function GetUniqueString()
{
$lResult = microtime().'';
$lResult = date('Ymd').'_'.str_replace(' ','', str_replace('0.','',$lResult));
return $lResult;
}
function Redirect($pUrl='', $pEndResponse=false)
{
if(trim($pUrl)=='')
return false;
@header("Location:". urldecode( $pUrl ) );
echo("<script language='javascript'>\n" .
"window.location.href='".addslashes(urldecode($pUrl))."';\n" .
"</script>");
if($pEndResponse) die;
return false;
}
function createRandomPassword()
{
$chars = "abcdefghijkmnopqrstuvwxyz023456789";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
// $mem_pass_min_length=7;
//$mem_pass_max_length=7;
if((int)MEMBER_PASSWORD_MIN_LENGTH <= (int)MEMBER_PASSWORD_MAX_LENGTH)
{
if(MEMBER_PASSWORD_MIN_LENGTH!='')
{
$mem_pass_min_length =(int)MEMBER_PASSWORD_MIN_LENGTH;
}
if(MEMBER_PASSWORD_MAX_LENGTH!='')
{
$mem_pass_max_length =(int)MEMBER_PASSWORD_MAX_LENGTH;
}
}
while ($i <= $mem_pass_max_length)
{
$num = rand() % 33;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
if(strlen($pass)>$mem_pass_max_length)
{
$pass= substr($pass,0,$mem_pass_max_length);
}
return $pass;
}
function createRandomusername()
{
$users = new users_class();
$chars = "abcdefghijkmnopqrstuvwxyz023456789";
//srand((double)microtime()*1000000);
$i = 0;
$username = '' ;
//$mem_login_min_length=11;
// $mem_login_max_length=11;
if((int)MEMBER_LOGIN_MIN_LENGTH <= (int)MEMBER_LOGIN_MAX_LENGTH)
{
if(MEMBER_LOGIN_MIN_LENGTH!='')
{
$mem_login_min_length =(int)MEMBER_LOGIN_MIN_LENGTH;
}
if(MEMBER_LOGIN_MAX_LENGTH!='')
{
$mem_login_max_length =(int)MEMBER_LOGIN_MAX_LENGTH;
}
}
while ($i <= $mem_login_max_length)
{
$username.=chr(rand(97,122));
$i++;
}
// $username = uniqid(mem,false);
if(MEMBER_GENERATE_USERNAME_PREFIX!='')
{
$username=MEMBER_GENERATE_USERNAME_PREFIX.$username;
}
else
{
$username=$username;
}
if(strlen($username)>$mem_login_max_length)
{
$username= substr($username,0,$mem_login_max_length);
}
$lsValues1[]=$username;
$liUseravialble=$users->IsUserAvailable("SELECT * FROM ".TABLE_PREFIX ."users where username=?",$lsValues1,null);
if($liUseravialble==false)
{
return $username;
}
else
{
$username=createRandomusername();
return $username;
}
}
function PrintABCDPaging()
{
$pLetter = '';
$lsScriptName = '';
$lsQueryStrName = 'letter';
$lsCharacterList = range('A', 'Z');
$lsReturnResult = '';
$temp = $_SERVER['SCRIPT_NAME'];
$lsScriptName = $_SERVER['SCRIPT_NAME'];
if(isset($_GET) && is_array($_GET) && sizeof($_GET)>0)
{
$lsScriptName .= '?';
foreach($_GET as $key=>$value)
{
/*****************************/
if(strtolower(trim($key)) == "begin")
$lsScriptName .= urldecode($key)."=0&";
/*****************************/
else if(strtolower(trim($key)) != strtolower(trim($lsQueryStrName)))
$lsScriptName .= urldecode($key)."=".$value."&";
}
}
if(isset($_GET[$lsQueryStrName]))
{
if($_GET[$lsQueryStrName] != '')
{
$pLetter = $_GET[$lsQueryStrName];
}
}
$lsReturnResult .= '<table class="PrintABCDPaging" cellspacing="0" cellpadding="5">';
$lsReturnResult .= '<tr>';
$lsReturnResult .= '<td>';
if($pLetter == '' || strtolower($pLetter) == 'all')
{
$lsReturnResult .= '<span>All</span>';
}
else
{
$lsReturnResult .= '<a href='.$lsScriptName.$lsQueryStrName.'=all>All</a>';
}
foreach($lsCharacterList as $Character)
{
if($pLetter == strtolower($Character))
{
$lsReturnResult .= '<span>'.$Character.'</span>';
}
else
{
if(!strpos($lsScriptName,'?')) $lsScriptName .= '?';
$lsReturnResult .= '<a href="'.$lsScriptName.$lsQueryStrName.'='.strtolower($Character).'">'.$Character.'</a>';
}
}
if($pLetter == '' || strtolower($pLetter) == 'all')
{
$lsReturnResult .= '<span>All</span>';
}
else
{
$lsReturnResult .= '<a href='.$lsScriptName.$lsQueryStrName.'=all>All</a>';
}
$lsReturnResult .= '</td>';
$lsReturnResult .= '</tr>';
$lsReturnResult .= '</table>';
return $lsReturnResult;
}
function IsMemberDirectoryRequested()
{
/* $lbresult = false;
$lsRequestPath = $_SERVER['SCRIPT_NAME'];
//Do not return true if /member/rotating_logout_pages is requested since we don't require user authentication to show
//pages located into /member/rotating_logout_pages/
//if(strpos($lsRequestPath,'/member/rotating_logout_pages/')==true)
// return false;
//stript string after last slash /
//so string will http://localhost:8081/sscMemberSite/member/user_edit_profile.php to
//http://localhost:8081/sscMemberSite/member
$lsRequestPath = substr($lsRequestPath,0,strripos($lsRequestPath,'/'));
//strip string before slash now so only "member" will be there
$lsRequestPath = substr($lsRequestPath,strripos($lsRequestPath,'/')+1,strlen('member'));
if(strtolower($lsRequestPath)=='member')
$lbresult = true;
return $lbresult; */
/***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;
/*******************************************************************************/
}
function IsAdminDirectoryRequested()
{
//if admin_login.php page is requested then consider this as anonymous request
if(strpos(strtolower($_SERVER['SCRIPT_NAME']),'admin_login.php'))
return false;
if(strpos(strtolower($_SERVER['SCRIPT_NAME']),'is_valid_request.php'))
return false;
//Validate Admin
$lbresult = false;
$lsRequestPath = $_SERVER['SCRIPT_NAME'];
/* update by nikunj for admin and sub dir request ***********************************/
if(stristr($lsRequestPath,'/admin/') or stristr($lsRequestPath,'/admin'))
$lbresult = true;
/**********************************************************************************/
/*
//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;
}
//call this function in the footer
function SET_URL_REFERER()
{
$_SESSION[SESSION_PREFIX.'URL_REFERER'] = $_SERVER['REQUEST_URI'];
}
function GET_URL_REFERER()
{
if(!isset($_SESSION[SESSION_PREFIX.'URL_REFERER']))
return '';
return $_SESSION[SESSION_PREFIX.'URL_REFERER'];
}
function GET_URL($pURL)
{
if(strpos($pURL,'?'))
$pURL = $pURL.'&';
else
$pURL = $pURL.'?';
return $pURL;
}
function Clear_Browser_Cache()
{ /*
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
*/
}
//Project007Bond
function encrypt($string,$pkey='MEMBERSITEENCRYPTEDKEY') {
$key = $pkey;
if(!isset($key) or $key=="")
$key='MEMBERSITEENCRYPTEDKEY';
$result = '';
for($i=0; $i<strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)+ord($keychar));
$result.=$char;
}
$skey=urlencode(base64_encode($result));
return $skey;
}
function decrypt($string,$pkey='MEMBERSITEENCRYPTEDKEY') {
$key = $pkey;
if(!isset($key) or $key=="")
$key='MEMBERSITEENCRYPTEDKEY';
$result = '';
$string = base64_decode(urldecode($string));
for($i=0; $i<strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)-ord($keychar));
$result.=$char;
}
return $result;
}
/*
* This function simply descypt the first key of querystring passed into url
*/
function DECRYPT_S_GET()
{
if(isset($_GET))
{
if(sizeof($_GET)==1)
{
foreach($_GET as $key=>$value)
{
if(!isset($value) || trim($value)=='')
{
$lsDecryptedQueryString = decrypt(urlencode($key));
$_SERVER['QUERY_STRING'] = $lsDecryptedQueryString; //Set $_SERVER Variable
//echo decrypt('wbGziqqpwIC8yae4sbW7ycS9tLJ4qtG9rr%2BnuHi1uMyCuca3f8zFtnKpw7XCv6p6p7KzvLV6qrOxgMbLxbk%3D').'<br />';
//echo 'wbGziqqpwIC8yae4sbW7ycS9tLJ4qtG9rr%2BnuHi1uMyCuca3f8zFtnKpw7XCv6p6p7KzvLV6qrOxgMbLxbk%3D<br>';
//echo urlencode($key);die;
$larrDecryptedQueryString = explode('&',$lsDecryptedQueryString);
//print_r($lsDecryptedQueryString);
//enc=true querystring must be present in encrypted queryting to decrypt it. This is case sensetive.
if(in_array('enc=true',$larrDecryptedQueryString))
{
foreach($larrDecryptedQueryString as $key=>$value)
{
$larrQueryStringPair = explode('=',$value);
if(is_array($larrQueryStringPair) && sizeof($larrQueryStringPair)>0)
{
if(isset($larrQueryStringPair[0])) //Set $_GET Variables
$_GET[$larrQueryStringPair[0]] = (isset($larrQueryStringPair[1])) ? $larrQueryStringPair[1] :'';
}
}
}
}
}
}
}
}
function createToken()
{
// Declare salt and prefix
$token.='Z007MEMBERAREA';
$sections=5;
$sectionlength=5;
$salt = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890';
// Prepare randomizer
srand((double)microtime() * 1000000);
// Create the token
for($i=0; $i< $sections; $i++)
{
for($n=0; $n<$sectionlength; $n++)
{
$token.=substr($salt, rand() % strlen($salt), 1);
}
if($i<($sections-1)){ $token.='-'; }
}
$len=strlen($token);
if($len<=50)
return $token;
else
return "Project007Bond";
}
function getByteArrayformStirng1($pSting)
{
$in_str = $pSting;//'this is a test';
// echo $in_str;
//die;
//echo (string)$in_str;
///echo "<br><br><br>";
//$hex_ary= base64_decode($in_str);
// echo $in_str;
/// die;
//$hex_ary = array();
/* foreach (str_split($in_str) as $chr)
$hex_ary[] =base64_encode(sprintf("%02X", ord($chr)));
echo implode(' ',$hex_ary);*/
$hex_ary = array();
foreach (str_split($in_str) as $chr)
$hex_ary[] = sprintf("%02X", ord($chr));
//echo implode(' ',$hex_ary);
//die;
//echo implode(' ',$hex_ary);
//echo $hex_ary;
// print_r($hex_ary);
//$in_str=bin($in_str);
// echo $in_str;
$binarydata = pack("nvc*", 0x1234, 0x5678, 65, 66);
$imgcode = chunk_split($in_str,20,''.'');
//echo $imgcode;
////die;
//die; '
return $imgcode;
}
function getByteArrayformStirng($base2) {
/* if ($remainbits = strlen($base2)%8) $base2 .= str_repeat('0',8-$remainbits);
$base64 = NULL;
for ($i=0;$i<strlen($base2);$i+=8) $base16 .= sprintf('%02x',bindec(sprintf('%08d',substr($base2,$i,8))));
return bin2hex(pack('H*',$base16)); */
// $binarydata = pack("nvc*",);
$binarydata=si2bin($base2);
$binarydata1= bin2hex($binarydata);
//echo $binarydata1;
// die;
return $binarydata1;
}
function si2bin($string, $bits=32)
{
/* if ($si >= -pow(2,$bits-1) and $si <= pow(2,$bits-1) )
{
if ($si >= 0) // positive or zero
{
$bin = base_convert($si,10,2);
// pad to $bits bit
$bin_length = strlen($bin);
if ($bin_length < $bits) $bin = str_repeat ( "0", $bits-$bin_length).$bin;
}
else // negative
{
$si = -$si-pow(2,$bits);
$bin = base_convert($si,10,2);
$bin_length = strlen($bin);
if ($bin_length > $bits) $bin = str_repeat ( "1", $bits-$bin_length).$bin;
}
return $bin;
} */
//$string = "string";
for($i = 0; $i < strlen($string); $i++)
$binarydata.= base_convert(ord($string[$i]),10,2);
return $binarydata;
}
function cus_money_format($format, $number)
{
$regex = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?'.
'(?:#([0-9]+))?(?:\.([0-9]+))?([in%])/';
if (setlocale(LC_MONETARY, 0) == 'C') {
setlocale(LC_MONETARY, '');
}
$locale = localeconv();
preg_match_all($regex, $format, $matches, PREG_SET_ORDER);
foreach ($matches as $fmatch) {
$value = floatval($number);
$flags = array(
'fillchar' => preg_match('/\=(.)/', $fmatch[1], $match) ?
$match[1] : ' ',
'nogroup' => preg_match('/\^/', $fmatch[1]) > 0,
'usesignal' => preg_match('/\+|\(/', $fmatch[1], $match) ?
$match[0] : '+',
'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0,
'isleft' => preg_match('/\-/', $fmatch[1]) > 0
);
$width = trim($fmatch[2]) ? (int)$fmatch[2] : 0;
$left = trim($fmatch[3]) ? (int)$fmatch[3] : 0;
$right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits'];
$conversion = $fmatch[5];
$positive = true;
if ($value < 0) {
$positive = false;
$value *= -1;
}
$letter = $positive ? 'p' : 'n';
$prefix = $suffix = $cprefix = $csuffix = $signal = '';
$signal = $positive ? $locale['positive_sign'] : $locale['negative_sign'];
switch (true) {
case $locale["{$letter}_sign_posn"] == 1 && $flags['usesignal'] == '+':
$prefix = $signal;
break;
case $locale["{$letter}_sign_posn"] == 2 && $flags['usesignal'] == '+':
$suffix = $signal;
break;
case $locale["{$letter}_sign_posn"] == 3 && $flags['usesignal'] == '+':
$cprefix = $signal;
break;
case $locale["{$letter}_sign_posn"] == 4 && $flags['usesignal'] == '+':
$csuffix = $signal;
break;
case $flags['usesignal'] == '(':
case $locale["{$letter}_sign_posn"] == 0:
$prefix = '(';
$suffix = ')';
break;
}
if (!$flags['nosimbol']) {
$currency = $cprefix .
($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']) .
$csuffix;
} else {
$currency = '';
}
$space = $locale["{$letter}_sep_by_space"] ? ' ' : '';
$value = number_format($value, $right, $locale['mon_decimal_point'],
$flags['nogroup'] ? '' : $locale['mon_thousands_sep']);
$value = @explode($locale['mon_decimal_point'], $value);
$n = strlen($prefix) + strlen($currency) + strlen($value[0]);
if ($left > 0 && $left > $n) {
$value[0] = str_repeat($flags['fillchar'], $left - $n) . $value[0];
}
$value = implode($locale['mon_decimal_point'], $value);
if ($locale["{$letter}_cs_precedes"]) {
$value = $prefix . $currency . $space . $value . $suffix;
} else {
$value = $prefix . $value . $space . $currency . $suffix;
}
if ($width > 0) {
$value = str_pad($value, $width, $flags['fillchar'], $flags['isleft'] ?
STR_PAD_RIGHT : STR_PAD_LEFT);
}
$format = str_replace($fmatch[0], $value, $format);
}
return $format;
}
function RandomFile($folder='', $extensions='.*')
{
// fix path:
$result='';
$folder = trim($folder);
$folder = ($folder == '') ? './' : $folder;
// check folder:
if (!is_dir($folder))
{
//die('invalid folder given!');
return false;
}
// create files array
$files = array();
// open directory
if ($dir = @opendir($folder))
{
// go trough all files:
if(is_array($extensions))
{
while($file = readdir($dir)){
//if (!preg_match('/^\.+$/', $file) and preg_match('/\.('.$extensions.')$/', $file))
if (!preg_match('/^\.+$/', $file) and (preg_match('/\.('.$extensions[0].')$/', $file)
or preg_match('/\.('.$extensions[1].')$/', $file) or preg_match('/\.('.$extensions[2].')$/', $file)))
{
// feed the array:
$files[] = $file;
}
}
}
else
{
while($file = readdir($dir)){
if (!preg_match('/^\.+$/', $file) and preg_match('/\.('.$extensions.')$/', $file))
{
// feed the array:
$files[] = $file;
}
}
// close directory
closedir($dir);
}
}
else {
// die('Could not open the folder "'.$folder.'"');
return false;
}
if (count($files) == 0){
//die('No files where found :-(');
return false;
}
// seed random function:
mt_srand((double)microtime()*1000000);
// get an random index:
$rand = mt_rand(0, count($files)-1);
// check again:
if (!isset($files[$rand])){
// die('Array index was not found! very strange!');
return false;
}
// return the random file:
return $folder ."/" .$files[$rand];
}
function GetRotatingpagesinfo($folderPath)
{
//$path =PHYSICAL_DIR."/rotating_login_pages";
$path =$folderPath;
if (!is_dir($path))
{
//die('invalid folder given!');
return false;
}
$extensions=array('php','htm','html','excluded');
if($lsRotatingLoginPages = opendir($path))
{
$i=1;
$lReverseFileName = '';
$pagesinfo =array();
while (($file = readdir($lsRotatingLoginPages)) !== false)
{
if(is_array($extensions))
{
if ((preg_match('/\.('.$extensions[0].')$/', $file)
or preg_match('/\.('.$extensions[1].')$/', $file) or preg_match('/\.('.$extensions[2].')$/', $file) or preg_match('/\.('.$extensions[3].')$/', $file)))
{
$lReverseFileName = strrev($file);
if(strpos(' '.trim($lReverseFileName),'dedulcxe.')==1)
{
if($file!= "." and $file!= "..")
{
$pagesinfo[$i]['filename']= $file;
// $pagesinfo[$i]['modifiedon']= "Not Available";
$pagesinfo[$i]['modifiedon']= date ("d M, Y H:i:s", filemtime($path."/".$file));
$pagesinfo[$i]['status']="Excluded";
}
// print "excluded file=>". $file."<br />";
// echo "\t\t" . date ("F d Y H:i:s.", filemtime($file));
}
else
{
// print "included file=>". $file."<br />";
// echo "\t\t" . date ("F d Y H:i:s.", filemtime($file));
if($file!= "." and $file!= "..")
{
$pagesinfo[$i]['filename']= $file;
$pagesinfo[$i]['modifiedon']= date ("d M, Y H:i:s", filemtime($path."/".$file));
// $pagesinfo[$i]['modifiedon']="";
$pagesinfo[$i]['status']="Included";
}
}
$i++;
}
else
{
//return false;
}
}
else
{
return false;
}
} //closedir($path);
return $pagesinfo;
}
else
{
return false;
}
}
function isEmailConfigurationSetup()
{
$phpmail_host=PHPMAILER_HOST;
$phpMailUsername=PHPMAILER_USERNAME;
$phpmail_password= PHPMAILER_PASSWORD;
$phpmail_port=PHPMAILER_PORT;
$phpMailForm=PHPMAILER_EMAIL_FROM;
$phpMailFormName=PHPMAILER_EMAIL_FROM_NAME;
$phpmailAdminEmail= ADMINISTRATOR_EMAIL_ADDRESS;
if((isset($phpMailForm) and $phpMailForm!="") and (isset($phpMailFormName) and $phpMailFormName!="") and (isset($phpmailAdminEmail) and $phpmailAdminEmail!=""))
return true;
else
return false;
}
function is_cron_setup()
{
require_once PHYSICAL_DIR."/includes/system_get_set_options_class.php";
$option_obj=new system_get_set_options_class();
$cron_last_run=$option_obj->get_option('CRON_LAST_EXECUTED_ON');
$result="successful";
if($cron_last_run!="" and $cron_last_run!=null)
{
$timestemp_date2= strtotime(date("m/d/Y g:i a")) ;
$timestemp_date1=strtotime($cron_last_run);
$Date1Arr=getdate($timestemp_date1);
$Date2Arr=getdate($timestemp_date2);
$d1=mktime($Date1Arr['hours'],$Date1Arr['minutes'],$Date1Arr['seconds'],$Date1Arr['mon'],$Date1Arr['mday'],$Date1Arr['year']);
$d2=mktime($Date2Arr['hours'],$Date2Arr['minutes'],$Date2Arr['seconds'],$Date2Arr['mon'],$Date2Arr['mday'],$Date2Arr['year']);
$hours_diff=floor(($d2-$d1)/3600);
if($hours_diff>24)
$result= 'unsuccessful';
}
else
$result= 'never';
return $result;
}
//page layout function
function ShowMessageFor($psCheckType,$web_url)
{
$web_url=$web_url."/index.php";
return "<div class='notificationDiv' style=\"position:absolute;top:0;left:0;bottom:0;right:0;
margin:0;height:10%;width:100%;z-index:10001;
opacity:0.6;filter:alpha(opacity=60);text-align:center;vertical-align:middle;
\" >
$psCheckType is disabled in your browser. Please enable it and reload this page.
</div>
<center>
<table style='border:solid 0px black;width:100%;height:100%;margin:0;'>
<tr>
<td style='text-align:center'>
<form action=\"$web_url\">
<input type=\"submit\" value=\"Click here to reload this page\" />
</form>
</td>
</tr>
</table>
</center>
";
}
function IsCookieEnabled()
{
$phyPathIfIpnFile=$_SERVER['SCRIPT_FILENAME'];
$path_parts = pathinfo($phyPathIfIpnFile);
$filename=$path_parts['filename'];
if($filename!="ipn" and $filename!="update_product_membership_status_expirestatus")
{
if(!isset($_COOKIE['MemberSiteCookie'])){
setcookie('MemberSiteCookie','true',time()+(24*60*60),'/');
$lsQueryStringSeparator = '?';
if(strpos($_SERVER['REQUEST_URI'],'?')===true){
$lsQueryStringSeparator = '&';
}
$_SESSION['Referrer'] = $_SERVER['REQUEST_URI'];
header('location:'.WEB_URL.'/checkcapability.php?checktype=cookie');
die;
//header('location:'.$_SERVER['REQUEST_URI'].$lsQueryStringSeparator.'cookiecheck=true');
}
return true;
}
}
function IsLoopBack(){
$IsLoopBack = false;
//logic for loopback
if($_SERVER["REMOTE_ADDR"] == $_SERVER["SERVER_ADDR"]) $IsLoopBack = true;
//logic for
if($_SERVER["REMOTE_ADDR"] == '127.0.0.1') $IsLoopBack = true;
//logic for IP range
$lanIPFrom = ip2long('192.168.99.0');
$lanIPTo = ip2long('192.168.99.255');
$clientIP = ip2long($_SERVER["REMOTE_ADDR"]);
if($clientIP>=$lanIPFrom && $clientIP<=$lanIPTo) $IsLoopBack = true;
return $IsLoopBack;
}
function generateWordpressHash($pass){
$sqlQuery= "select md5('$pass') as hashPass";
$res=mysql_query($sqlQuery);
$result=mysql_fetch_assoc($res);
$pass=$result['hashPass'];
}
function assign_sessions() {
global $_MEMBERSGEAR_SESSION;
foreach($_MEMBERSGEAR_SESSION['membersgear_session'] as $key=>$value) {
$_SESSION[$key] = $value;
}
}
function IsLoopBack_check_membersGear(){
$IsLoopBack = false;
//logic for loopback
if($_SERVER["REMOTE_ADDR"] == $_SERVER["SERVER_ADDR"]) $IsLoopBack = true;
//logic for
if($_SERVER["REMOTE_ADDR"] == '127.0.0.1') $IsLoopBack = true;
//logic for IP range
$lanIPFrom = ip2long('192.168.99.0');
$lanIPTo = ip2long('192.168.99.255');
$clientIP = ip2long($_SERVER["REMOTE_ADDR"]);
if($clientIP>=$lanIPFrom && $clientIP<=$lanIPTo) $IsLoopBack = true;
return $IsLoopBack;
}
?>