How would I combine these two codes, PHP and HTML?
Posted
by
user1887109
on Stack Overflow
See other posts from Stack Overflow
or by user1887109
Published on 2012-12-08T11:01:57Z
Indexed on
2012/12/08
11:03 UTC
Read the original article
Hit count: 215
This is what I have currently:
<html>
<body oncontextmenu="return false;" bgcolor="5385ab">
<p align=center><a href="test.php"><img src="image.png"/></a></p>
</body>
</html>
I need the <body>
part and to combine this PHP geo-redirect code with "test.php" also including the "image.png"
Here is the PHP code:
<?php
require_once("geoip.inc");
$gi = geoip_open("/var/lib/GeoIP/GeoIP.dat",GEOIP_STANDARD);
$country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
geoip_close($gi);
if($country_code == 'FR')
{
header('Location: http://www.test.php');
}
else
{
header('Location: http://www.yahoo.com/');
}
?>
I'm not familiar with PHP so I have no idea how to even go about testing these two together. Hope you can help! Thank you.
© Stack Overflow or respective owner