I.p. Ping Online Or Offline

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

I.p. Ping Online Or Offline

ill
Does anyone know of a script that will tell people if an IP is online or offline? Like it will ping it like every fifteen minutes or so and will display an online or offline image accordingly. Or at least it supports images, text is fine I guess, but I'd rather it use images.

Any help on this will be appreciated! Thanks!

Reply

BuffaloHELP
Okay, I am an ancient programmer so I am giving you something that you would laugh at. I believe creating a batch file would be the best at this point. Since batch file would take the minimum CPU resource. Then you can have your Windows scheduler to activate it every 15 minutes. Save it as whatever.bat in any directory.

CODE

@echo off
cls
echo Testing connection to forum...
echo.
ping www.trap17.com -n 20
cls
echo Testing connection to mysite...
echo.
ping www.mysite.domain -n 20
EXIT


Basically, this will open a DOS command window and run its course, then it will EXIT (close the screen). The -n 20 denotes that it will ping 20 times. You can change to whatever number you'd like. Don't forget to replace/add "mysite" with the domain you'd like to ping. For further extensions, type ping /? from your command line.

I hope this helps.
Cheers.

 

 

 


Reply

HmmZ
if(!mysql_connect(what_ip?)){
?>
<img src="offline.gif">
<?
}
else {
?>
<img src="online.gif">
<?
}
?>

its based on a simple code that i use to check and show if my forums are online:
CODE
if(!mysql_connect(localhost, ***, ***)){
?>
<img src="http://online.trap17.com/images/status_offline.gif" border="0" height="14">
<?
}
else {
?>
<img src="http://online.trap17.com/images/status_online.gif" border="0" height="14">
<?
}
?>


I dont know if it works with an ip instead of localhost tho, and im not sure if it has to select a db and pass.

Also, if you want to get a whole list of members to be checked, you could use a db for it, selecting $username and $ip from the db for example:

mysql_connect('localhost','db_name','db_password') or die("could not connect to db");
$username= "mysql_query('select username from table')";
$ip= "mysql_query('select ip from table')";

if($username=!$ip){ echo "username doesnt match the ip"; }
else{
$connect= mysql_connect($ip);}
if(!$connect){
echo "<img src=\"offline.gif\">";}
else{ echo "<img src=\"online.gif\">";}

something like that? im a newbie php coder so sorry if it is all wrong sad.gif

Reply

Spectre
Hmm, to ping an IP address from scratch, you would have to harness the ICMP (see RFC792). I suppose it could be done in PHP, but it is quite complex, and due to the nature of the language (it isn't really intended for such purposes), it could get quite resource intensive.

Another, more realistic option would be to use the system() function in PHP to execute a PING command and capture the output. I've never actually used it for this specific purpose myself, so I don't know how well it would work. Not all servers allow this though, due to security issues - I don't know if Trap17 does or not.

Oh, and BuffaloHELP, Windows batch scripting isn't PHP.

Reply

karlo
Try this:

CODE
<?php
ini_set("default_socket_timeout","05");
set_time_limit(5);
$f=fopen("http://www.somesite.com","r");
$r=fread($f,1000);
fclose($f);
if(strlen($r)>1) {
echo("<b>Online</b>");
}else {
echo("<b>Offline</b>");
}
?>

Reply

iGuest
Me too
I.p. Ping Online Or Offline

Yea I need this too, if anyone can find it please email me at phillip_bm_gibson@hotmail.Com

I need it on my website
So if my ip address (computer) is on my site will say

Online !

And vice versa

Offline ! Thanks , Phil

-reply by phillip

----------admin reply--------

you can use PHP exec() function to ping your own home IP. The ping will execute on Server and it will send out put back to your program.

-shree


Reply

iGuest
online/offline image via javascript
I.p. Ping Online Or Offline

How do I do this with either html or javascript?

Link [online or offline image] (depending on IF address.Com is online or not)

I want to have a list of links with an online OR offline image next to
Each link, depending on the current online/offline status of that link.

-reply by Th3Eagle

-ADMIN REPLY-

You can achieve this using PHP.

There are functions to :-

1. Ping A Website.
2. Get a page from a website and scan for contents to check if everything is OK.
3. You can also check FTP, EMAIL etc. and other services of a website.

Search the web for PHP Website monitoring script.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. php code to ping server on website - 5.71 hr back. (1)
  2. php function to ping - 14.83 hr back. (1)
  3. php ip ping functions - 26.42 hr back. (2)
  4. how to ping my web ip in php - 31.25 hr back. (1)
  5. ping ip script - 44.90 hr back. (1)
  6. php ping an ip - 46.51 hr back. (1)
  7. script check server online ping - 56.19 hr back. (1)
  8. online offline ip script - 66.05 hr back. (1)
  9. imgsrc offline - 70.91 hr back. (1)
  10. php script ping - 75.83 hr back. (2)
  11. ping online - 31.17 hr back. (2)
  12. php ping ip address - 90.67 hr back. (1)
  13. make a program to ask me for ip to ping - 91.56 hr back. (1)
  14. ping ip range php - 94.36 hr back. (1)
Similar Topics

Keywords : p, ping, online, offline

  1. Php Guest Online Script
    (3)
  2. Html Code Tester. Online Script
    (15)
    Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if
    this works. I have not tested it yet, but I will later and post back with a demo and fix it up.
    Current script: CODE <?php //Save this as something like htmltest.php function
    CheckForm() { $html_unsafe=$_POST['code']; //Gives us our user
    input $html_safe=str_replace("<?php"," ",$html_unsafe);
    //Starts security measures $html_safe=str_replace("?>","
    ",$html_sa....
  3. Very Simple Online Now Script
    This is a very simple online now script. (4)
    Hi all, Its Aldo. anyways, I wont be using the method of pagination, i will just tell you how to
    make a basic online now script. When someone logs in, now take into consideration that the name of
    the username input is username ( First ,create a table in your database saying online now and add 2
    fields to it. id and username CODE id type=integer(INT) , auto increment, length =255
    and username = VARCHAR length=the limit a username should be in your site now from there we take
    off : CODE <?php //logged.php //authentication script //connection scri....
  4. The Artists Tutorials :mysql Basic Commands
    The Artists is an online programming unit and gfx designing clan. (0)
    Let's Talk about basic mysql commands used in php. I will now show you a list of the most common
    MySQL FUNCTIONS : QUOTE mysql_connect(MySQL server name,username,password) - opens a connection
    to a MySQL server. mysql_select_db(database name,connection id) - selects a database residing on
    the MySQL server. The database name parameter referes to an active database on the MySQL server that
    was opened with the mysql_connect function. The connection identifier is a reference to the current
    MySQL connection. mysql_query(sql query) - sends a query to the currently ac....
  5. Beginner's Php Tutorial Online At My Site
    (12)
    Hey everyone, over the last week I've been writing a PHP tutorial aimed at absolute beginners
    who have never even seen the syntax of PHP before let alone wrote a PHP script! The tutorial
    assumes you have a basic knowledge of HTML (for the tutorial you will need to write a couple of
    hyper links and forms, nothing complex!) and an internet browser. It tells you about where to
    find the other software needed (apache/XAMPP and a script.text editor) and how to check if it is
    working. The tutorial is basic and focuses on the use of the ECHO, INCLUDE/REQUIRE and I....
  6. Php Online Test
    (8)
    Is there any online PHP / Mysql testing place? I would like to test my PHP knowledge but I have not
    found any online ( free ofcourse). ....
  7. Script That Tracks The User Status
    how can I track on or offline users? (4)
    long explaination: hey, I'm building a user profile site right now. And, I kinda know how to
    make a online/offline detector, but not totally sure. I know I can make a mysql database to track
    them, but how does it entrer the information? I could easily put in a field where when they login it
    sets them to online, but if they don't sign out, and just exit the browser, how can I tell.
    short: I want someone to tell me how to make a online/offline status detector, like they have here
    on trap17. I'd be thrilled if you can post to this, thanks, arcticsnpr....
  8. Add The Online Proxy To Your Site.
    script:phproxy (0)
    it developed by whiteFyre that contained only 5 files: index.php phproxy.class.php javascript.js
    url_forum.inc style.css the demo is on http://hbu.com.ru/proxy/ the script is under gpl.you
    just can edit every file of this 5. and made your own style of online proxy. enjoy it. PS:If the
    member that find your isp is something wrong or block some Ip,just tried this. guangdian....
  9. Users Online Script In Php
    how do i get one? (7)
    I've been seeing a whole bunch of sites that have a Statistics corner, and in there, there are
    things that says "Users Online:", "Page Loads:", "Unique Hits:", and "IP:". Well, I was wondering,
    where do these users get one of these nifty things? I know that PHPNuke offers one, but most of the
    sites that I go to do not use PHPNuke. Any reply is appreciated. /smile.gif' border='0'
    style='vertical-align:middle' alt='smile.gif' /> ....
  10. Online Exam
    Plz Help me (3)
    Hi every one i want to know where can i find php Lan ( online Exam ) i want to make online exam for
    my student but i dont know what is good Cms for that ? i need :: 1 - admin area 2 - student ID and
    password 3 - logs i need cms i want students login with id and passwords and answers my question
    and then i told them whats numer and show them true answer but free do you know where can i find
    this kind of php cms i havenot time to write php code /blink.gif' border='0'
    style='vertical-align:middle' alt='blink.gif' /> thx any way....
  11. Testing Php?
    How can I test it offline? (12)
    Hi guys. I'm wanting to learn PHP. Is there a way I can check my code to see if it works
    without having to upload it to my server? Could it be that my computer doesnt have PHP installed or
    something? Can someone please show me where to download it and how to set it up? Thanks a lot.
    help is greatly appreciated.....
  12. Visitors Online
    With PHP (no MySQL is needed) (9)
    Another script, which shows the visitors onlineat the moment in your site. This script was not made
    by me, I just think it will be very usefull to u. CODE <? $timeout = 15; // change
    it. It is the timer which will delete the member of  online list (in minutes) if
    (!$datei) $datei = dirname(__FILE__)."/online.txt"; $time
    = @time(); $ip = $REMOTE_ADDR; $string =
    "$ip|$time\n"; $a = fopen("online.txt", "a+");
    fputs($a, $s....
  13. Online Radio?
    (9)
    Hey Hows everyone I have a question that i m tryin to figure out....Is it possible {Does anyone know
    how to do it} to make a website with a Radio kinda thing on it...and tht u will controll tht radio
    from ur pc..so like..u can say anythin on ur headphone n stuff...or can anyone make a program where
    pplz will download tht software/program n u will have the controll over it so when u say anythin
    from ur computer..the voice will be heard from tht program...well i think it is possible buh i m not
    sure how to do it...i m not a good programmer so if anyone knws how to make suc....

    1. Looking for p, ping, online, offline

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for p, ping, online, offline

*MORE FROM TRAP17.COM*
advertisement



I.p. Ping Online Or Offline



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE