Anyone have a simple script that shows how much players are online? Because I made this crappy ass web and I just wanted everything to look nice
Anyone have a simple script for how much players are online O_O?!
Thanks?
Mind posting it down?
Anyone have a simple script that shows how much players are online? Because I made this crappy ass web and I just wanted everything to look nice
Anyone have a simple script for how much players are online O_O?!
Thanks?
Mind posting it down?
staus.php
Config.phpPHP Code:<?php
require_once("config.php");
mssql_select_db("GunzDB", $con);
$getcurp = mssql_query("SELECT CurrPlayer,MaxPlayer FROM ServerStatus");
$getcur = mssql_fetch_array($getcurp);
Echo "Users online: ";
echo $getcur['CurrPlayer'];
echo "/";
echo $getcur['MaxPlayer'];
?>
PHP Code:<?
// Configuration Server connection
$host = 'host\SQLEXPRESS';
$user = 'sa';
$pass = 'pasword';
$con = mssql_connect($host,$user,$pass);
?>
Last edited by death4u2; 04-10-09 at 04:53 PM.
Code:<?Php //MSSQL Connection Information $con = mssql_connect("????????\SQLEXPRESS","sa","SA PASSWORD HERE"); if (!$con) { die('Couldnt not connect: ' . mssql_error()); } mssql_select_db("GunzDB"); //Server status $_host_name = 'WAN IP HERE'; $_servers = Array( "Clan/Quest Server"=> 6000, //"Clan Server"=> 6010, ); foreach($_servers as $_servername => $_port) { $_connection = @fsockopen($_host_name, $_port, $errno, $errstr, 0.003); if(!$_connection) { $_status = '<span class="OFFLINE"><font color="Red">Offline</font></span>'; } else { $_status = '<span class="ONLINE"><font color="Green">Online</font></span>'; } print '<span class="style1">'; print $_servername . ' - ' . $_status . '<br />'; print '</style>'; } //Users Online Script $getcurp = mssql_query("SELECT CurrPlayer,MaxPlayer FROM ServerStatus"); $getcur = mssql_fetch_array($getcurp); Echo "<span style=\"color:#76130C\">Users online: </span>"; echo $getcur['CurrPlayer']; echo "/"; echo $getcur['MaxPlayer']; ?>
Edit:
-MSSQL Connection Info
-WAN IP
-"Clan/Quest Server"=> 6000," Change to whatever type of server you have, for example: "Quest Server"=> 6000,". If you have 2 servers, un-comment the line below that.
Will have a server status like the one on the left at: http://innovationgunz.tk/
if you would know those lines are mine.
$_connection = @fsockopen($_host_name, $_port, $errno, $errstr, 0.003);
if(!$_connection)
{
$_status = '<span class="OFFLINE"><font color="Red">Offline</font></span>';
}
else
{
$_status = '<span class="ONLINE"><font color="Green">Online</font></span>';
}
and this
$getcurp = mssql_query("SELECT CurrPlayer,MaxPlayer FROM ServerStatus");
$getcur = mssql_fetch_array($getcurp);
Echo "<span style=\"color:#76130C\">Users online: </span>";
echo $getcur['CurrPlayer'];
echo "/";
echo $getcur['MaxPlayer'];
?>
those are my lines.
Last edited by death4u2; 04-10-09 at 05:21 PM.
php.ini search for mssql remove ;
I combined 2 server status scripts, and fixed the errors in em. I dunno whos they were, but they are easy to make.
Open php.ini
Search for "MSSQL" (Without the quotes)
Remove the ";"
search for "undefined function mssql_connect()" in the GunZ section. that might help you ;)