K
Kammi_
I'd like to include this script in it (php callback)
it shows this

but it dosn't work can anyone help me pls
PHP:
<?php
class XenForo_Pages_sourceban
{
public static function includeFile(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
{
ob_start();
require("/var/www/html/test.php");
$myContent = ob_get_contents();
ob_end_clean();
$params = array(
'myContent' => $myContent
);
$response->params = array_merge(
$response->params,
$params
);
}
}
PHP:
<?php
//Database Info
$sbhost = 'localhost'; //SQL server host, usually localhost
$sbuser = 'xxx'; //The user to access the database
$sbpass = 'xxx'; //The password to access the database
$sbdb = 'xxx'; //The database name of sourcebans
$sourcebans = 'http://xxx/'; //Link to your Sourcebans install (required for the country flags, with a trailing slash)
$connection = mysqli_connect($sbhost, $sbuser, $sbpass, $sbdb) or die(mysql_error());
?>
<!DOCTYPE html>
<html>
<head>
<title>Bans</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
#flags{text-align: center;}
#table{margin-right: auto; margin-left: auto;}
table, th, td{border: 1px solid black;}
</style>
</head>
<body>
<?php
//Connect to the SQL server and select the database...
mysqli_connect($sbhost, $sbuser, $sbpass, $sbdb) or die('Couldn\'t connect to the MySQL server.');
//mysql_select_db($sbdb) or die('Couldn\'t select the database.');
function SecondsToString($sec, $textual=true){
if($textual) {
$div = array( 2592000, 604800, 86400, 3600, 60, 1 );
$desc = array('mo','wk','d','hr','min','sec');
$ret = null;
foreach($div as $index => $value){
$quotent = floor($sec / $value); //greatest whole integer
if($quotent > 0) {
$ret .= "$quotent {$desc[$index]}, ";
$sec %= $value;
}
}
return substr($ret,0,-2);
} else {
$hours = floor ($sec / 3600);
$sec -= $hours * 3600;
$mins = floor ($sec / 60);
$secs = $sec % 60;
return "$hours:$mins:$secs";
}
}
$result = mysqli_query($connection, "SELECT
b.country, b.created, b.name, b.reason, b.length, b.RemoveType,
CAST(MID(b.authid, 9, 1) AS UNSIGNED) + CAST('76561197960265728' AS UNSIGNED) + CAST(MID(b.authid, 11, 10) * 2 AS UNSIGNED) AS community_id,
a.user AS admin_name
FROM
`sb_bans` b
LEFT JOIN
`sb_admins` a
ON
a.aid = b.aid
ORDER BY
`created` DESC
LIMIT 0, 5");
echo '<table id="table">
<tr>
<th>Country</th>
<th>Date</th>
<th style="text-align: left;">Player</th>
<th>Reason</th>
<th>Admin</th>
<th>Length</th>
</tr>';
while($row = mysqli_fetch_array($result)) {
// Remove whitespace
array_walk($row, "trim");
echo "<tr>";
#Country...
if(!empty($row['country']) && $row['country'] != ' ') {
echo "<td id=\"flags\">" . '<img src="'.$sourcebans.'images/country/'.strtolower($row['country']).'.gif" />'. "</td>";
}
else {
echo "<td id=\"flags\">" . '<img src="'.$sourcebans.'images/country/zz.gif" />'. "</td>";
}
#End country, begin date...
echo "<td>" . date('d/m/Y', $row['created']) . "</td>";
#Player name...
if(!empty($row['name']) && $row['name'] != ' ') {
echo "<td>" . '<a href="http://steamcommunity.com/profiles/'.$row['community_id'].'" target="_blank">'.$row['name'].'</a>' . "</td>";
}
else {
echo "<td>" . '<i>No nickname present</i>' . "</td>";
}
#Reason...
if(!empty($row['reason']) && $row['reason'] != ' ') {
echo "<td>" . $row['reason'] . "</td>";
}
else{
echo "<td>" . '<i>No reason present</i>' . "</td>";
}
#Admin name...
echo "<td>" . $row['admin_name'] . "</td>";
#Length of ban...
if($row['length'] == 0) {
echo "<td>" . 'Permanent '.$row['RemoveType'] . "</td>";
} else {
echo "<td>" . SecondsToString($row['length']).(empty($row['RemoveType'])?'':' (' . $row['RemoveType'] . ')').'</td>';
}
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>
it shows this

but it dosn't work can anyone help me pls