Misc Links
Forum Archive
News Archive
File DB
 

Ads
 

Advertisement
 

Latest Forum Topics
wow 56 k modems are
Posted by Red Squirrel
on Oct 14 2013, 11:52:23 pm

I Need A Program
Posted by rovingcowboy
on Sep 23 2013, 5:37:59 pm

having trouble witn lan
Posted by rovingcowboy
on Sep 23 2013, 5:40:56 pm

new problem for me
Posted by rovingcowboy
on Sep 23 2013, 5:54:09 pm

RBC Royal Bank
Posted by Red Squirrel
on Aug 13 2013, 6:48:08 pm

 

Dynamic Forum Signatures (version 2)
How showing your IP on an image is done.
By Onykage


Dynamic Signatures (version 2)
Written By: Red Squirrel 05'
Revised By: Onykage 08'

Back in 2005 Red Squirrel did an article giving an outline with some basic examples of how you can show the viewer his/her ip address thats embeded into an image which is your forum signature and it is allowed on any forum.  Infact, this very article is how I found the Iceteks community originally and the reason I kept coming back.

As a brief recap, below is a outline copy of Red's Orignal article.
http://www.iceteks.com/articles.php/textsig/1

  • First, what we want to do is setup a folder where .jpg files will run as php. So make a folder called phpsigs and put this in your .htaccess file:
    ForceType application /x-httpd-php
    That will simply force all files to run in the php parser. You can go into more htaccess stuff to only make certain files be affected and what not, but to keep things simple, we'll just do it to all files. You just have to make sure not to put anything else in this folder. Only the .htaccess file and the fake image file.
  • Secondly, we need to create a fake image file. By fake I simply mean that it's not a real image, but code. Let's call it siggy.jpg and put it in the phpsigs. The actual image that will be displayed as the sig can be stored anywhere, on, or outside of the server. The image has to be png, for the code we will use.
  • You must have the GD library installed on your server for this to work. What we want to do is set up text strings and place them on top of the graphic. Basically, we generate a graphic on the fly. For the main image, we grab the data off a normal image, and we "insert" the text data into it, and then display it.
  • Here is a sample dynamic sig and below is it's code.

    /*
    ** Code example from Iceteks
    */


    01: <?php
    02: 
    03: header("Content-type: image/png");
    04:
    05:
    06: $number = rand(1,9);
    07:
    08: if($number==1)$string2 = "all your base r belong 2 us";
    09: if($number==2)$string2 = "somebody set up us the bomb";
    10: if($number==3)$string2 = "Resistance is futile";
    11: if($number==4)$string2 = "R0D3NTS are cute";
    12: if($number==5)$string2 = "H4X0R in thE yur PC1?!";
    13: if($number==6)$string2 = "Dude w3re's my c4r?";
    14: if($number==7)$string2 = "s0m3on3 st0l3 my mega hurtz!!";
    15: if($number==8)$string2 = "move zig for great justice";
    16: if($number==9)$string2 = "Rodents make the world cool";
    17:
    18:
    19: $im = imagecreatefrompng("http://www.iceteks.com/articles/textsig/redsquirrelsig12.png");
    20: $color = imagecolorallocate($im, 255, 255, 255);
    21:
    22:
    23: $px=167;
    24: $py=70;
    25:
    26: imagestring($im, 3, $px, $py, $string, $color);
    27: imagestring($im, 2, $px, $py+12, $string2, $color);
    28:
    29: imagepng($im);
    30: imagedestroy($im);
    31: ?>
  • On line 3 we give the browser a header that this is not a php file but is an image file. Basically we are reversing what we tell the server to do, run it as php. But what the server is doing is good, because it's running as php which we want, but we don't want the browser to know it's php, so we indicate that it's an image. You do not even need to use an image extension for this to work, but it causes less problems when posting on forums and such, since some won't let you use .php as image.
  • On line 6 through 16 we simply establish what text we want to display. The first part chooses a random number from 1 to 9 and depending on that number, a string is chosen. We store it in the $string2 variable.
  • line 19 picks the image that we will use. Notice that it's actually on a different host. You can pretty much do what you want, even hotlink of another site, but as a courtesy, I would at least put the image on your own host.
  • Line 20 decides what the color of the text will be, using RBG color scale. Notice the $im variable used on line 19 is used as a parameter.
  • Line 24 and 25 are simply variables for the position of the text, these numbers can be written directly in the function but this makes changing easier. If you wanted the text to appear at a different location depending on what the chosen string is, you could easily modify these in each if statement shown at the start.
  • Line 26 and 27 set up the strings on the image. The first one is to show the IP address, and the second is the random string.
  • Line 29 and 30 display and finish the png image and we're all set!
  • The possibilities with this are endless. You can make it so the image changes, and the text changes, and make quite a sophisticated sig!
  • Also, this particular sig does not show much info,but a really scarry sig could be made to show any other php variable such as the user's host name, and I've never researched it, but it's most likely possible to get the user's resolution and other information. Simply plug it in the same spot as the text and you're all set. Also note that if text is too long for the image, it simply gets cut off and does not wrap. Something to keep in mind.

Since 2005 the apache has changed some and altho the original article does work I decided it was time to bring a really good article back to life and correct some now outdated information.
Since Red has already explained the basics of this script I wont go into great detail about its workings.  The first thing we need to change in the original article is:
AddHandler application/x-httpd-php .jpg
This is a extention of the apache httpd used to force our false image to work.  It also prevents anyone from extracting any files located inside the folder where the script resides.

Again since Red has already explained the basics of this script, I am going to just expand off of the original idea.  We already know that $_SERVER['REMOTE_ADDR'] will give us the viewers IP address, but what about some other information.

  • What about the users browser? If we use $_SERVER['HTTP_USER_AGENT'] we can decipher which browser the user is on.
    Here is a small example of how you might go about figuring out what browser the user is on.

    /*
    ** Code example Ony's CCFS Script
    */


    01: <?php
    02: 
    03: function Browser( &$type ) {
    04:   if( preg_match( '/Opera/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
    05:       $type = "Opera Browser";
    06:   } elseif( preg_match( '/Firefox/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
    07:       $type = "Mozzila Firefox";
    08:   } elseif( preg_match( '/MSIE/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
    09:       $type = "Internet Explorer";
    10:   } elseif( preg_match( '/Chrome/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
    11:       $type = "Google Chrome";
    12:   } elseif( preg_match( '/Safari/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
    13:       $type = "Apple Safari";
    14:   } else{
    15:       $type = "Unknown";
    16:   }
    17: }
    18: ?>

  • What about something more complex or freaky. How about the screensize or the windowsize? Well since we are going to use some Ajax, how about showing a proxy ping?
    This is just a sudo idea of how you might accomplish such a feat with javascript.

    01: var I = new Image();
    02: I.onload = function () {
    03: T[ 1 ] = Number( new Date() );
    04: // now do something with T[ 1 ] - T[ 0 ]
    05: }
    06: 
    07: var T = [ Number( new Date() ) ];
    08: 
    09: I.src = 'http://www.yourdomain.com/phpsig/sig.jpg' +
    10: Math.round(Math.random() * 10000 );
    The result is a two-element array T containing 0: the time just prior to telling it to start downloading the image and 1: the time just after it finished.

  • The signature is not the only thing limited to this idea.  You can also do something similar with your avatar.  Make it randomly display a different image on each view/refresh, or even create some kind of custom text or information to randomly appear on or over the Image, just like the signature example here.

The ideas here are limited only by your imagination and or limitations to your knowledge of web software design. From the display of a time, to well what ever else you can think of.  There are LOTS more ideas and features you can implement here, from the use of a database to.. well I'm going to tell you every possibility because of security risks, and it would take all of the fun out of creating your own custom php generated signature.

Now for those of you who are just plan lazy, or have no concept of programming, I have provided a ready to use, plug n play version of the PHP forum sig script.  Just download, extract, configure, and link!

Here is an example of the plug n play script at work.
Dynamic Forum Signature Example

Attention:  Anything you learn, create, or download from this article is of your own free will, thus Iceteks.com & Onykage.com are not and can not be held liable for any actions or reprecustions taken due to the use of these scripts or their examples.   A further note: both me and Red have been banned from forums for use of this script or refusal to not use it. We have both tried in every way possible to explain the workings of this script to the forum admins but we both found deaf ears.  So with this being said, you have been duly warned.






spacer
26756 Hits Pages: [1] 0 Comments
spacer


Latest comments (newest first)
Be the first to post a comment!


Top Articles Latest Articles
- What are .bin files for? (669062 reads)
- Text searching in linux with grep (161180 reads)
- Big Brother and Ndisuio.sys (150471 reads)
- PSP User's Guide (139547 reads)
- SPFDisk (Special Fdisk) Partition Manager (117240 reads)
- How to Use MDADM Linux Raid (188 reads)
- What is Cloud Computing? (1225 reads)
- Dynamic Forum Signatures (version 2) (8769 reads)
- Successfully Hacking your iPhone or iTouch (18714 reads)
- Ultima Online Newbie Guide (35906 reads)
corner image

This site best viewed in a W3C standard browser at 800*600 or higher
Site design by Red Squirrel | Contact
© Copyright 2017 Ryan Auclair/IceTeks, All rights reserved