-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
115 lines (106 loc) · 3.86 KB
/
index.php
File metadata and controls
115 lines (106 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
define( 'MQ_SERVER_ADDR', 'localhost' );
define( 'MQ_SERVER_PORT', 25565 );
define( 'MQ_TIMEOUT', 1 );
// Display everything in browser, because some people can't look in logs for errors
Error_Reporting( E_ALL | E_STRICT );
Ini_Set( 'display_errors', true );
require __DIR__ . '/PHP-Minecraft-Query/MinecraftQuery.class.php';
$Timer = MicroTime( true );
$Query = new MinecraftQuery( );
try
{
$Query->Connect( MQ_SERVER_ADDR, MQ_SERVER_PORT, MQ_TIMEOUT );
}
catch( MinecraftQueryException $e )
{
$Exception = $e;
}
$Timer = Number_Format( MicroTime( true ) - $Timer, 4, '.', '' );
// Check if we have information
if (($Info = $Query->GetInfo()) == false) {
$nodatareceived = true;
}
// Decide about Playerpanels color
if (isset($Exception) OR isset($nodatareceived)) {
$player_panel_class = "panel-danger";
} elseif ($Info['Players'] < 1) {
$player_panel_class = "panel-warning";
} else {
$player_panel_class = "panel-success";
}
$page['navbarid'] = 1;
include "config.php";
include "lib/fetch_all_assoc.php";
include "lib/bbcodes.php";
include "templates/navbar.php";
?>
<div class="container">
<div class="row">
<div class="col-md-8">
<div class="panel panel-default"> <!-- Short description of pegelcraft -->
Pegelcraft ist der Minecraft-Server von der <a href="//pegelf.de">Pegelf.de</a> Community.
</div>
</div>
<div class="col-md-4">
<div class="panel <?php echo $player_panel_class; ?>">
<div class="panel-heading">Momentan online:</div>
<table class="table table-hover">
<?php if(($Players = $Query->GetPlayers()) !== false): ?>
<?php foreach($Players as $Player): ?>
<tr><td><?php echo $Player; ?></td></tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td>Niemand da :(</td></tr>
<?php endif; ?>
</table>
</div>
</div>
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading">
News
</div>
<?php
/*
$mysqli = new mysqli($mysql_info['hostname'], $mysql_info['username'], $mysql_info['password'], "1_forum");
$mysqli->set_charset("utf8");
$threads = $mysqli->query("SELECT threadID FROM wbb1_1_thread WHERE boardID = 105")->fetch_all();
// Extreme dirty PHP Code
$query = "SELECT postID,threadID,userID,username,subject,message,time,isDeleted,isDisabled FROM `wbb1_1_post` WHERE";
foreach ($threads as $Thread) {
$query = $query . " threadID = " . $Thread['0'] . " OR";
}
$query = $query . "DER BY time DESC";
// Until here
$news = $mysqli->query($query);
$news_row = fetch_all_assoc($news, array('postID'));
$mysqli->close();
*/
?>
<div class="panel-body">
<?php // foreach($news_row as $News): ?>
<?php // if($News['subject'] == '' OR $News['threadID'] == '1523') { continue; } ?>
<?php // $News['message'] = str_replace("\n", "<br>", $News['message']); ?>
<?php /* <a href="//pegelf.de/index.php?page=Thread&postID=<?php echo $News['postID']; ?>" id="<?php echo $News['postID']; ?>"><?php echo $News['subject']; ?></a>
<hr>
<?php echo bbcode_parse($BBHandler, $News['message']) ?>
<hr> */ ?>
<?php // endforeach; ?>
Für die aktuellen News rund um Pegelcraft besuche die <a href="//pegelf.de/board88-minecraft/board104-pegelcraft-unser-minecraft-server">Foren</a> (Dies wird irgendwann(tm) auch mal hier erscheinen).
</div>
</div>
</div>
</div>
</div>
<div id="footer">
<div class="container">
<p class="text-muted">This page uses <a href="https://github.com/xPaw/PHP-Minecraft-Query">PHP Minecraft Query</a> Licensed under <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">CC BY-NC-SA 3.0</a> by <a href="http://xpaw.ru/">xPaw</a>. Main part of this site is written by <a href="http://xpaw.ru/">xPaw</a>.</p>
</div>
</div>
<!-- Javascript -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<!-- End Javascript -->
</body>
</html>