""){ $qString="?".$_SERVER["QUERY_STRING"]; }else { $qString=""; } ?>
0){ $rec=mysql_fetch_array($rs); if ($nParam==1){ $subTitle=$rec['title_en']; }else { $subTitle=$rec['title_in']; } return $subTitle; } } function countryCityFromIP($ipAddr){ //function to find country and city from IP address //Developed by Roshan Bhattarai [url]http://roshanbh.com.np[/url] //verify the IP address for the ip2long($ipAddr)== -1 || ip2long($ipAddr) === false ? trigger_error("Invalid IP", E_USER_ERROR) : ""; $ipDetail=array(); //initialize a blank array //get the XML result from hostip.info $xml = file_get_contents("http://api.hostip.info/?ip=".$ipAddr); //get the city name inside the node and preg_match("@(\s)*(.*?)@si",$xml,$match); //assing the city name to the array $ipDetail['city']=$match[2]; //get the country name inside the node and preg_match("@(.*?)@si",$xml,$matches); //assign the country name to the $ipDetail array $ipDetail['country']=$matches[1]; //get the country name inside the node and preg_match("@(.*?)@si",$xml,$cc_match); $ipDetail['country_code']=$cc_match[1]; //assing the country code to array //return the array containing city, country and country code return $ipDetail; } 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; } function getCountryCode($nID){ $sql="select code_3digit from country where code_2digit='$nID'"; $rs=mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($rs)>0){ $rec=mysql_fetch_array($rs); $nCode=$rec['code_3digit']; }else { $nCode=$nID; } return $nCode; } function cekTrans($strTrans, $nParam){ if ($nParam==2){ $sql="select ind from varspectrans where en='$strTrans'"; $rs=mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($rs)>0){ $rec=mysql_fetch_array($rs); $nTrans=$rec['ind']; }else { $nTrans=$strTrans; } }else { $nTrans=$strTrans; } return $nTrans; } ?>