function getIPAddress() {
global $ip,$hours_offset;
$check = date("DH",(time()-(3600*$hours_offset)));
if (isset($ip[$check])) return $ip[$check];
else return $ip['default'];
}
$port="8080";
if ($_SERVER['REMOTE_ADDR']==$ip || $_SERVER['REMOTE_ADDR']=="127.0.0.1")
{
}
$rr = rand(1,32767);
print "<PARAM NAME=allowFlashAutoInstall VALUE=true>\r\n";
print "<param name=Flashvars value='url=http://$ip:$port/a$rr.flv'>\r\n"; // I ran it through my server and it doesn't come up with the target ip address...
print "<param name='movie' value='popup.swf' />\r\n";
print "<param name='quality' value='high' />\r\n";
print "<param name='bgcolor' value='#000000' />\r\n";
print "<embed src='popup.swf' swLiveConnect='true' Flashvars='url=http://$ip:$port/a$rr.flv' quality='high'\r\n"; // Same here
print "bgcolor='000000' width='320' height='240' name='popup' align='middle'\r\n";
print "type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\r\n";
print "</object>\r\n";
?>
Like already mentioned, you don't call your getIPAddress function anywhere.
Somewhere there should be something like
PHP Code:
$currentIP = getIPAddress();
and you should then use $currentIP instead of $ip (which, in your case, is the array holding all the ip addresses, although your code is expecting one single ip address).
function getIPAddress() {
global $currentIP,$hours_offset;
$check = date("DH",(time()-(3600*$hours_offset)));
if (isset($currentIP[$check])) return $currentIP[$check];
else return $currentIP['default'];
}
$port="8080";
if ($_SERVER['REMOTE_ADDR']==$currentIP || $_SERVER['REMOTE_ADDR']=="127.0.0.1")
{
}
$rr = rand(1,32767);
print "<PARAM NAME=allowFlashAutoInstall VALUE=true>\r\n";
print "<param name=Flashvars value='url=http://$currentIP:$port/a$rr.flv'>\r\n"; // I ran it through my server and it doesn't come up with the target ip address...
print "<param name='movie' value='popup.swf' />\r\n";
print "<param name='quality' value='high' />\r\n";
print "<param name='bgcolor' value='#000000' />\r\n";
print "<embed src='popup.swf' swLiveConnect='true' Flashvars='url=http://$currentIP:$port/a$rr.flv' quality='high'\r\n"; // Same here
print "bgcolor='000000' width='320' height='240' name='popup' align='middle'\r\n";
print "type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\r\n";
print "</object>\r\n";
?>
My goal is to put the ip address in place of the word "Array" that is located on the 2nd line. I have tried echoing the getIPAddress function but it screws up the php code.
function getIPAddress() {
global $ip,$hours_offset;
$check = date("DH",(time()-(3600*$hours_offset)));
if (isset($ip[$check])) return $ip[$check];
else return $ip['default'];
}
$currentIP = getIPAddress();
$port="8080";
if ($_SERVER['REMOTE_ADDR']==$currentIP || $_SERVER['REMOTE_ADDR']=="127.0.0.1")
{
}
$rr = rand(1,32767);
print "<PARAM NAME=allowFlashAutoInstall VALUE=true>\r\n";
print "<param name=Flashvars value='url=http://$currentIP:$port/a$rr.flv'>\r\n"; // I ran it through my server and it doesn't come up with the target ip address...
print "<param name='movie' value='popup.swf' />\r\n";
print "<param name='quality' value='high' />\r\n";
print "<param name='bgcolor' value='#000000' />\r\n";
print "<embed src='popup.swf' swLiveConnect='true' Flashvars='url=http://$currentIP:$port/a$rr.flv' quality='high'\r\n"; // Same here
print "bgcolor='000000' width='320' height='240' name='popup' align='middle'\r\n";
print "type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\r\n";
print "</object>\r\n";
?>
It's the UTF-8 byte order mark. It's there because your editor handles the code file as UTF-8 while the browser treats it as ISO-8859-1.
Just make sure that those two encodings are the same, so either change your editor to ISO-8859-1 and delete those characters, or tell the browser what's going on with <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />.