Some PHP Help fora dynamic sig

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
Ok so im trying to create a dynamic sig ihn PHP to check the server Ports and stuff but when I run it I get nothing...its on my local pc right now.

I have the following code to check for the port to be up or down:

PHP:
ini_set('display_errors','0'); 

         $fp = fsockopen(64.92.165.74, 80,$errno,$errstr, 4);
         if (!$fp){
             $data = $background,10,0,91,63,$red,"arial.ttf","Down";
         } else {
             $data = $background,10,0,91,63,$green,"arial.ttf","UP";
         }
         return $data;
fclose($fp);

imagettftext($data);

Do you see anything wrong with this...as if I delete this it works fine with the normal stuff.
 
Last edited:

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Either post or PM me the rest of the script and I'll check it out for you. I'd need to see the rest to fix the lines that put the "status text" on the image.
 
Last edited:

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
Here is all of it

PHP:
<?php
header("Content-type: image/png");
$background = imagecreatefrompng("back.png");
$green = imagecolorallocate($background, 65, 134, 57);
$red = imagecolorallocate($background, 171, 20, 20);

// Server IP
imagettftext($background,10,0,92,63,$green,"arial.ttf","64.92.165.74");
//Server IP


ini_set('display_errors','0'); 

         $fp = fsockopen(64.92.165.74, 80,$errno,$errstr, 4);
         if (!$fp){
             $data = $background,10,0,91,63,$red,"arial.ttf","Down";
         } else {
             $data = $background,10,0,91,63,$green,"arial.ttf","UP";
            
         }
         return $data;
 fclose($fp);

imagettftext($data);


imagepng($background);
imagedestroy($background);

?>

The like DNS: and everything like that is there on the image built in....i just have to copy that status code and change the positon and port i think if I can get that to work.
 
Last edited:

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
Bryon said:
Where is the "back.png" image?

Ill PM it to you....hold on i dnt want that going out.
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
PHP:
<?php
   ini_set('display_errors','0'); 

   header("Content-type: image/png");
   $background = imagecreatefrompng('back.png');
   $green = imagecolorallocate($background, 65, 134, 57);
   $red = imagecolorallocate($background, 171, 20, 20);

   imagettftext($background, 12, 0, 95, 65, $green, 'arial.ttf', '64.92.165.74');

   // HTTP Only
   $fp = @fsockopen('64.92.165.74', 80, $errno, $errstr, 4);
   if (!$fp){
      $data = 'Down';
      $color = $red;
   } else {
      $data = 'Online';
      $color = $green;
   }
   @fclose($fp);
   imagettftext($background, 12, 0, 119, 83, $color, 'arial.ttf', $data);


   imagepng($background);
   imagedestroy($background);

?>

Should give you a rough idea of how it should beeee. You may have to adjust the locations of the text.
 
Last edited:

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
Bryon said:
PHP:
<?php
   ini_set('display_errors','0'); 

   header("Content-type: image/png");
   $background = imagecreatefrompng('back.png');
   $green = imagecolorallocate($background, 65, 134, 57);
   $red = imagecolorallocate($background, 171, 20, 20);

   imagettftext($background, 12, 0, 95, 65, $green, 'arial.ttf', '64.92.165.74');

   // HTTP Only
   $fp = @fsockopen('64.92.165.74', 80, $errno, $errstr, 4);
   if (!$fp){
      $data = 'Down';
      $color = $red;
   } else {
      $data = 'Online';
      $color = $green;
   }
   @fclose($fp);
   imagettftext($background, 12, 0, 119, 83, $color, 'arial.ttf', $data);


   imagepng($background);
   imagedestroy($background);

?>
Should give you a rough idea of how it should beeee. You may have to adjust the locations of the text.

Thanks bro REP +..let me try it...
 

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
Re: Some PHP Help for dynamic sig

Ok so here is a 15 min production of my first dynamic sig...the best is yet to come:

server_stats.png


As I beleve ppl should beable to view it...here is the source code:
http://sigs.computer-forums.zealoushost.net/server_stats.myimages

and that image can be located here: http://i57.photobucket.com/albums/g237/blong4life/back.png
 
Last edited:

TarinC

New Member
Messages
698
Reaction score
0
Points
0
Here are some ports:
21 FTP server
25 Exim - SMTP
53 Bind nameserver
80 Apache webserver
110 POP mail server
143 IMAP mail server
443 Secure Apache webserver
465 Secure SMTP
993 Secure IMAP
2082 cPanel
2083 Secure cPanel (https)
2086 WHM
2087 Secure WHM (https)
2095 Webmail
2096 Secure webmail (https)
3306 MySQL
8888 Secure shell - SSHD

You should use php to write the name(http status and stuff).
 
Last edited:

jaint

Member
Messages
174
Reaction score
0
Points
16
are you hosting the background.png remotely? because that's not a good idea, it will slow down your script and cause huge server load if the forum you post in popular.
 

Brandon

Former Senior Account Rep
Community Support
Messages
19,181
Reaction score
28
Points
48
jaint said:
are you hosting the background.png remotely? because that's not a good idea, it will slow down your script and cause huge server load if the forum you post in popular.

Nope...i but the image is blocked off the server so ppl cant hotlink....so I had to put it up there.
 
Top