Show DevBest [PHP] In-browser pinging script!

DaLightz

See ya'll in the afterlife.
May 19, 2012
1,136
262
In-browser pinging script
By CookieMonsta

I've programmed this about 2 years ago. It was one of my first php script to be created. I figured I'd share this since I don't have use for it anymore, and it could maybe help others.

Installation-
  1. Copy and paste the script below into notepad, or any other word processing application.
  2. Save as index.php.
  3. Save the document to htdocs root (using xampp.)
  4. Now go to - You should see it working.

Configuration-
  1. Open the document with a word processing application.
  2. Look for "Site_ip = " ";"
  3. Edit " " to any other address / ip. (Don't forget the .)
  4. Save and refresh the page.

The script-
PHP:
<html>
<?php
/*
* @author Kris "CookieMonsta"
*
* @prj Website ping
* @file index
*/
 
/* Configuration */
$Site_ip = 'www.google.com'; # Site ip (This will be pinged)
$Node = 'This is a development node.'; # Add extra nodes like this.
 
 
/* Script */
exec("ping " . $Site_ip, $output, $result);
print_r($output);
 
/* Ceckup */
 
if ($result == 0)
{
    echo "<br><br><br> Status: Ping successful!";
} else {
    echo "<br><br><br> Status: Ping unsuccessful!";
}
?>
</html>
 

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
PHP:
<html>
<?php
/*
* @author Kris "CookieMonsta"
*
* @prj Website ping
* @file index
*/
 
/* Configuration */
$Site_ip = 'www.google.com'; # Site ip (This will be pinged)
$Node = 'This is a development node.'; # Add extra nodes like this.
 
 
/* Script */
exec("ping " . $Site_ip, $output, $result);
print_r($output);
 
/* Ceckup */
 
if ($result == 0)
{
    echo "<br><br><br> Status: Ping successful!";
} else {
    echo "<br><br><br> Status: Ping unsuccessful!";
}
?>
</html>
It seams like a pretty bad idea to be running scripts through the OS itself, does this work on Windows hosted servers?
 

Users who are viewing this thread

Top