Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>REKT</title>
- <link rel="stylesheet" href="css.css">
- <script type="text/javascript" src="js/jquery.js"></script>
- <script type="text/javascript" src="js/cookie.js"></script>
- <script type="text/javascript" src="js/unizon.js"></script>
- <script>
- var nigger = "10104DC8";
- </script>
- </head>
- <body>
- <?php
- function nicetime($date)
- {
- if(empty($date)) {
- return "No date provided";
- }
- $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
- $lengths = array("60","60","24","7","4.35","12","10");
- $now = time();
- $unix_date = strtotime($date);
- // check validity of date
- if(empty($unix_date)) {
- return "Bad date";
- }
- // is it future date or past date
- if($now > $unix_date) {
- $difference = $now - $unix_date;
- $tense = "ago";
- } else {
- $difference = $unix_date - $now;
- $tense = "from now";
- }
- for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
- $difference /= $lengths[$j];
- }
- $difference = round($difference);
- if($difference != 1) {
- $periods[$j].= "s";
- }
- return "$difference $periods[$j] {$tense}";
- }
- $date = "2013-06-11 23:50:40";
- $result = nicetime($date);
- ?>
- <header>
- <div id="main">
- <h1>REKT' TEAM</h1>
- <span style="padding-left:20px;">Going stronk since 11-june-2013. (<?php echo 'Which was like '. nicetime($date); ?>)</span>
- </div>
- </header>
- <article><center>
- <a href="index.php" class="swap"><img src="img/orange.png" onmouseover="this.src='img/orange_2.png'" onmouseout="this.src='img/orange.png'" /></a>
- <a href="http://zsource.org/forum/" class="swap"><img src="img/green.png" onmouseover="this.src='img/green_2.png'" onmouseout="this.src='img/green.png'" /></a>
- <a href="servers.php" class="swap"><img src="img/blue.png" onmouseover="this.src='img/blue_2.png'" onmouseout="this.src='img/blue.png'" /></a>
- <a href="http://hedgehogscience.com" class="swap"><img src="img/red.png" onmouseover="this.src='img/red_2.png'" onmouseout="this.src='img/red.png'" /></a>
- <a href="members.php" class="swap"><img src="img/purple.png" onmouseover="this.src='img/purple_2.png'" onmouseout="this.src='img/purple.png'" /></a>
- <br />
- <h2>Server(s)</h2>
- <table id="table-2" class="tablesorter" border="1">
- <thead>
- <tr>
- <th>Hostname</th>
- <th>Game</th>
- <th>Type</th>
- <th>Players</th>
- <th>IP</th>
- </tr>
- </thead>
- <tbody>
- <?php
- //Add the servers you want !
- // IP Port
- //addServer("176.28.55.118", "28952");
- addServer("85.24.170.203", "28961");
- addServer("176.28.55.118","28952");
- addServer("176.28.55.118","7777","SAMP");
- addServer("176.28.55.118","5000","TM2");
- //-------------------- Don't change anything below here, unless you know what you are doing! ------------------------------------
- //Open socket connection, send and receive information, return it & close socket again!
- function getQueryData( $ip, $port, $send )
- {
- $server = "udp://" . $ip;
- $connect = @fsockopen( $server, $port, $errno, $errstr, 5 );
- if ( !$connect )
- return "-1";
- else {
- fwrite( $connect, $send );
- stream_set_timeout( $connect, 7 );
- $output = fread( $connect, 8192 );
- $info = stream_get_meta_data( $connect );
- fclose( $connect );
- if ( !$output || !isset( $output ) || $output == "" || $info[ 'timed_out' ] )
- return "-1";
- else
- return substr( $output, 4 );
- }
- }
- function addServer($ip, $port, $game = "COD")
- {
- @call_user_func("addServer_" . $game, $ip, $port );
- }
- function addServer_SAMP($ip, $port)
- {
- $aIPAddr = explode( '.', $ip );
- $cmd = "SAMP";
- $cmd .= chr( $aIPAddr[ 0 ] );
- $cmd .= chr( $aIPAddr[ 1 ] );
- $cmd .= chr( $aIPAddr[ 2 ] );
- $cmd .= chr( $aIPAddr[ 3 ] );
- $cmd .= chr( $port & 0xFF );
- $cmd .= chr( $port >> 8 & 0xFF );
- $cmd .= 'i';
- $server = "udp://" . $ip;
- $connect = @fsockopen( $server, $port, $errno, $errstr, 2 );
- $fp = $connect;
- $server = $ip . ":" . $port;
- if ( !$connect || !$fp )
- $data = getErr( $ip, $port );
- else {
- fwrite( $fp, $cmd );
- stream_set_timeout( $connect, 2 );
- $output = fread( $fp, 11 );
- $info = stream_get_meta_data( $connect );
- if ( !$output || !isset( $output ) || $output == "" || $info[ 'timed_out' ] )
- $data = getErr( $ip, $port );
- else {
- try {
- $is_passworded = ord( fread( $fp, 1 ) );
- $plr_count = ord( fread( $fp, 2 ) );
- $firstval = dechex( ord( fread( $fp, 1 ) ) );
- $maxplayers = hexdec( dechex( ord( fread( $fp, 1 ) ) ) . $firstval );
- $max_plrs = $maxplayers;
- $strlen = ord( fread( $fp, 4 ) );
- $hostname = fread( $fp, $strlen );
- $strlen = ord( fread( $fp, 4 ) );
- $gamemode = fread( $fp, $strlen );
- $strlen = ord( fread( $fp, 4 ) );
- $mapname = fread( $fp, $strlen );
- }
- catch ( Exception $e ) {
- return getErr( $ip, $port );
- }
- $data = array(
- "value" => 1,
- "hostname" => $hostname,
- "gametype" => $gamemode,
- "protocol" => "SAMP",
- "clients" => $plr_count,
- "maxclients" => $max_plrs,
- "mapname" => $mapname,
- "server" => $server,
- "unclean" => $hostname
- );
- }
- }
- if ( $connect )
- fclose( $connect );
- echoStuff( $data );
- }
- function addServer_TM2($ip, $port)
- {
- $user= "SuperAdmin"; // SuperAdmin Login
- $pass="leetato"; // SuperAdmin Password
- require("includes/GbxRemote.inc.php");
- require("includes/tmfcolorparser.inc.php"); //it should be in the forum somwhere in the toolbox
- $client = new IXR_Client_Gbx;
- $colors= new tmfcolorparser;
- $error = array();
- if (!$client->InitWithIp($ip,$port)) {
- $error[] = 'An error occurred - '.$client->getErrorCode().":".$client->getErrorMessage();
- }
- else {
- if (!$client->query("Authenticate", $user, $pass)) {
- $error[] = 'login failed !<br/>';
- }
- if($client->query('GetPlayerList',500,0)) {
- $Players = $client->getResponse();
- }
- if($client->query('GetServerOptions')) {
- $ServerOptions = $client->getResponse();
- $servername=$ServerOptions['Name'];
- $MaxPLayers=$ServerOptions['CurrentMaxPlayers'];
- }
- $pl=0;
- foreach ($Players as $player) {
- $pl++;
- }
- if($client->query('GetCurrentChallengeInfo')) {
- $CurrentChallengeInfo = $client->getResponse();
- $trackname=$CurrentChallengeInfo['Name'];
- }
- if($client->query('GetCurrentGameInfo')) {
- $GetCurrentGameInfo=$client->getResponse();
- $GameMode=$GetCurrentGameInfo["GameMode"];
- }
- if ($client->query('GetLadderServerLimits')) {
- $GetLadderServerLimits=$client->getResponse();
- $ladderMin = $GetLadderServerLimits['LadderServerLimitMin'];
- $ladderMax = $GetLadderServerLimits['LadderServerLimitMax'];
- $ladderMin = $ladderMin / 1000;
- $ladderMax = $ladderMax / 1000;
- }
- if ($client->query('GetMainServerPlayerInfo')) {
- $GetMainServerPlayerInfo = $client->getResponse();
- $serverlogin = $GetMainServerPlayerInfo['Login'];
- }
- //Formating Game Mod
- switch($GameMode){
- case 2:
- $GameMode="Time attack";
- Break;
- }
- $info = array(
- "value" => "1",
- "hostname" => $colors->toHTML($servername),
- "gametype" => $GameMode,
- "protocol" => "TM2",
- "clients" => $pl,
- "maxclients" => $MaxPLayers,
- "mapname" => $colors->toHTML($trackname),
- "server" => $serverlogin,
- "unclean" => $colors->toHTML($servername)
- );
- /*
- echo '
- <table style="text-align: center; margin: 0; padding: 0; font-size: 12px;" cellpadding="0" cellspacing="0" width="100%" >
- <tr align="center"><td ><a href="tmtp:///#join='.$serverlogin.'" onClick="this.blur()" >'.$colors->toHTML($servername).'</a></td></tr>
- <tr align="center"><td>'.$colors->toHTML($trackname).'</td></tr>
- <tr align="center"><td>'.$pl.' / '.$MaxPLayers.'</td></tr>
- <tr align="center" ><td>'.$ladderMin.'k - '.$ladderMax.'k LP</td></tr>
- <tr align="center"><td>'.$GameMode.'</td></tr>';
- */
- if (count($error) > 0) {
- foreach ($error as $failure) {
- // echo '<tr><td>'.$failure.'</td></tr>';
- }
- }
- echoStuff( $info );
- }
- }
- function addServer_MTA($ip, $port)
- {
- $data = mta_getServer($ip,$port);
- $info = array(
- "value" => "?",
- "hostname" => $data->name,
- "gametype" => $data->gameshort,
- "protocol" => "MTA",
- "clients" => $data->players,
- "maxclients" => $data->maxplayers,
- "mapname" => $data->map,
- "server" => $ip . ":" . $port,
- "unclean" => $data->name
- );
- echoStuff( $info );
- }
- //Messy code by Wojjie
- function mta_getServer_process($dat) {
- if (substr($dat,0,4)=="EYE1") {
- $dat=substr($dat,4);
- $i=0;
- while($dat!="") {
- if (substr($dat,0,2)==chr(1)."?") {
- $dat=substr($dat,2);
- }
- $l=ord(substr($dat,0,1));
- $blks[$i]=substr($dat,1,$l-1);
- $dat=substr($dat,$l);
- $i++;
- }
- $ret->gameshort=$blks[0];
- $ret->port=$blks[1];
- $ret->name=$blks[2];
- $ret->rules['game']=$blks[3];
- $ret->map=$blks[4];
- $ret->rules['version']=$blks[5];
- if ($blks[6]=="0") {
- $ret->public=1;
- } else {
- $ret->public=0;
- }
- $ret->players=$blks[7];
- $ret->maxplayers=$blks[8];
- $j=0;
- for ($i=11; $i<sizeof($blks)-2; $i=$i+5) {
- $ret->player[$j]->name=$blks[$i];
- $ret->player[$j]->score=$blks[$i+3];
- $ret->player[$j]->time=0;
- $j++;
- }
- }
- return $ret;
- }
- function mta_getServer($ip,$port) {
- $fp=fsockopen("udp://$ip", $port, $errno, $errstr);
- if (!$fp) {
- } else {
- stream_set_timeout($fp,1,0);
- fwrite($fp,"s");
- $data=fread($fp,16384);
- fclose($fp);
- return mta_getServer_process($data);
- }
- }
- function addServer_COD($ip, $port)
- {
- //Commands available to send:
- $getinfo = "\xFF\xFF\xFF\xFFgetinfo\x00";
- $getstatus = "\xFF\xFF\xFF\xFFgetstatus\x00";
- //Command that gets sent.
- $cmd = $getinfo;
- $connection = getQueryData( $ip, $port, $cmd );
- $info = parseQueryData( $connection, $ip, $port );
- echoStuff( $info );
- }
- //Clean input part from their rest behind
- function cleanFromRest( $self )
- {
- if ( strpos( $self, "\\" ) )
- return substr( $self, 0, strpos( $self, "\\" ) );
- else
- return $self;
- }
- //Parse the query data and return it as array
- //Parse the query data and return it as array.
- function parseQueryData( $input, $ip, $port)
- {
- $server = $ip . ":" . $port;
- $err = "-";
- if ( $input == "-1" )
- $data = array(
- "value" => $input,
- "gametype" => $err,
- "protocol" => $err,
- "clients" => "0",
- "maxclients" => "0",
- "mapname" => $err,
- "unclean" => "Offline",
- "server" => $server
- );
- else {
- //New segmentation code
- $hostname = substr( $input, strpos( $input, "\\hostname" ) + 10 );
- if ( strpos( $input, "\\clients" ) ) {
- $players = substr( $input, strpos( $input, "\\clients" ) + 9 );
- $players = cleanFromRest( $players );
- }
- else
- $players = "-";
- $gametype = substr( $input, strpos( $input, "\\gametype" ) + 10 );
- $maxplayers = substr( $input, strpos( $input, "\\sv_maxclients" ) + 15 );
- $maxplayers = cleanFromRest( $maxplayers );
- $mapname = substr( $input, strpos( $input, "\\mapname" ) + 9 );
- $mapname = cleanFromRest( $mapname );
- $hostname = cleanFromRest( $hostname );
- $gametype = cleanFromRest( $gametype );
- $protocol = substr( $input, strpos( $input, "\\protocol" ) + 10 );
- $protocol = cleanFromRest( $protocol );
- //Get a clean hostname without '^1's or '^5's
- $unclean = $hostname;
- for ( $i = 0; $i < 10; $i++ )
- $hostname = str_replace( "^{$i}", "", $hostname );
- $value = 1;
- //Put information into an array
- $data = array(
- "value" => $value,
- "hostname" => $hostname,
- "gametype" => $gametype,
- "protocol" => $protocol,
- "clients" => $players,
- "maxclients" => $maxplayers,
- "mapname" => $mapname,
- "server" => $server,
- "unclean" => $unclean
- );
- }
- return $data;
- }
- function echoStuff( $data )
- {
- $mappath = "http://momo5504.square7.de/banner/maps/" . getGameEngine($data[ 'protocol' ]) . "/preview_" . $data[ 'mapname' ] . ".jpg";
- if ( $data[ 'value' ] == "-1" )
- $mappath = "http://momo5504.square7.de/banner/maps/no_response.jpg";
- else if( !check_file( $mappath ))
- $mappath = "http://momo5504.square7.de/banner/maps/no_image.jpg";
- echo "<tr>";
- $hostname = addColors( $data[ 'unclean' ] );
- echo "<td><span style='color: #ffffff'>" . $hostname . "</span></td>\n";
- echo "<td><a>" . getGameEngine($data[ 'protocol' ]) . "</a></td>\n";
- echo "<td><a>" . getGametype( $data[ 'gametype' ], getGameEngine($data[ 'protocol' ])) . "</a></td>\n";
- echo "<td><a>" . $data[ 'clients' ] . "/" . $data[ 'maxclients' ] . "</a></td>\n";
- echo "<td><a>" . $data[ 'server' ] . "</a></td></tr>\n\n"; //whar to put it
- }
- function addColors( $input )
- {
- $var = $input;
- $var = str_replace( "^0", "</span><span style='color: #000000'>", $var );
- $var = str_replace( "^1", "</span><span style='color: #ff0000'>", $var );
- $var = str_replace( "^2", "</span><span style='color: #00ff00'>", $var );
- $var = str_replace( "^3", "</span><span style='color: #ffff00'>", $var );
- $var = str_replace( "^4", "</span><span style='color: #0000ff'>", $var );
- $var = str_replace( "^5", "</span><span style='color: #00ffff'>", $var );
- $var = str_replace( "^6", "</span><span style='color: #ff00ff'>", $var );
- $var = str_replace( "^7", "</span><span style='color: #ffffff'>", $var );
- $var = str_replace( "^8", "</span><span style='color: #CC9933'>", $var );
- $var = str_replace( "^9", "</span><span style='color: #8D8D8D'>", $var );
- return $var;
- }
- //Get the game version
- function getGameEngine( $var )
- {
- switch ( $var ) {
- case ( "5" ):
- case ( "6" ):
- return "MW1"; // IW3 engine
- break;
- case ( "101" ):
- return "WAW"; // IW3 engine
- break;
- case ( "142" ): // (g)a(y)Rev protocol (info query)
- case ( "144" ): // (g)a(y)Rev protocol (status query)
- case ( "61586" ):
- return "MW2"; // IW4 engine
- break;
- case ( "19816" ):
- return "MW3"; // IW5 engine
- break;
- default:
- return $var;
- break;
- }
- }
- //Get better GT names
- function getGametype( $var, $game )
- {
- switch ( $var ) {
- case ( "war" ):
- if ( $game == "WAW" ) //WAW gametype war is not IW's TDM
- return "WAR";
- else
- return "TDM";
- break;
- case ( "dm" ):
- return "FFA";
- break;
- case ( "dd" ):
- return "DEM";
- break;
- case ( "sd" ):
- return "S&D";
- break;
- default:
- return strtoupper ($var);
- break;
- }
- }
- //Get the localized mapname for the mapcodes
- function getMapName( $var, $game )
- {
- if ( $fp = fopen( 'http://momo5504.square7.de/banner_stuff/getMap.php?mapname=' . $var . '&game=' . $game, 'r' ) ) {
- $content = '';
- while ( $line = fgets( $fp, 1024 ) ) {
- $content .= $line;
- }
- if ( $content == "" )
- return $var;
- else {
- if ( strpos( $content, "\n" ) )
- return substr( $content, 0, strpos( $content, "\n" ) );
- else
- return $content;
- }
- } else
- return $var;
- }
- function check_file( $file )
- {
- if ( substr( $file, 0, 7 ) == "http://" ) {
- $file_headers = @get_headers( $file );
- if ( $file_headers[ 0 ] == 'HTTP/1.1 404 Not Found' )
- return false;
- else
- return true;
- } else
- return file_exists( $file );
- }
- ?>
- </tbody>
- </table>
- </center></article>
- <footer>
- <dl class="icon">
- <dt style="float:left;"><strong>Unizon IRC</strong></dt><br />
- <dt style="float:left; position:absolute;"><font title="Auto-refresh" id="unizon-auto-refresh">[Auto Refresh]</font><font title="Hide chat" id="unizon-hide">[Show / Hide]</font></dt><br />
- </dl>
- <div class="Unizon">
- <div class="Messages" style="height:200px; max-height:200px; overflow-y:scroll;">
- </div>
- <div class="Input">
- <form action="send.php" method="post" id="UnizonForm">
- <input type="text" name="msg" autocomplete="off" id="msg" style="width:90%;background-color:#fff;"> <input type="submit" value="Send" id="send">
- </form>
- </div>
- </div>
- </footer>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement