vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Pinging a Server - Need Help (https://vborg.vbsupport.ru/showthread.php?t=191148)

evenmonkeys 09-17-2008 06:31 PM

Pinging a Server - Need Help
 
I am working with scratch here. I've been searching these forums all day and I can't seem to make any sense of what I'm finding. I'm going insane here.

I just want something very simple. I want to be able to display the status of my server on the forum somewhere, anywhere. I don't care. I can move things around rather easily. I'm just struggling creating it.

Anyways, what I want to do is ping my computer here and home to show whether or not it is connected to the internet. I run a private gaming server for my friends and I to play on, but it'd be nice if they knew whether or not it was up and running before they tried logging in. If the computer is turned on, the server is turned on.

Could someone either build me something or point me toward something SIMPLE. All I want to do is see if the thing's turned on. I am interested in placing the status in my header.

$ping = ping yarub's server;
$status = $ping;

Obviously that's not accurate, but you get my idea. Please help me. =(

SEOvB 09-17-2008 06:36 PM

use a pinging script that will give you the output, then use the hooks and plugin system as instructed in the vBulletin manual and insert the code into your template

evenmonkeys 09-17-2008 06:37 PM

That's the point. I can't find one that's simple enough for my mind to understand. =\

SEOvB 09-17-2008 08:05 PM

Here's a easy one

http://www.greenbird.info/xantus-webdevelopment/ping

evenmonkeys 09-17-2008 09:23 PM

That's the one I was trying. Could you possible help me make a plugin that would make it work? >_> 'Cause it's not working.

MoT3rror 09-18-2008 02:34 AM

<a href="http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=8&txtCodeId=1786" target="_blank">http://www.planet-source-code.com/vb...txtCodeId=1786</a>

evenmonkeys 09-18-2008 02:57 AM

So if it doesn't connect to the server, it prints out a million lines of error. That's not what I'm looking for. I want something simple. There's got to be an easier way to do this.

Server is Offline
Server if Online

That's all I want in the end.

EDIT: Maybe I'm asking for the wrong thing. I don't want to ping anything. I just want to see if the darn thing is connected to the internet. That's all I want.

Dismounted 09-18-2008 05:25 AM

PHP Code:

$site 'yoursite.com';
$port 80;
$check = @fsockopen($site$port);

if (!
$check)
{
    echo 
'Server is Currently Down!';
}
else 
{
    echo 
'Server is Currently Up!';



gfxhelp.com 09-18-2008 05:53 AM

Have a look at http://www.greycube.com/ and check out LGSL, not sure if it's what you're looking for, but it checks if game servers are up and can show stats for them too like players, maps, settings etc. It generally outputs a list of game servers which you specify by IP, but if you plan on making a small menu for just one game server you can easily redo the layout for a small menu.

MrEyes 09-18-2008 07:43 AM

Does your local server run a web server of any description and if not is it possible to install one?

If yes, then there is a much easier solution....

Create a "server is online" image and put it on your local webserver, for example:

http://mylocalwebserver.dyndns.com/online.gif

Then create a "server is offline" image and put it on your internet/forum server, for example:

http://www.myinternetforum.com/offline.gif

Once you have the two images, you would then use javascript to attempt to load the "online.gif" image from your local server and if not possible it displays the "offline.gif" from the internet server.

Job done

EDIT: I did this for a project a few years ago, I will see if I can dig out the JS for it. No promises though

EDIT: Found it:

Code:

<html>
        <head>
        </head>

        <body>
                <img name="serverStatusImage" src="checking.gif" alt="Checking Server Status...">
                <script type="text/javascript">
                <!--
                        function SetOnlineStatus() {
                                document["serverStatusImage"].src = onlineImageSrc;
                                document["serverStatusImage"].alt = 'Server Online';
                        }
       
                        function SetOfflineStatus() {
                                document["serverStatusImage"].src = offlineImageSrc;
                                document["serverStatusImage"].alt = 'Server Offline';
                        }
                       
                        var onlineImageSrc = 'http://www.google.co.uk/images/nav_logo3.png'
                        var offlineImageSrc = 'http://www.myinternetsite.com/offline.gif'
                       
                        var onlineImage = new Image();
                        onlineImage.onload = SetOnlineStatus;
                        onlineImage.onerror = SetOfflineStatus;
                        onlineImage.src = onlineImageSrc;
                //-->
                </script>
        </body>
</html>

The only thing I forgot is the "checking.gif" image which is displayed until the server check has been performed


All times are GMT. The time now is 05:20 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01120 seconds
  • Memory Usage 1,742KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete