I asked this first in devshed forums but no result anyway,
Hello,
I am trying to send a granted or failed image to a remote domain which is using the html code to trigger the php code on host domain. Let me explain:
There are 2 domains:
www.hostdomain.com (hosting the php code)
www.remotedomain.com (running/calling the php code which is in hostdomain.com)
Below is the code which is on hostdomain.com -> grantedorfailed.php
<?php
// File name: grantedorfailed.php
// ***Remote domain checker***
// Displays a granted image if the script is running on www.remotedomain.com else displays a failed image
if ($_SERVER['HTTP_HOST'] == "www.remotedomain.com")
{
$html = '
<div align="center"><a href="http://www.hostdomain.com"><img src="http://www.hostdomain.com/granted.gif" border="0"></a></div>
';
}
else{
$html = '
<div align="center"><a href="http://www.hostdomain.com"><img src="http://www.hostdomain.com/failed.gif" border="0"></a></div>
';
}
echo $html;
?>
And below is the html code which is on remotedomain.com , Let's say the file is index.php(doesn't matter)
<html>
<head>
</head>
<body>
Status: <a href="http://www.hostdomain.com"><img src="http://www.hostdomain.com/grantedorfailed.php" border="0"></a>
</body>
</html>
So what I am trying to do is: when someone displays the index.php on remotedomain.com the file will trigger the grantedorfailed.php on hostdomain.com and the code should display granted image file which is also in hostdomain.com. If the domain name is not www.remotedomain.com then should display the failed image
The above returns a white screen no syntax errors or etc, probably the $_SERVER['HTTP_HOST'] isn't the right thing to get the domain name or? any ideas?
Thank you,