Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Script to show server status

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 23-08-2010
Member
 
Join Date: Aug 2010
Posts: 34
Script to show server status
  

Hello,
I have a problem with the following script , I am new to php language. I am trying to display the status of a server with this script

Here is the script
Code:
<?php

 $ cn = TRUE; / / Allow or not the connection
 $ prt = 21; / / Server prt 
 $ ipaddress = "127.0.0.1", / / address (ipaddress) server 
 $ nm = "SERVER nm" / / Server nm

 / / Set the text of the nm server
   echo "Server: $''nm''"
 / / Verification status
   
if (! $ sck = @fsockopen($ ipaddress, $ prt, $ num, $ error, 5))
 / / If it is offline
echo ' is: <font color="#CC0000"> DISCONNECTED </ font> "';
 
else(
 / / If it is online
echo ' is <font color="#00CC00"> CONNECTED </ font> "';

fclose($ sck);

)
?>

Reply With Quote
  #2  
Old 23-08-2010
Member
 
Join Date: Dec 2007
Posts: 761
Re: Script to show server status

Since you're a beginner you are doing well. In fact, it hurts me in your code is that finally, it just does fsockopen (). It's as if you thought over a code to make a simple echo applying a color? You had best hits with the socket extension, and socket_create () socket_connect () etc. What is the server you are trying to test on?
Reply With Quote
  #3  
Old 23-08-2010
Member
 
Join Date: Aug 2010
Posts: 34
Re: Script to show server status

Here
I choose a script to put a simple server status, and it only works when the server is online, while the precise else is a picture to put otherwise.

Code:
<Php
$ ipadd = "861213";
$ ipser = "861213";
$ lgn = @ fsockopen ($ ipadd, 2106, $ errno, $ errstr, 1);
$ = @ Fsockopen gme ($ ipser, 7777, $ errno, $ errstr, 1);
if ($ lgn)
if ($ gme)
echo "
<img src=http:"your image here"> <br>
<img src=http:"your image here"> <br>
"
else
echo "
<img src=http:"your image here"> <br>
<img src=http:"your image here"> <br>
"
?>
Reply With Quote
  #4  
Old 23-08-2010
Member
 
Join Date: Apr 2008
Posts: 3,336
Re: Script to show server status

Hey,
You can try the following code
Code:
<Php
$ ipaddress = "453132";
echo ((@ fsockopen ($ ipaddress, 2106, $ er, $ strer, 2))? 
"<img /> src='http:your address here'" " 
src='http:your address here' <img /> "). "<br />". ((@ 
Fsockopen ($ ipaddress, 7777, $ er, $ strer, 2))? "<img /> 
Src='http:your address here'": "< img src = 
'http:your address here' /> ");
?>
Reply With Quote
  #5  
Old 23-08-2010
Member
 
Join Date: Aug 2008
Posts: 717
Re: Script to show server status

Hello,
I have modified your code, please check if this is working now

Code:
<Php
$ ipaddress = "91121148117";
$ ipaddser = "91121148117", / / this useless line
$ Flogin = @ fsckp ($ ipaddress, 2106, $ errno, $ errstr, 1);
$ = @ fsckp fgame ($ ipaddser, 7777, $ errno, $ errstr, 1) / / So here we change / / useless variable sorting
if ($ flogin) / / here is very bad
if ($ fgame)
echo "
<img src=http:"your image here"> <br>
<img src=http:"your image here"> <br>
"
else
echo "
<img src=http:"your image here"> <br>
<img src=http:"your image here"> <br>
"
?>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Script to show server status"
Thread Thread Starter Forum Replies Last Post
Most WSUS clients show status 'Not yet reported' purvagarg Server Update Service 3 07-01-2014 09:47 AM
Need to force Chrome's status bar to show in the bottom right corner Tyee Technology & Internet 6 17-06-2011 10:59 PM
Windows Explorer Status Bar: does not show file size Chakchiuma Operating Systems 6 11-09-2010 07:40 AM
SatelliteTV Box does not show POWER ON status Delaware India BroadBand 6 10-07-2010 01:07 AM
Script for Advanced status clock Aileen_L Software Development 4 04-02-2010 10:48 PM


All times are GMT +5.5. The time now is 10:52 AM.