Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * +--------------------------------------------------------------+
- * | Volkova Online Checking |
- * +--------------------------------------------------------------+
- * | |
- * | Author: Ryan |
- * | Version: 0.01 |
- * | |
- * | |
- * | |
- * +--------------------------------------------------------------+
- */
- error_reporting(0); //If you can not connect to the url you get an error, so by turning error reporting off, you avoid this.
- $name = "Ryan";
- $url = "2.126.10.113:80";
- function get_url_contents($url){
- $crl = curl_init();
- $timeout = 3;
- curl_setopt ($crl, CURLOPT_URL,$url);
- curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
- $ret = curl_exec($crl);
- curl_close($crl);
- return $ret;
- }
- $str = get_url_contents($url);
- $im = imagecreatetruecolor(125, 25);
- $colour = imagecolorallocate($im, 255, 255, 255);
- imagefill($im, 0, 0, $colour); //Fill the image with white
- $black = imagecolorallocate($im, 0, 0, 0);
- $green = imagecolorallocate($im, 121, 212, 121);
- $red = imagecolorallocate($im, 209, 62, 62);
- imagestring($im, 3, 5, 5, "$name is: ", $black);
- if ( $str ) {
- imagestring($im, 3, 65, 5, "Online", $green);
- } else {
- imagestring($im, 3, 65, 5, "Offline", $red);
- }
- header('Content-Type: image/jpeg');
- imagejpeg($im, NULL, 100);
- imagedestroy($im);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment