1
Is there a way to include an external php file into an XOOPS block, or module or something?
I have this php file that includes a bunch of images.
For the file structure..
Root
-mohaa.php
-[IMAGES DIR]
-image1.jpg
.
.
-imagex.jpg
So I placed it in a seperate folder
My Root
-[Xoops Dir]
-[OtherModules Dir]
-[mohaastat Dir]
-mohaa.php
-[images dir]
-image1.jpg
-image2.jpg
.
.
-imagex.jpg
So how could I call that mohaa.php file into a block?
if (!$_GET['server']) {
$server_ip = "69.56.150.243"; // the ip of the server which stats are shown
$server_port = "12203"; // the port of the server which stats are shown
} else {
$server = explode(":", $_GET['server']);
$server_ip = $server[0];
$server_port = $server[1];
}
$server_ip = "udp://" . $server_ip;
$connect = fsockopen($server_ip, $server_port, $errno, $errstr, 30);
if ($connect) {
socket_set_timeout ($connect, 1, 000000);
$send = "ÿÿÿÿ" . chr (0x02) . "getstatus";
fputs($connect, $send);
fwrite ($connect, $send);
$output = fread ($connect, 1);
if (! empty ($output)) {
do {
$status_pre = socket_get_status ($connect);
$output = $output . fread ($connect, 1);
$status_post = socket_get_status ($connect);
} while ($status_pre[unread_bytes] != $status_post[unread_bytes]);
};
fclose($connect);
$output = explode ("\", $output);
$max_index = array_search ("sv_maxclients", $output);
$max_clients = $output[$max_index+1];
$max_index = array_search ("mapname", $output);
$mapname = $output[$max_index+1];
$max_index = array_search ("sv_hostname", $output);
$hostname = $output[$max_index+1];
$max_index = array_search ("g_gametypestring", $output);
$gametype = $output[$max_index+1];
$last_value = count($output) - 1;
$players_string = $output[$last_value];
$players_string = explode(""", $players_string);
$get_first_ping = explode("n", $players_string[0]);
$players_string[0] = $get_first_ping[1];
$i = 1;
$players = 0;
while (count($players_string) != $i) {
$i++;
$i++;
$players++;
}
if (substr($mapname, 0, 3) == "dm/") {
$picture_src = str_replace("dm/", "", $mapname);
} else {
$picture_src = str_replace("obj/", "", $mapname);
}
$picture_src = "images/" . $picture_src . ".jpg"; // path to the map-pictures
}
if (!file_exists($picture_src)) {
$picture_src = "images/no_image.jpg"; // image to display when there's no image of the current map
}
if (!$max_clients) {
?>
#20203F">
<table align="center" bgcolor="#20203F">
<tr>
<td><p align="center"><img src="images/offline.jpg" border="1">p>td>
tr>
table>
body>
html>
exit;
}
?>
=$hostname?>
Gametype: =$gametype?> | | Players: =$players?>/=$max_clients?> | Map: =$mapname?> | =$picture_src?>" border="1" width="200" height="150"> | |
Name | Ping | $i = 1; while (count($players_string) != $i) { $j = $i -1; ?> =$players_string[$i]?> | =$players_string[$j]?> | $i = $i + 2; } ?> |