Help - Search - Members - Calendar
Full Version: How to make a dynamic signature (IP sig)
MSFN Forums > Customizing Windows and Graphics > Graphics and Designing Art > Signatures
Pages: 1, 2

   
Google Internet Forums Unattended CD/DVD Guide
gamehead200
For this tutorial, the server you will be using MUST have Apache and the GD plugin for PHP installed. You must have some experience using PHP. We will start by opening Notepad (or your favourite text editor) and creating a new file called .htaccess. The name of the signature we will be using will be mysig.jpg.

In the .htaccess file, put the following:

CODE
<Files mysig.jpg>
ForceType application/x-httpd-php
</Files>


This will tell the server to parse the mysig.jpg file as a PHP file. Save this file in a folder where you will also place the other files.

Now, open your text editor and create your signature file, mysig.jpg. Put the following in it:

CODE
<?php
Header ('Content-type: image/jpeg');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');

// set the dimensions
$img_width = 240;
$img_height = 25;

// create the image
$image = imagecreate($img_width, $img_height);

// set the colours
$cool  = imagecolorallocate($image, 81, 86, 96);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red   = imagecolorallocate($image, 255, 0, 0);
$grey  = imagecolorallocate($image, 204, 204, 204);
$green = imagecolorallocate($image, 206, 129, 18);
$blue  = imagecolorallocate($image, 0, 0, 255);

// set the background colour
// number or is top left pixel x, top left pixel y, bottom right pixel x, bottom right pixel y
imagefilledrectangle($image, 0, 0, $img_width, $img_height, $cool);

// set the font and print text
$font = '/path/to/your/ttf/font/verdana.ttf';

// now i will create a line with font size 8, with no angle, 10 pixels to the right, and 17 pixels down
ImageTTFText ($image, 8, 0, 10, 17, $white, $font, "Your IP Address is... ".$REMOTE_ADDR);

// the above will display your IP address

// output and destroy
imagepng($image);
imagedestroy($image);

?>


If you don't want the server to create the image for you, you can always create an image in Photoshop and use it as your background.

CODE
<?php
Header ('Content-type: image/jpeg');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');

// create the image using your own background
$image = imagecreatefromjpeg("background.jpg");

// dimensions of the image used
$img_width = 240;
$img_height = 25;

// set the colours
$cool  = imagecolorallocate($image, 81, 86, 96);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red   = imagecolorallocate($image, 255, 0, 0);
$grey  = imagecolorallocate($image, 204, 204, 204);
$green = imagecolorallocate($image, 206, 129, 18);
$blue  = imagecolorallocate($image, 0, 0, 255);

// set the font and print text
$font = '/path/to/your/ttf/font/verdana.ttf';

// now i will create a line with font size 8, with no angle, 10 pixels to the right, and 17 pixels down
ImageTTFText ($image, 8, 0, 10, 17, $white, $font, "Your IP Address is... ".$REMOTE_ADDR);

// the above will display your IP address

// output and destroy
imagepng($image);
imagedestroy($image);

?>


Those are the basics. You can do so much with PHP!

Want to use a hit counter for your sig? Use this piecee of code in your signature:

CODE
// counter - CHMOD your counter file to 777
$viewss = file("/path/to/your/counter/file/views.txt");
$views = $viewss[0]; $views++;
$fp = fopen("/path/to/your/counter/file/views.txt", "w");
fwrite($fp, $views);
fclose($fp);
$counter = "$views people viewed this since 11/5/03!";


Want a different message to appear everytime your sig is loaded? Use this in your code:

CODE
// set quote file
$quotes = file('quotes.txt');
$quote = array_rand($quotes);

$joke = wordwrap($quotes[$quote], 60, "\n", 1);
$joke = explode("\n", $joke);

// this part goes where the rest of the output is done
for($i=0; $i<count($joke); $i++) {
ImageTTFText ($image, 8, 0, 14, (23+($i*15)), $white, $font, $joke[$i]);
}


Want to output someone's browser, IP, and resolved IP? Use this in your code:

CODE
// get IP and resolve IP
$ip = $REMOTE_ADDR;
$resolved = gethostbyaddr ($REMOTE_ADDR);

// check for non resolve of IP and rip domain if resolved
if ($resolved == $ip) {
$isp = ".. Can't Resolve IP";
}
else
{
$str = preg_split("/\./", $resolved);
$i = count($str);
$x = $i - 1;
$n = $i - 2;
$isp = $str[$n] . "." . $str[$x];
}

// Simple OS Detection
$os = $HTTP_USER_AGENT;
$oslist = Array (

// Windows
"Win|Windows",
"Win16|Windows",
"Win95|Windows 95",
"Win98|Windows 98",
"WinME|Windows ME",
"Win32|Windows",
"WinNT|Windows NT",
"Windows 3.1|Windows 3.1",
"Windows 95|Windows 95",
"Windows CE|Windows CE",
"Windows 98|Windows 98",
"Windows ME|Windows ME",
"Windows NT|Windows NT",
"Windows NT 5.0|Windows 2000",
"Windows NT 5.1|Windows XP",

// Macintosh
"Mac_68000|MacOS m68K",
"Mac_68K|MacOS m68K",
"Mac_PowerPC|MacOS PPC",
"Mac_PPC|MacOS PPC",
"Macintosh|MacOS",

// Unices
"X11|UNIX",
"BSD|BSD",
"SunOS|SunOS",
"IRIX|IRIX",
"HP-UX|HP-UX",
"AIX|AIX",
"QNX|QNX",
"SCO_SV|SCO UNIX",
"FreeBSD|FreeBSD",
"NetBSD|NetBSD",

// Linux
"Linux|Linux",
"Debian|Debian GNU/Linux",

// Other
"BeOS|BeOS",
"OS/2|OS/2",
"AmigaOS|AmigaOS",

);

foreach ($oslist as $osnow) {
$osnow = explode ("|", $osnow);
if (eregi ($osnow[0], $os)) {
$endos = $osnow[1];
$check = "No";
} elseif ($check != "No") {
$endos = "Unknown";
}
}

/*
to output the OS, use $endos
to output the IP, use $ip
to output the resolved IP, use $resolved
*/


Want to output someone's browser? Use this code:

CODE
//browser type
  $agent = $HTTP_USER_AGENT;
  if ( strstr($agent, "MSIE 5") ) $browser = "using IE 5";
  elseif ( strstr($agent, "MSIE 6") ) $browser = "using IE 6";
  elseif ( strstr($agent, "MSIE 4") ) $browser = "using IE 4";
  elseif ( strstr($agent, "Firebird") ) $browser = "using Firebird";
  elseif ( strstr($agent, "Safari") ) $browser = "using Safari";
  elseif ( strstr($agent, "Mozilla/5") ) $browser = "using Mozilla/Netscape 5";
  elseif ( strstr($agent, "Mozilla/6") ) $browser = "using Netscape 6";
  elseif ( strstr($agent, "Mozilla/4") ) $browser = "using Netscape 4";
  elseif ( strstr($agent, "Opera") ) $browser = "using Opera";
  else $browser = "";

// to output the browser, use $browser


Want to use a different background everytime? Use this code:

CODE
// random background

$random_image = array("",
                  "bg1.jpg",
                  "bg2.jpg",
                  "bg3.jpg",
                  "bg4.jpg");

srand ((double) microtime() * 1000000);
$rnd = rand(1,4);

// create the image
$image = imagecreatefromjpeg($random_image[$rnd]);


Good luck to all coders! Any comments, suggestions, and questions are appreciated! smile.gif

thumbup.gif

NOTE: I have attached a sample mysig.jpg and .htaccess file.
XPerties
And if anyone makes any and would like to join Bob's family located here http://www.whatismy.net I'll add them to the site and list them on the forums here http://www.whatismy.net/forums/viewtopic.php?t=2 with full credit to you of course.
gamehead200
Believe it or not, Bob and his friends were made with pretty much everything on this page. Even Jeremy, the guy in my sig. smile.gif Right, Chris?
XPerties
Yes Yes Yes oh might master, gamehead200. I learned form you and you are the original master of Bob and his entire family.
Cyberpawz
Ok, first attempt, and so far no go.

The .htaccess file is inside the Signature folder, the file as you can tell is named mysig.jpg

Now I have GD plugin and the latest apache... I know this because I use GD for another part of my website... and it works perfectly...

http://www.cyberpawz.com/signature/mysig.jpg

As you can tell below where I placed the image tags nothing shows up... any help would be appreciated. I changed the font to

$font = '/Volumes/Server/htdocs/Signature/Caleu.ttf';

Now don't forget I'm on a Mac, but as far as I can tell if I put the font in the same folder as the signature is in, and just cut that down to:

$font = /Caleu.tiff

Wouldn't that work as well, or does the font need to be active in the system?


gamehead200
OK, when I opened up the link in IE, I realized that all of your code was showing. The server is not parsing the file as a PHP file either because there's a configuration problem or because you did not put the .htaccess file.

If you go into your terminal and ls the Signature folder, what files show up? confused.gif

Most of the time, it doesn't matter how you tell the server where your font file is... But, its usually better to include the whole path... smile.gif

BTW, open up your mysig.jpg file and make sure you save it as just Text. You have random letters with accents everywhere...

Example:
CODE
$blue Ę= imagecolorallocate($image, 0, 0, 255);


Try using the sample files I just uploaded. smile.gif
Cyberpawz
QUOTE (gamehead200 @ Jun 4 2005, 04:57 PM)
OK, when I opened up the link in IE, I realized that all of your code was showing.  The server is not parsing the file as a PHP file either because there's a configuration problem or because you did not put the .htaccess file.

If you go into your terminal and ls the Signature folder, what files show up? confused.gif

Most of the time, it doesn't matter how you tell the server where your font file is... But, its usually better to include the whole path... smile.gif

BTW, open up your mysig.jpg file and make sure you save it as just Text.  You have random letters with accents everywhere...

Example:
CODE
$blue Ę= imagecolorallocate($image, 0, 0, 255);


Try using the sample files I just uploaded. smile.gif
*


I copy and pasted the information above... dang it...

and the .htaccess file is there, I know it is cause I can edit it...

I'll try again.
Cyberpawz
Still not working, hell if I know what is going on. I am using 10.4 for the Mac OS, when I save this I'm using BBEdit Light...

Unless bbedit light 6.1.2 is the reason for the bad code I'm clueless...

And for the record if I go through the terminal and look at the folder's innards... everything is there.

At least all that should be.
gamehead200
QUOTE (Cyberpawz @ Jun 4 2005, 07:09 PM)
Still not working, hell if I know what is going on.  I am using 10.4 for the Mac OS, when I save this I'm using BBEdit Light...

Unless bbedit light 6.1.2 is the reason for the bad code I'm clueless...

And for the record if I go through the terminal and look at the folder's innards... everything is there.

At least all that should be.
*


OK... Do the following:

Create a PHP file called phpinfo.php and put the following code in it:

CODE
<?php phpinfo(); ?>


Then post the link to this PHP file so I can take a look at what it outputs. smile.gif
Cyberpawz
QUOTE (gamehead200 @ Jun 4 2005, 07:56 PM)
QUOTE (Cyberpawz @ Jun 4 2005, 07:09 PM)
Still not working, hell if I know what is going on.  I am using 10.4 for the Mac OS, when I save this I'm using BBEdit Light...

Unless bbedit light 6.1.2 is the reason for the bad code I'm clueless...

And for the record if I go through the terminal and look at the folder's innards... everything is there.

At least all that should be.
*


OK... Do the following:

Create a PHP file called phpinfo.php and put the following code in it:

CODE
<?php phpinfo(); ?>


Then post the link to this PHP file so I can take a look at what it outputs. smile.gif
*




already had it... www.cyberpawz.com/test.php
gamehead200
QUOTE (Cyberpawz @ Jun 4 2005, 08:36 PM)
already had it... www.cyberpawz.com/test.php
*


I don't see anything wrong with your configuration... Try getting rid of those weird characters in your code... wacko.gif
Cyberpawz
QUOTE (gamehead200 @ Jun 4 2005, 09:23 PM)
QUOTE (Cyberpawz @ Jun 4 2005, 08:36 PM)
already had it... www.cyberpawz.com/test.php
*


I don't see anything wrong with your configuration... Try getting rid of those weird characters in your code... wacko.gif
*



The issue is that what I am working on the code on the computer, there are no errors... it's after it's saved... which I don't understand how since I am saving it as a generic text format...

I'm lost, and somewhat confused on what this is happening at all...

This is what I see when I edit and save it as a pure txt format...

gamehead200
No wonder its not working! You should have your font file set as:

CODE
$font = '/Volumes/Server/htdocs/Signature/Caleu.ttf';


And not:

CODE
/Volumes/Server/htdocs/Signature/Caleu.ttf
Cyberpawz
QUOTE (gamehead200 @ Jun 4 2005, 11:01 PM)
No wonder its not working!  You should have your font file set as:

CODE
$font = '/Volumes/Server/htdocs/Signature/Caleu.ttf';


And not:

CODE
/Volumes/Server/htdocs/Signature/Caleu.ttf

*



Dang I thought I fixed that... hmm let me try something...
Cyberpawz
Ok, no go... and I downloaded the file you had on the first page to see if I made a mistake or no. And so far no go.



This is the code in it:

QUOTE
<?php
Header ('Content-type: image/jpeg');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');

// set the dimensions
$img_width = 240;
$img_height = 25;

// create the image
$image = imagecreate($img_width, $img_height);

// set the colours
$cool  = imagecolorallocate($image, 81, 86, 96);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red   = imagecolorallocate($image, 255, 0, 0);
$grey  = imagecolorallocate($image, 204, 204, 204);
$green = imagecolorallocate($image, 206, 129, 18);
$blue  = imagecolorallocate($image, 0, 0, 255);

// set the background colour
// number or is top left pixel x, top left pixel y, bottom right pixel x, bottom right pixel y
imagefilledrectangle($image, 0, 0, $img_width, $img_height, $cool);

// set the font and print text
$font = '/Volumes/Server/htdocs/Signature/TAGSXTREME.TTF';

// now i will create a line with font size 8, with no angle, 10 pixels to the right, and 17 pixels down
ImageTTFText ($image, 8, 0, 10, 17, $white, $font, "Your IP Address is... ".$REMOTE_ADDR);

// the above will display your IP address

// output and destroy
imagepng($image);
imagedestroy($image);

?>
gamehead200
OK, I want you to try two more things...

First, put this in:

CODE
// get IP
$ip = $_SERVER['REMOTE_ADDR'];

$text = "Your IP address is $ip!";

// replace this part
ImageTTFText ($image, 8, 0, 10, 17, $white, $font, $text);


If that doesn't work, change your font to just the font name.

Example:

CODE
$font = 'verdana.ttf';


If that doesn't work, well, I really don't know what will... wacko.gif
Cyberpawz
QUOTE (gamehead200 @ Jun 5 2005, 12:06 AM)
OK, I want you to try two more things...

First, put this in:

CODE
// get IP
$ip = $_SERVER['REMOTE_ADDR'];

$text = "Your IP address is $ip!";

// replace this part
ImageTTFText ($image, 8, 0, 10, 17, $white, $font, $text);


If that doesn't work, change your font to just the font name. 

Example:

CODE
$font = 'verdana.ttf';


If that doesn't work, well, I really don't know what will... wacko.gif
*



Should it look like this?

QUOTE
<?php
Header('Content-type: image/jpeg');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');

// set the dimensions
$img_width = 240;
$img_height = 25;

// create the image
$image = imagecreate($img_width, $img_height);

// set the background colour
// number or is top left pixel x, top left pixel y, bottom right pixel x, bottom right pixel y
imagefilledrectangle($image, 0, 0, $img_width, $img_height, $cool);

// set the font and print text
$font = TAGSXTREME.TTF;

// get IP
$ip = $_SERVER['REMOTE_ADDR'];

$text = "Your IP address is $ip!";

// replace this part
ImageTTFText ($image, 8, 0, 10, 17, $white, $font, $text);

// the above will display your IP address


// set the colours
$cool  = imagecolorallocate($image, 81, 86, 96);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red  = imagecolorallocate($image, 255, 0, 0);
$grey  = imagecolorallocate($image, 204, 204, 204);
$green = imagecolorallocate($image, 206, 129, 18);
$blue  = imagecolorallocate($image, 0, 0, 255);


// output and destroy
imagepng($image);
imagedestroy($image);

?>
gamehead200
QUOTE (Cyberpawz @ Jun 5 2005, 12:11 AM)
Should it look like this?

QUOTE
<?php
Header('Content-type: image/jpeg');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');

// set the dimensions
$img_width = 240;
$img_height = 25;

// create the image
$image = imagecreate($img_width, $img_height);

// set the background colour
// number or is top left pixel x, top left pixel y, bottom right pixel x, bottom right pixel y
imagefilledrectangle($image, 0, 0, $img_width, $img_height, $cool);

// set the font and print text
$font = TAGSXTREME.TTF;

// get IP
$ip = $_SERVER['REMOTE_ADDR'];

$text = "Your IP address is $ip!";

// replace this part
ImageTTFText ($image, 8, 0, 10, 17, $white, $font, $text);

// the above will display your IP address


// set the colours
$cool  = imagecolorallocate($image, 81, 86, 96);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red  = imagecolorallocate($image, 255, 0, 0);
$grey  = imagecolorallocate($image, 204, 204, 204);
$green = imagecolorallocate($image, 206, 129, 18);
$blue  = imagecolorallocate($image, 0, 0, 255);


// output and destroy
imagepng($image);
imagedestroy($image);

?>

*




Just move the following up to before it says "set background colour":

CODE
// set the colours
$cool  = imagecolorallocate($image, 81, 86, 96);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red  = imagecolorallocate($image, 255, 0, 0);
$grey  = imagecolorallocate($image, 204, 204, 204);
$green = imagecolorallocate($image, 206, 129, 18);
$blue  = imagecolorallocate($image, 0, 0, 255);
Cyberpawz
Still no go... can you try the code itself, so to see if it actually works?

I'm getting frustrated here, and there should be no reason why this isn't working...
gamehead200
QUOTE (Cyberpawz @ Jun 5 2005, 12:16 AM)
Still no go... can you try the code itself, so to see if it actually works?

I'm getting frustrated here, and there should be no reason why this isn't working...
*


The code is working fine on my machine... I will even start my Mac's webserver to see if its a Mac problem... BRB...
XPerties
If I might add, the server you are on has register_globals=off which might be causing an issue. It did for a few clients of mine. Here is a walk around to make sure it isn't....

===================
[1] Within your account in public_html folder or the directory where the script is no longer working you may find a .htaccess. If not you may need to create a .htaccess file.
[2] Open this file up or create it and add:

php_value register_globals 1
===================
Cyberpawz
QUOTE (XPerties @ Jun 5 2005, 08:24 AM)
If I might add, the server you are on has register_globals=off which might be causing an issue. It did for a few clients of mine. Here is a walk around to make sure it isn't....

===================
[1] Within your account in public_html folder or the directory where the script is no longer working you may find a .htaccess. If not you may need to create a .htaccess file.
[2] Open this file up or create it and add:

php_value register_globals 1
===================
*



No go. I just tried this on another site, to post the .jpg as just that, and it's not being parsed right at all...
tj007s13
i made one...

tj007s13
now...u said screen resolution could only be done by incorporating javascript in right? How would i go about doing that?
gamehead200
You can't really put someone's resolution in a signature without having them go to another site to store it in a cookie. smile.gif
tj007s13
ohhh... darn...
megafan
Hey how do u install the GD plugin? After uploading u'r sample thsi is what I am getting http://govinda.us/sig/mysig.jpg

So i am guessing its because of the GD plugin. Can u help me. THanks
SoKoOLz
I have verys trange problem, when I have created my sig. It works perfectly on my test server(with Appserv installed). But when I put it on my host, it the forced me to download the image instead of showing the image. With an error inside saying that
"<b>Fatal error</b>: Call to undefined function: imagettftext() in <b>/usr/local/xxx/home/vhosts/xxx.com/httpdocs/sig/test.jpg</b> on line <b>133</b><br />"
theodonnells

I tried this tutorial but cant get it to work....
When i used the zip files all i got was a red x where pic should be,so tried with my own graphic but no joy.....
My sig
Heres my code,
CODE
<?php
Header ('Content-type: image/jpeg');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');

// create the image using your own background
$image = imagecreatefromjpeg("background.jpg");

// dimensions of the image used
$img_width = 380;
$img_height = 50;

// set the colours
$cool  = imagecolorallocate($image, 81, 86, 96);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$red   = imagecolorallocate($image, 255, 0, 0);
$grey  = imagecolorallocate($image, 204, 204, 204);
$green = imagecolorallocate($image, 206, 129, 18);
$blue  = imagecolorallocate($image, 0, 0, 255);

// set the font and print text
$font = 'verdana.ttf';

// now i will create a line with font size 8, with no angle, 10 pixels to the right, and 17 pixels down
ImageTTFText ($image, 8, 0, 10, 17, $white, $font, "Your IP Address is... ".$REMOTE_ADDR);

// the above will display your IP address

// output and destroy
imagepng($image);
imagedestroy($image);

?>

Do you just upload the fonts from your windows fonts folder?
SuperBleeder
QUOTE (theodonnells @ Aug 31 2005, 09:16 AM)

I tried this tutorial but cant get it to work....
When i used the zip files all i got was a red x where pic should be,so tried with my own graphic but no joy.....
My sig
Heres my code,
[code here]
Do you just upload the fonts from your windows fonts folder?
*

The erroryou are getting now I used to get until I setup .htaccess correctly tongue.gif

Pretty simple to do when you have it setup right (I killed my host setting up GD2 not knowing I already had it installed laugh.gif )

http://www.psychoman.co.nr/test/mysig.png

newwink.giftongue.gif
Brazen1
This is great, a fantastic starting off script for anyone interested in learning php, like me, thanks for posting it biggrin.gif
Ive been learning php and mysql for a few months now and altho they say its easy its pretty comprehensive to say the least, php.net proves that!

Would it be possible to add another couple of lines to this code so it could show other stuff? what would be the code to use to display the uptime of my pc/cpu?
also id like to be able to incorporate other things into it like what youre currently playing in winamp by using something like AMIP dynamic sig.

i think you need to play around with the function calc_uptime() as ive been using ampsig.com's ampsig. http://ampsig.com and its all in the code.

ive been playing around with some various scripts over the last few days as, ultimately what id like to create is one mutiple stat'd sig.
heres my attempt at using the code from here > [multisig] - A work in progress LOL
Id like to be able to merge it with something like this: [AMIP_sig]
[Here] is the sigamp sig by the way.
I like it and all and you can use your own images and totally tweek it but for some parts it needs a MYSQL table and i want to try and keep it as simple as possible.

well thanks for any insite anyone thumbup.gif

Brazen1
Bas
QUOTE (Brazen1 @ Nov 1 2005, 10:32 PM) *
heres my attempt at using the code from here > [multisig] - A work in progress LOL

Firefox not detected
change
CODE
elseif ( strstr($agent, "Firebird") ) $browser = "using Firebird";

to this
CODE
elseif ( strstr($agent, "Firefox") ) $browser = "using Firefox";
Mamoun
Hii
How can I put a script in my dynamic signature, like a script to get a number from an asp page, for example this one.
tj007s13
is there a different way to get the ISP besides gethostaddr? I get some IP4 and IP6 error if i use the gethostaddr command...???
Martijn
I would like my sig to output the browser and OS but I don't understand how to put this code in my sig, it is working but where do I add for instance $endos ?

Edit:
Btw, for those who might have problems with the signature, a admin of my hosting fixed my .htaccess file for me:
CODE
#<Files mysig.jpg>
#ForceType application/x-httpd-php
#</Files>
#These lines should have caused the error.

AddHandler application/x-httpd-php .jpg

Edit2: found out how to add $endos
CODE
// now i will create a line with font size 8, with no angle, 10 pixels to the right, and 17 pixels down
ImageTTFText ($image, 8, 0, 10, 17, $white, $font,"Your IP Address is ".$REMOTE_ADDR. " and you are using ".$endos);

I would like to know how I can break lines, like you do with the html tag <br />, but that doesn't work...
gamehead200
QUOTE (Martijn @ Dec 17 2005, 02:04 PM) *
I would like my sig to output the browser and OS but I don't understand how to put this code in my sig, it is working but where do I add for instance $endos ?

Edit:
Btw, for those who might have problems with the signature, a admin of my hosting fixed my .htaccess file for me:
CODE
#<Files mysig.jpg>
#ForceType application/x-httpd-php
#</Files>
#These lines should have caused the error.

AddHandler application/x-httpd-php .jpg

Edit2: found out how to add $endos
CODE
// now i will create a line with font size 8, with no angle, 10 pixels to the right, and 17 pixels down
ImageTTFText ($image, 8, 0, 10, 17, $white, $font,"Your IP Address is ".$REMOTE_ADDR. " and you are using ".$endos);

I would like to know how I can break lines, like you do with the html tag <br />, but that doesn't work...


It might be a bit late for an answer, but you can put in a line break by adding this to your text within the quotation marks: \n

If anyone is still interested in this type of signature, view mine below, and any and all questions will be answered to fit everyone's needs. biggrin.gif
gamehead200
Anyone ever wanted to add their computer's online status to their sig using Hamachi? Here's my way of doing it:

First off, install the beta version of Hamachi (v1.0.0.0 or whatever), and make sure that you set the following as shown:

Click to view attachment

Now, you need to put in the following in your GD image's code in order for it to work:

CODE
<?php

Header('Content-type: image/png');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
Header('Pragma: no-cache');

// create the image
$image = imagecreatefrompng("signew.png");  // my background image

// hamachi online status
$fileget = file_get_contents("http://my.hamachi.cc/status/text.php?5.x.x.x");  // replace 5.x.x.x with your hamachi ip

if( preg_match( "/online/i", $fileget ) ) {
    $status = imagecreatefrompng("online.png");
}elseif( preg_match( "/offline/i", $fileget ) ) {
    $status = imagecreatefrompng("offline.png");
}else{
    $status = imagecreatefrompng("unknown.png");
}

$status_x = imagesx($status);
$status_y = imagesy($status);

// put it all together

// starting out with the status
imagecopymerge($image, $status, 287, 3, 0, 0, $status_x, $status_y,100);

// and the text
/////////////// i dont have any in my sig

// output and destroy
imagepng($image);
imagedestroy($image);
imagedestroy($status);

?>

That's all there is to it! The end result is something that looks like what's in my sig, in the top right-hand corner! biggrin.gif The required images are attached!

For a list of all your computers' Hamachi online statuses, refer to this: http://www.astromike.com/scripts/hamachistatus/

biggrin.gif
tain
Nice. Thanks for posting this info thumbup.gif
gamehead200
No problem. Hopefully it works as expected. I was in a rush when writing that down. tongue.gif
tain
Yup, it works! I am changing the code around a bit and playing with some other ideas. Thanks!
RexxCrow
I was hoping I could get some guidance with issues I am having working this out, I have been through about 1/2 a dozen tutorials on how to do this and have been unable to get one to work at all, I believe I am having an issue with the .htaccess file, I keep getting a HTTP error 500, whatever this is, when I remove the htaccess file I can view other files in that directory though while it is there only this error displays.

I tried using the file that was uploaded to this site on the first page of this thread, with no luck I also tried using it with just the "AddHandler application/x-httpd-php .jpg", still same problem either way. I use an IPOWER WinPro for my web server, though do not know if they have GL installed, I did upload the verada.ttf though.

All I am really wanting to do is have a line of text display in either white or lime green stating "Total Players Currently Online: " and then merging this with a number from another file that will be updated every so many minutes i.e. 12. This will then be displayed in a Administrator's sig for a gaming website and support forums. I have had no luck with this as of yet, any ideas or suggestions would be great, thank you for your time.


UPDATE: I just got of the phone with tech support and they advised their Windows servers do not use Apache they use IIS (?), so is there an alternative for this function or do I need to downgrade my service to their Linux servers that use Apache?
MGadAllah
But for a one PC stand a lone, can I make it? confused.gif
gamehead200
QUOTE (RexxCrow @ Nov 18 2006, 03:05 AM) *
UPDATE: I just got of the phone with tech support and they advised their Windows servers do not use Apache they use IIS (?), so is there an alternative for this function or do I need to downgrade my service to their Linux servers that use Apache?


Probably, but I have no knowledge of it. Downgrading service to Linux? Everyone out there knows that Linux is way more secure than Windows when it comes to hosting a website. You should be upgrading to Linux.

@ MGadAllah: Yes, you can. Search the network forum on how to setup an account at DynDNS.org or a similar service. (Dynamic IP Service)
RexxCrow
Sorry, that is just actually sort of funny you MOD for these MS forums and yet you trash Windwos, laff. As well sorry, though I am coming here for help not to debate Win vs. Lin. Although, I will say that there is a reason Linux is more secure then Windwos, which I am sure you are aware of those reasons. By downgrading my service I meant the WinPro package offers much more then the latter Linux packages, Bandwidth, accessibility, storage size, plugins, email accounts, etc.

Personally, I hate Windwos, and I hate BG and everything that spoon feeder is about, but I use his software because, well BG has successfully monopolized the entire computer industry, sure program such as Linux and BartPE are nice alternatives, though they do not permit the necessary foundation to enable the full abilities that most software was built upon specifically for well, you know.
RexxCrow
Alright, after tweeking the examples in this thread this is what I have come up to hopefully work with my application, I am making this for an Admin for a site that I believe does use Apache, I just won’t be able to test anything myself, if I have errors in this code please advise me of them, if anybody is willing to do so. I may not have understood everything fully, as this is the first time that I have actually played around with PHP code.

I am planning on setting these files in directory labeled: POAN, server side; this directory will also contain an HTML file that is used by the script I am trying to make this sig for. I have included these files to help paint the picture and limit any confusion. This is to work by having a script create the POAN.HTML and PC.txt files those are then FTP'ed to the server, the POAN.HTML will be accessed by players and the PC.txt is just for the sig, these files will be updated at a set period of time by the admin. the sig will then be linked to by the games support site and the Admins own site, etc. This is for an old online door game known as TradeWars 2002 now TradeWars 2002/TWGS, the script is for a helper called TWXProxy that allows users to make scripts to automate game play for them. This project I am working on though is more admin related, though to the players benefit. Thanks again for any assistance.


An example of the code used by TWXProxy to create the needed file for PC.TXT locally on the admins computer prior to FTPing to their website (these are excerpts from the file, as they are actually written throughout the file in various functions.)
CODE
# sets up the file path and name to be used:
setVar $sigPath $POANPath & "PC.TXT"

# if no users are online:
setVar $sig "None"

# else $X is the number of users online.
setVar $sig $X

# checks for the old file, removes it and writes a new one PC.TXT:
fileExists $fc $sigPath
IF $fc
DELETE $sigPath
END
WRITE $sigPath $sig


POAN.HTML
[displays the game and player information via website]

PC.TXT
[contains the number of players currently online, so this would just contain a number i.e. 10 (I put a little function at the bottom of the Sig.JPG file, which I modified from the random quote code, to read from this file so not sure if I have this correct? Also, does the CHMOD setting for this file matter to make this work?)]

verdana.ttf
[obvious]

.htaccess file:
CODE
AddHandler application/x-httpd-php .JPG

Sig.JPG file:
CODE
<?php
Header('Content-type: image/jpeg');
Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
Header('Pragma: no-cache');

// set the dimensions
$img_width = 200;
$img_height = 25;

// create the image
$image = imagecreate($img_width, $img_height);

// set the colours
$cool  = imagecolorallocate($image, 81, 86, 96);
$green = imagecolorallocate($image, 0, 255, 0);

// set the background colour
// number or is top left pixel x, top left pixel y, bottom right pixel x, bottom right pixel y
imagefilledrectangle($image, 0, 0, $img_width, $img_height, $cool);

// set the font and print text
$font = 'verdana.ttf';

// reading from the Player Count text file to obtain the number of players currently online.
// Still need to change CHMOD to 777 also?
$count = file('PC.txt');

// now i will create a line with font size 10, with no angle, 10 pixels to the right, and 15 pixels down
ImageTTFText ($image, 10, 0, 10, 17, $green, $font, "Total Players Currently Online: ".$count);

// output and destroy
imagepng($image);
imagedestroy($image);
?>


This is the basic result I am hoping for (except in lime green):

Total Players Currently Online: 10



As and alterative option how would you make the number a different color? just put a defined color $ as:

$white=imagecolorallocate($image, 255, 255, 255);
ImageTTFText ($image, 10, 0, 10, 17, $green, $font, "Total Players Currently Online: ".$white.$count);
RexxCrow
Okey dokey lil’ smokies, ya'll discard my prior posts in this here thread, my issues seem to be resolved, (in another forum, BTW.) Posting if anybody else needs to know. As getting assistance here is apparently like pulling teeth.


[ QUOTE ]
CODE
ImageTTFText ($image, 10, 0, 10, 17, $green, $font, "Place Text Here: ");
ImageTTFText ($image, 10, 0, *, 17, $PlaceNewColorCodeVarHere, $font, $PlaceVarNameHere);
// Replace the * with the number of pixels between the left side of the image and the start of the number.
[ /QUOTE ]

[ INSERT SARCASM ] Again, thanks you all for your wonderful help and attitudez onboard this here MSFN board, outstanding work guyz, ya'll r just sooo l33t! w00t! w00t! U go boyz! laff … These forums are actually eerily similar to calling MS tech support, lolol, newayz I am so outtie, kthxbye [ /INSERT SARCASM ] welcome.gif
gamehead200
QUOTE (RexxCrow @ Nov 21 2006, 04:31 PM) *
Okey dokey lil’ smokies, ya'll discard my prior posts in this here thread, my issues seem to be resolved, (in another forum, BTW.) Posting if anybody else needs to know. As getting assistance here is apparently like pulling teeth.


[ QUOTE ]
CODE
ImageTTFText ($image, 10, 0, 10, 17, $green, $font, "Place Text Here: ");
ImageTTFText ($image, 10, 0, *, 17, $PlaceNewColorCodeVarHere, $font, $PlaceVarNameHere);
// Replace the * with the number of pixels between the left side of the image and the start of the number.
[ /QUOTE ]

[ INSERT SARCASM ] Again, thanks you all for your wonderful help and attitudez onboard this here MSFN board, outstanding work guyz, ya'll r just sooo l33t! w00t! w00t! U go boyz! laff … These forums are actually eerily similar to calling MS tech support, lolol, newayz I am so outtie, kthxbye [ /INSERT SARCASM ] welcome.gif

I hope you realize we all have lives away from this board and more than half our time is spent AWAY from MSFN. I am currently still in school and don't have much time to reply to or even discuss stuff like this on a daily basis; I just don't have the time to go through every single post and make sure that every single little thing is taken care of during every single second of every day; that's why we have more than one moderator.

Your sarcasm is not welcome here if that's the way you're going to be. And you shouldn't be saying something such as "OMFG!!! A MOD DISSING WINDOZE!!" either because we all have our personal opinions regarding technology. It's not too surprising in my opinion to see someone saying something of that sort, and I'm sure my fellow colleagues would agree with me.

In either case, I'm glad you resolved your problem, but behaviour of that sort (sarcasm towards others) will not be tolerated here. Seeing as you are a new member here, I suggest you take another good read at the rules located beneath the MSFN logo before continuing to post. Something you might have missed:
QUOTE
7.b This community is built upon mutual respect. You are not allowed to flame other members. People who do not respect personal opinions and/or personal work will be warned in first instance. If you ignore the warning and keep on flaming, you will be banned without notice.

If you feel the need to reply to this small bit of information, please feel free to PM me. Do NOT, under any cirumstances, reply to this post in this thread.
RevRaz
This is a great topic and I thank you for sharing it.

I have it working as intended, but I want to make it more dynamice and change some of the Text in the Image when I read a XML file.

Any chance I can post my code (that isn't working) and have some see if they can spot my error?
gamehead200
QUOTE (RevRaz @ Dec 4 2006, 04:48 PM) *
This is a great topic and I thank you for sharing it.

I have it working as intended, but I want to make it more dynamice and change some of the Text in the Image when I read a XML file.

Any chance I can post my code (that isn't working) and have some see if they can spot my error?


Go right ahead. I'll try to look at it when I get back home later tonight or tomorrow when I have a chance. smile.gif
RevRaz
Thanks for the reply, I think I have it worked out.

For some reason, when I was moving the XML data into a variable to be used, some of the data that was passed was blank (not sure why). So when I tried to use that Variable, it would not display anything and I assumed it wasn't working.

When I decided to try using an ARRAY instead, then I noticed every other array field was blank, so data was only in 0, 2, 4 & 6. I'm still not sure why, but at least it's working.

QUOTE (gamehead200 @ Dec 4 2006, 02:50 PM) *
QUOTE (RevRaz @ Dec 4 2006, 04:48 PM) *

This is a great topic and I thank you for sharing it.

I have it working as intended, but I want to make it more dynamice and change some of the Text in the Image when I read a XML file.

Any chance I can post my code (that isn't working) and have some see if they can spot my error?


Go right ahead. I'll try to look at it when I get back home later tonight or tomorrow when I have a chance. smile.gif
Google Internet Forums Unattended CD/DVD Guide
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.