Show FTP Status As Sig

From Wiki

Jump to: navigation, search

In this tutorial you will learn how to show your ftp on/offline status as a included image.

Requirements

  • Webspace
  • PHP

2 images (one for online, one for offline) in a folder named "images"

Code

Status.php

<?
// This function check the ftp status and return true (online) or false (offline)
function is_online($server='localhost',$port=80,$timeout=2) {
   $fp = @fsockopen($server, $port, &$errno, &$errstr, $timeout);

   if (!$fp)
       return false;
   else
   {
       fclose($fp);
       return true;
   }
}
header("Content-type: image/gif");
  if (is_online('[Your_URL/IP_Adress]',21) == true) {
     // Display online image
     readfile("images/sonline.gif");
  } else {
     // Display offline image
     readfile("images/soffline.gif");
  }
?>

Replace [Your_URL/IP_Adress] With your URL or IP address.

Now upload status.php to your webspace and use it as your sig on a forum or blog like this

[img]http://www.yourwebspace.com/status.php[/img]
Personal tools