Results 1 to 7 of 7

Thread: PHP ping results

  1. #1
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default PHP ping results

    is this right?

    <?php
    $ping1 = system("ping -n 2 services.****irc.net");
    $ping2 = system("ping -n 2 ecstasy.****irc.net");
    $ping3 = system("ping -n 2 oxycontin.****irc.net");
    $ping4 = system("ping -n 2 hydrocodone.****irc.net");

    echo $ping1;
    echo '<hr />';
    echo $ping2;
    echo '<hr />';
    echo $ping3;
    echo '<hr />';
    echo $ping4;

    ?>

    simple ping script that i wrote using bits of this code...
    http://www.theworldsend.net/ping_src.php
    Enjoy...

    Edit....
    and i didnt know you could use php with images...
    http://www.thepregnancytester.com/im...n&LBS=12&OZS=3
    dynamically created birth certificate....only a spoof though...
    Last edited by boxxertrumps; 11-13-2006 at 11:01 PM. Reason: birth cert WTF!!!
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  2. #2
    Join Date
    Nov 2006
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    What exactly is this for?

    and you know that may only work on a Nix box ?

    if Ping is enabled as well as the stuff for System
    both can be disabled.

  3. #3
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    its for my freind that runs a couple irc/http servers,
    and he wants to have a page with the admin for each
    and their ping time, so that ones with really high traffic
    people wont use. and it will also show if the server is
    up or not (timeout)

    back to the main question, is there anything wrong with the code?
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  4. #4
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Basically nothing's wrong, however the script will "hang" when you have DNS problems. After that I see you even took simple precautions about adding some unwanted "attributes" to ping command, however on form validation only (the regex you use is insufficient).

  5. #5
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    so i would have a better chance of success with using the IP address instead... and what unwanted attributes?
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    $register_globals = (bool) ini_get('register_gobals');
    Don't code for register_globals, even conditionally. $_GET, $_POST, and $_REQUEST still work even if register_globals is enabled, and you should use them instead.
    Code:
             $host= preg_replace ("/[^A-Za-z0-9.-]/","",$host);
          $count= preg_replace ("/[^0-9.]/","",$count);
    Instead of this, try shell_escape().
    Code:
             system("killall ping");// kill all ping processes in case there are some stalled ones or use echo 'ping' to execute ping without shell
    Pointless. If this code is reached, the ping has already ended
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    i have no clue what you just said....
    its very confusing for a php noob like me....
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •