<?php
function GetPostVar($name, $sDefault = "") {
 global $_GET,$_POST;
 return (isset($_GET[$name])) ? $_GET[$name] : ((isset($_POST[$name])) ? $_POST[$name] : $sDefault);
}

function safe_substr($originalStr, $st1,$end1 )
{
	return substr($originalStr, $st1,$end1);  // abcd
}

function safe_substr2($originalStr, $st1,$end1 )
{
	$str2 =  substr($originalStr, $st1,$end1);  // abcd

$str2 = str_replace("<a", "", $str2);
$str2 = str_replace("<p", "", $str2);
$str2 = str_replace("href", "", $str2);
$str2 = str_replace("http://", "", $str2);
//$str2 = str_replace("""", "", $str2);
$str2 = str_replace("<", "", $str2 );
$str2 = str_replace(">", "", $str2 );


		return $str2;
}

 function getRealIpAddr()
{
    if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet
    {
      $ip=$_SERVER['HTTP_CLIENT_IP'];
    }
    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy
    {
      $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
      $ip=$_SERVER['REMOTE_ADDR'];
    }
    return $ip;
}

?>