server online / offline

Various mods to change or add features.

server online / offline

Postby monaiz » 2011-03-07 02:14 am

Hi, i want to make a server list for a game called minecraft
so i need to have it were it shows if the server is online or offline
also ineed it where if the server is on longer the higher it goes on the list
monaiz
Newbie
 
Posts: 3
Joined: 2011-01-01 01:01 pm

Re: server online / offline

Postby Jtheman » 2011-03-09 01:50 am

I need this :D
Jtheman
Newbie
 
Posts: 3
Joined: 2011-03-06 02:38 am

Re: server online / offline

Postby Morus » 2012-01-08 07:13 pm

Hi All,

I'm trying to make the script but I stucked on 1 thing. But first things first. This is what I've done so far, maybe somebody else will help me to finish it. (I'm not php expert).

To check if the specify server is online/offline you need to add some tables to sql and also some lines into registration page.

SQL
Code: Select all
ALTER TABLE `ats_sites` ADD `server_ip` varchar(78) collate latin1_general_ci NOT NULL AFTER `title` ;
ALTER TABLE `ats_sites` ADD `port` varchar(78) collate latin1_general_ci NOT NULL AFTER `server_ip` ;

check what tables you have, I made it as default "ats_sites"

Open sources/join.php and find: (line 37 and 38 in my php file)
Code: Select all
    $TMPL['error_title'] = '';
    $TMPL['error_style_title'] = '';


and add AFTER
Code: Select all
    $TMPL['error_server_ip'] = '';
    $TMPL['error_port'] = '';
* This can be added anywhere, I just prefer to do it as above


Next find: (line 102 in my php file)
Code: Select all
    if (!isset($TMPL['title'])) { $TMPL['title'] = ''; }


and add after:
Code: Select all
    if (!isset($TMPL['server_ip'])) { $TMPL['server_ip'] = ''; }
    if (!isset($TMPL['port'])) { $TMPL['port'] = ''; }


next find: (line 110 in my php file)
Code: Select all
    if (isset($TMPL['title'])) { $TMPL['title'] = stripslashes($TMPL['title']); }


and add after
Code: Select all
    if (isset($TMPL['server_ip'])) { $TMPL['server_ip'] = stripslashes($TMPL['server_ip']); }
    if (isset($TMPL['port'])) { $TMPL['port'] = stripslashes($TMPL['port']); }

next find: (line 126 in my php file)
Code: Select all
    $TMPL['title'] = $DB->escape($FORM['title'], 1);


and add after
Code: Select all
    $TMPL['server_ip'] = $DB->escape($FORM['server_ip'], 1);
    $TMPL['port'] = $DB->escape($FORM['port'], 1);
All of the above actions will get IP and port from all new registered people and store it in our database.


Now open /your skin/join_form.html and find: (line 26 in my html file)
Code: Select all
<div class="{$error_style_title}"><label>{$lng->g_title}<br />
<input type="text" name="title" size="50" value="{$title}" />
{$error_title}
</label></div><br />


and add after
Code: Select all
<div class="{$error_style_server_ip}">Server IP<label>{$lng->g_server_ip}<br />
<input type="text" name="server_ip" size="20" value="{$server_ip}" />
{$error_server_ip}
</label></div><br />
<div class="{$error_style_port}">Port<label>{$lng->g_port}<br />
<input type="text" name="port" size="10" value="{$port}" />
{$error_port}
</label></div><br />


Now we need to get a script that will check if IP and port are open. I'm using this php code:
Code: Select all
<?php
$ip = "DESIRE IP";
$port = "PORT";
if (! $sock = @fsockopen($ip, $port, $num, $error, 5))
echo '<B><FONT COLOR=red>Offline</b></FONT>';
else{
echo '<B><FONT COLOR=lime>Online</b></FONT>';
fclose($sock);
}
?>

Now I stucked. Basicly what I want is to show Online / Offline status for each user in their stats page (stats.html). See attached picture.

Question is how to make the above script to recognise server IP and port for each individual user and place it in stats.html like in the attached pictures. Any help apreciate.

Regards
You do not have the required permissions to view the files attached to this post.
Morus
Newbie
 
Posts: 2
Joined: 2012-01-08 05:52 pm

Re: server online / offline

Postby Morus » 2012-02-04 10:15 pm

Thanks to Basti I have my Online/Offline server stats up and running, all based on Visiolist.
Thanks Seb
Morus
Newbie
 
Posts: 2
Joined: 2012-01-08 05:52 pm

Re: server online / offline

Postby fpsxgames » 2012-06-27 06:41 am

Thanks to Basti I have my Online/Offline server stats up and running, all based on Visiolist.
Thanks Seb


Could you tell us how u did it im having problems adding to stata to?
fpsxgames
Newbie
 
Posts: 3
Joined: 2012-06-27 05:34 am


Return to Mods

Who is online

Users browsing this forum: No registered users and 4 guests

cron