2010-09-15, 05:26 PM
Hi, I've been trying to insert this php code in my header, that simply displays an icon when a website is online or offline.
Here's what I have so far, but honestly, I don't know what I am doing :
The code is displayed correctly but appears at the top left corner of the index page. I'd like to display it somewhere cute under the header, but I have no idea how to insert it in the forum layout.
Cheers !
Here's what I have so far, but honestly, I don't know what I am doing :
<?php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("index_start", "stat_index_start");
function stat_info()
{
return array
(
"name"=>"Status",
"description"=>" ",
"website"=>" ",
"author"=>" ",
"version"=>"1.0",
"compatibility"=>"*"
);
}
function stat_index_start()
{
$ip = "194.71.10.15";
$ipstatic = "194.71.10.18";
$port = "80";
if (! $sock = @fsockopen($ip, $port, $num, $error, 3))
echo "Site is <img src='http://img696.imageshack.us/img696/7649/offlinef.png' alt='Offline'/>";
else{
echo "Site is <img src='http://img215.imageshack.us/img215/1135/onlineb.png' alt='Online'/>";
fclose($sock);
}
}
?>
The code is displayed correctly but appears at the top left corner of the index page. I'd like to display it somewhere cute under the header, but I have no idea how to insert it in the forum layout.
Cheers !