Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 89
0 Users 8 Guests Online

Advanced Site Status

Hello this is a repost of my server status image here on RMB.

First off you will want to make a new file named img.php and in that file code something like:
PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
Header
("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //Expiration Date
Header("Content-type: image/png"); //image type
$width=300//change this if you must
$height=20//change if you want but id leave
$ip "IPHERE"//change to yourip
$port "PORT HERE"//change to server port
$connectXD = @fsockopen($ip$port$errno$errstr2); //connection through fsock
if($connectXD){ //if its available
//background color is white
$c2r=255;
$c2g=255;
$c2b=255;
//text is green
$c1r=0//red
$c1g=125//green
$c1b=0//blue
$string "Online"//Online text :D
}else{ //uh ohs!!!
//background is white
$c2r=255//red
$c2g=255//green
$c2b=255//blue
//text is red
$c1r=255//red
$c1g=0//green
$c1b=0//blue
$string "Offline Check Back Soon!"//Offline text
//end else if for checking

//Border color is greenish
$c3r=0//red
$c3g=128//green
$c3b=0//blue

$pic=ImageCreate($width,$height); //create the image
$col1=ImageColorAllocate($pic,$c1r,$c1g,$c1b); //text
$col2=ImageColorAllocate($pic,$c2r,$c2g,$c2b); //background
$col3=ImageColorAllocate($pic,$c3r,$c3g,$c3b); //border
ImageFilledRectangle($pic00$width20$col3); //create rectangle
ImageFilledRectangle($pic11$width-218$col2); //Create teh rectangle for the text and stuff
ImageString($pic352$string$col1); //this is text
ImagePNG($pic); //show image
ImageDestroy($pic); //desolate it
?>


Next open your .htaccess file and in there put:

Code

RewriteEngine on
RewriteRule ^stats.png$ img.php


That should work for a demo you can see:
ShadowMage
Author:
Views:
3628
Rating:
There are currently no comments for this tutorial.