[FONT=“Georgia”]Hi Guys,
[SIZE=“3”]
If you’ve seen from my previous posts in this forum, you may have noticed that i’m a newbie when it comes to javascript, anyway.
I’m trying to create an array sort of thing to convert the country name’s to continent, and set it as a cookie. I spent all that time writing a PHP script for this same thing only to find out that my webhost does not have the maxmind apache module.
I also don’t know how to get the value of the country from a javascript function.
[/SIZE]
function country_to_continent( $country ){
$continent = '';
if( $country == 'AF' ) $continent = 'AS';
--CUT OFF DUE TO TEXT LIMIT, FIND THE FULL CODE HERE: http://infinitymedia.pastebin.com/7WWDeyVT
return $continent;
}
My current code is below
<!-- Start Maxmind's Work | And Yes I know maxmind isn't a persons name -->
<script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>
<br>Country Code:
<script language="JavaScript">document.write(geoip_country_code());</script>
<!-- End Maxmind's Work | And Yes I know maxmind isn't a persons name -->
<!-- Start Maxmind's Work | And Yes I know maxmind isn't a persons name -->
<script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>
<script language="JavaScript">document.write("<br>Country Code:".geoip_country_code());</script>
<!-- End Maxmind's Work | And Yes I know maxmind isn't a persons name -->
<script type="text/javascript">
function getCookie(c_name){if (document.cookie.length>0){c_start=document.cookie.indexOf(c_name + "=");if (c_start!=-1){c_start=c_start + c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if (c_end==-1) c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}return "";}
function setCookie(c_name,value,expiredays){var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toUTCString());}
function popupLocate(){
cookie=getCookie("cache-location");
if(cookie!=null && cookie!=""){
//Nothing To Put Here
}
else {
setCookie("cache-location"," <!-- I don't know how to put the continent code here --> ",365);
}
}
</script>
<a href="#" onClick="popupLocate()">Do "popupLocate()"!</a>
Thanks in Advance
Humza[/FONT]