Advertisement
mamouth

ping.php

Aug 24th, 2012
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.         <meta charset="utf-8">
  5.         <title>Test your ping</title>
  6. </head>
  7. <body>
  8.         <?php
  9.                 $ip_en_cours = $_SERVER["REMOTE_ADDR"];
  10.                 $pinginfo = exec("ping -c 2 $ip_en_cours | tail -1| awk '{print $4}' | cut -d '/' -f 2");
  11.         ?>
  12.  
  13.         <img src="fr.gif" alt="French flag" /> Roubaix, France
  14.         <?php
  15.                 if ($pinginfo<70) {
  16.                         echo "<font color=\"green\"><strong>$pinginfo ms</strong></font>";
  17.                 }
  18.                 elseif ($pinginfo>70 && $pinginfo<100) {
  19.                         echo "<font color=\"orange\"><strong>$pinginfo ms</strong></font>";
  20.                 }
  21.                 else {
  22.                         echo "<font color=\"red\"><strong>$pinginfo ms</strong></font>";
  23.                 }
  24.  
  25.         ?>
  26.  
  27. </body>
  28. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement