Posted by WeeWillyTonka on 09/03/05 16:42
IP2MORE :: IP2COUNTRY V2
I'm trying to use the above it is working fine apart from if I use <?
include(" ") ?> to ad it to any page's it shows the web servers IP address
and not the visitor.
I know this is because the web page is requesting the include file,but what
I can't seem to do is mod the script to work round this if indeed it is
possible.
Can anyone help me with this or is it not possible?
Thanks
WW
<?php
require_once('i2m.class.php');
if(isset($_GET['ip']) && !empty($_GET['ip'])){
$i2m = new ip2more($_GET['ip']);
} else {
$i2m = new ip2more;
}
#$i2m->flags_dir = './flags/';
#$i2m->flags_dir = 'http://domain-name/flags/';
?>
<?php if(isset($_GET['do']) && $_GET['do']=='src'){?>
<?php } else { ?>
<script language="javascript">
<!--
function is_valid_ip(ip_address)
{
var allowed = '.0123456789';
var dots = 0;
var is_valid = true;
if(ip_address.length < 8 || ip_address.length > 15){
is_valid = false;
} else {
for(i=0,l=ip_address.length;i<l;i++){
t = ip_address.substr(i,1);
if(t == '.') dots++;
if(allowed.indexOf(t) == -1){
is_valid = false;
break;
}
}
}
if(dots != 3) is_valid = false;
if(!is_valid) alert('Invalid IP Address');
return is_valid;
}
-->
</script>
[Back to original message]
|