Results 1 to 10 of 10

Thread: Irongeek's Sig

  1. #1
    King Tutorial-ankhamun
    Join Date
    Jul 2004
    Posts
    897

    Irongeek's Sig

    Folks keep asking about how I did my signature image, so here is the code:

    Code:
    <?php   
    /* NOTES on Irongeek's Sig script:
    To use this php script as a sig most boards will need it to have a png extension.
    To do this, put a redirect from a png file to the php file in your apache config file (httpd.conf). 
    Example line:
    	Redirect /sig.png /sig.php
    
    Consider this code to be GPLed, but I'd love for you to email me at Irongeek@irongeek.com with any changes you make. 
    More information about using php and images can be found at http://us3.php.net/manual/en/ref.image.php
    
    Adrian Crenshaw
    http://www.irongeek.com
    */
    	header("Content-type: image/png");
    	//header("Content-type: text/html");
    	$im    = imagecreatefrompng("base.png");
    	imagecolortransparent ( $im,imagecolorallocate($im, 255, 255, 255));
    	imagestring($im, 1, 55, 0, "Your IP: ".$_SERVER['REMOTE_ADDR'], 0);
    	imagestring($im, 1, 55, 7,"Host Name: ".gethostbyaddr($_SERVER['REMOTE_ADDR']), 0);
    	imagestring($im, 1, 80, 14, "Platform:".find_os(), 0);
    	imagestring($im, 1, 90, 21, "Browser:".find_browser(), 0);
    	//imagestring($im, 1, 80, 40, "NetBIOS Info: ".netbios_info(), 0);
    	//imagestring($im, 1, 80, 50, $_SERVER['HTTP_REFERER'], 0);
    	$rquote=random_quote();
    	print_long_line($rquote,90,28, imagecolorallocate($im, 0, 0, 255), $im);
    	imagepng($im);
    	imagedestroy($im);
    
    function random_quote(  ) 
    {
    $quotes[] = 'If you can\'t out lift them, then out code them!';
    $quotes[] = 'Monkey!!!';
    $quotes[] = '"So having sex with coffee is a bad thing? Would anyone care for some coffee? Extra cream." Adrian';
    $quotes[] = '"Hey now, don\'t knock the mail-order brides. I\'ve always wanted a woman that couldn\'t say no.... in English!" Darenism';
    $quotes[] = '"Exude your wave of bunny goodness." Josh about Valek';
    $quotes[] = '"We\'re rich. We\'re poor. We\'re smugglers!" Gav/Dave';
    $quotes[] = '"Brent\'s not like a little girl. He struggles." Dave';
    $quotes[] = '"I sense a great bitchyness in the Force." Adrian';
    $quotes[] = '"Is it me? I can\'t smell me." Brent';
    $quotes[] = '"If you see a midget and don\'t make it suck your ****, you lose a point of Perversion." Megz';
    $quotes[] = '"It\'s harder for me to get a Blockbuster membership than it is to get a bounty hunter license." Darenism';
    $quotes[] = '"Don\'t forget, for the Dark Priest, Dark Choirboys." Gary';
    $quotes[] = '"That\'s what happens when you combine a tapeworm and Siegfried and Roy." Gary';
    $quotes[] = '"Evil has an obsession with getting its ass kicked." Gary';
    $quotes[] = '"We\'ve become masters of the five-mile drive by." Gary';
    $quotes[] = '"We\'d be dangerous if we didn\'t keep hurting ourselves." James';
    $quotes[] = '"Instead of toilet paper, we\'ll use corpses."  Josh(Rifts)';
    $quotes[] = '"Remember, lubrication is your friend." Josh(Rifts)';
    $quotes[] = '"I see all. Dark, evil, *******s." Thomas';
    $quotes[] = '"Crucifixion, five dollars." Gary';
    $quotes[] = '"It\'s a short bus dragon now." Darenism';
    $quotes[] = '"Night of the Living Jawas." Adrian';
    $quotes[] = '"Like ****ing warm apple pie.*pause* Like ****ing a cold cheesecake." Adrian On necrophilia ';
    $quotes[] = '"The Beer God cometh." Dave';
    $quotes[] = '"A map. That\'s an archaic astronavigation device." Brent';
    $quotes[] = '"You are not taking the bunny up the ass? Wrong kind of rodent for you?" Adrian to Dave';
    $quotes[] = '"Rustling their women and raping their cattle." Gary';
    $quotes[] = '"Ignite and strike." Dave';
    $quotes[] = '"Hey kids, join the Empire and get a free Pokemon backpack." Daren\'s SW quote';
    $quotes[] = '"I don\'t know if I want this on the internet. It makes me look like a pervert." Adrian on the book of quotes';
    $quotes[] = '"Experience raises your stats." Darenism';
    $quotes[] = '"I kill things, not read stuff." Brent(Abyssals)';
    $quotes[] = '"With great power comes the ability to **** with people." Darenism';
    $quotes[] = '"Have fun here. Look, there\'s a TV here." Trevor to Evil Trevor';
    $quotes[] = '"Nigel, she\'s 19. You\'re not stupid. *pause* I\'ll take care of this." Cam/Nick, talking about Sam\'s virginity';
    $quotes[] = '"Patch me, Lord." Frank/Adrian';
    $quotes[] = '"You will inherit the socks of Jesus." Brent';
    $quotes[] = 'Stanley/Brent: [chocks shotgun] Jellystone\'s got a new ranger, bitch! [shoots bear and it drops like a stone]';
    $quotes[] = 'Adrian, after eating the best pecan pie ever: "It\'s like Willy Wonka shot a load in my mouth!" ';
    $quotes[] = 'Zombies?  No, I said Rhombies... you know Rhombuses.. we\'re mathematicians  -Brent';
    srand ((double) microtime() * 1000000);
    $random_number = rand(0,count($quotes)-1);  
    return $quotes[$random_number];
    }
    
    function netbios_info(  )
    {
    	$crap = array(" ", "\n","\t","Lookingupstatusof",$_SERVER['REMOTE_ADDR'],);
    	$morecrap=array("<20>-B","<00>-<GROUP>B","<20>-M","<00>-M","<00>-<GROUP>M","<ACTIVE>","//");
    	$results =str_replace($crap,"",shell_exec("nmblookup -A  ".$_SERVER['REMOTE_ADDR']));
    	$results =str_replace($morecrap,"/",$results);
    	return $results;
    }
    
    function print_long_line($string, $offset, $line, $color, $im){
    	$string=$string.' ';
    	$slen=strlen($string);
    	if ($slen>52){
    		$splitspace = strpos($string, " ", 52);
    		imagestring($im, 1, $offset, $line, substr($string,0,$splitspace), $color);
    		print_long_line(substr($string,$splitspace ,$slen),$offset, $line+7, $color, $im);
    	}else{
    		imagestring($im, 1, $offset, $line, $string, $color);
    	}
    }
    
    
    function find_os()
    {
    $browserarray=explode("; ",$_SERVER['HTTP_USER_AGENT']);
    $os= $browserarray[2];  
    return $os;
    }
    
    function find_browser()
    {
    $browserarray=explode("; ",$_SERVER['HTTP_USER_AGENT']);
    if ($browserarray[1]=="U"){
    	$browser = $browserarray[4];
    }else {
    	$browser = $browserarray[1];
    }
    return $browser;
    }
    
    ?>

  2. #2
    Member
    Join Date
    Jul 2003
    Posts
    38
    Ha-ha, you beat me to it irongeek, I was just starting a tutorial on how to make a dynamic php signature to use in forums. Nice job with the coding though, I love seeing how other people think when it comes to coding.

    -AzE

  3. #3
    King Tutorial-ankhamun
    Join Date
    Jul 2004
    Posts
    897
    I wonder what else would be cool to add to our scripts? Maybe an IP location function like some GUI traceroutes have? I'd love to see your code, you may have a better way to do somethings (i'm not that good with php). I have more info abour mine out at

    http://tux.ius.edu/phpbb2/viewtopic.php?t=1276

  4. #4
    Member
    Join Date
    Jul 2003
    Posts
    38
    The junk below is the php I used to create my signature. I actually think yours is better however, mine (due to the nature of being tossed together quickly) is sort of pathetic workmanship. After looking at your code it almost seems as if we were working together the entire time , except mine is written upside down. One thing I see lacking in these scripts however is the detection for some other types of browsers that aren't in the "standard few", such as the Galeon browser. If you have ever seen the resulting output when these signatures are pulled up in Galeon you'll know exactly what I mean .

    Code:
     <?php
    header("Content-type: image/png");	
    
    function osdet() 
    {
    $array2=explode(";", $_SERVER['HTTP_USER_AGENT']);
    
            if ($array2[2]==" Windows NT 5.1") {
    	  $OS=" Windows XP"; }
    	elseif ($array2[2]==" Windows NT 5.0") {
    	  $OS=" Windows 2000"; }
    	else {
    	  $OS=$array2[2]; }
    	
    	return $OS;
    }
    
    function browdet() 
    {
    $array=explode(")", $_SERVER['HTTP_USER_AGENT']);
    $array2=explode(";", $_SERVER['HTTP_USER_AGENT']);
            
           if ($array2[1]!=" U") {
    	  $browser=$array2[1]; }
    	else {
    	  $browser=$array[1]; }
    	
    	return $browser;
    }
    
    function quotegen () 
    {
    	srand((double)microtime()*1000000); 
    	$arry_txt=preg_split("/\n/",join('',file("quotes.txt"))); 
    	$quote=$arry_txt[rand(0,sizeof($arry_txt)-1)];
    	return $quote;
    }
    	
    $im=imagecreatefrompng("images/signiture.png");
    $orange=imagecolorallocate($im, 220, 210, 60);
    $red=imagecolorallocate($im, 225, 0, 0);
    $blue=imagecolorallocate($im,  95, 95, 128);
    
    imagestring($im, 1, 130, 10, "Your OS:".osdet(), $red);
    imagestring($im, 1, 50, 18, "Your IP: ".$_SERVER['REMOTE_ADDR'], $blue);
    imagestring($im, 1, 50, 26, "Your Host: ".gethostbyaddr($_SERVER['REMOTE_ADDR']), $blue);
    imagestring($im, 1, 50, 34, "Your Browser: ".browdet(), $blue);
    imagestring($im, 1, 1, 43, quotegen(), $orange);
    
    
    imagepng($im);
    imagedestroy($im);
    ?>
    -Enjoy-
    AzE

  5. #5
    King Tutorial-ankhamun
    Join Date
    Jul 2004
    Posts
    897
    Ok, I just added a crude way to but the city of the isp, let me know if you find a better way:

    Code:
    <?php   
    /* NOTES on Irongeek's Sig script:
    To use this php script as a sig most boards will need it to have a png extension.
    To do this, put a redirect from a png file to the php file in your apache config file (httpd.conf). 
    Example line:
    	Redirect /sig.png /sig.php
    
    Consider this code to be GPLed, but I'd love for you to email me at Irongeek@irongeek.com with any changes you make. 
    More information about using php and images can be found at http://us3.php.net/manual/en/ref.image.php
    
    Adrian Crenshaw
    http://www.irongeek.com
    */
    	header("Content-type: image/png");
    	//header("Content-type: text/html");
    	$im    = imagecreatefrompng("base.png");
    	imagecolortransparent ( $im,imagecolorallocate($im, 255, 255, 255));
    	imagestring($im, 1, 55, 0, "Your IP: ".$_SERVER['REMOTE_ADDR'], 0);
    	$hostname=gethostbyaddr($_SERVER['REMOTE_ADDR']);
    	imagestring($im, 1, 55, 7,"Host Name: ".$hostname, 0);
    	$os=find_os();
    	imagestring($im, 1, 80, 14, "Platform:".$os, 0);
    	$browser=find_browser();
    	imagestring($im, 1, 90, 21, "Browser:".$browser, 0);
    	//imagestring($im, 1, 80, 40, "NetBIOS Info: ".netbios_info(), 0);
    	imagestring($im, 1, 90, 28, "ISP City:".whois_info(), 0);
    	$rquote=random_quote();
    	print_long_line($rquote,90,35, imagecolorallocate($im, 0, 0, 255), $im);
    
    	imagepng($im);
    	imagedestroy($im);
    
    
    function whois_info(  )
    {
    	$results =shell_exec("whois ".$_SERVER['REMOTE_ADDR']);
    	$fs = strpos($results, "City:", 0);
    	if ($fs==0){return 'Not Found';}
    	$ls = strpos($results, "\n", $fs);
    	$results = substr($results,$fs,$ls-$fs);
    	$crap=array("City:", "  ");
    	$results =str_replace($crap,"",$results);
    
    	return $results;
    }
    
    
    
    function random_quote(  ) 
    {
    $quotes[] = 'If you can\'t out lift them, then out code them!';
    $quotes[] = 'Monkey!!!';
    $quotes[] = '"So having sex with coffee is a bad thing? Would anyone care for some coffee? Extra cream." Adrian';
    $quotes[] = '"Hey now, don\'t knock the mail-order brides. I\'ve always wanted a woman that couldn\'t say no.... in English!" Darenism';
    $quotes[] = '"Exude your wave of bunny goodness." Josh about Valek';
    $quotes[] = '"We\'re rich. We\'re poor. We\'re smugglers!" Gav/Dave';
    $quotes[] = '"Brent\'s not like a little girl. He struggles." Dave';
    $quotes[] = '"I sense a great bitchyness in the Force." Adrian';
    $quotes[] = '"Is it me? I can\'t smell me." Brent';
    $quotes[] = '"If you see a midget and don\'t make it suck your ****, you lose a point of Perversion." Megz';
    $quotes[] = '"It\'s harder for me to get a Blockbuster membership than it is to get a bounty hunter license." Darenism';
    $quotes[] = '"Don\'t forget, for the Dark Priest, Dark Choirboys." Gary';
    $quotes[] = '"That\'s what happens when you combine a tapeworm and Siegfried and Roy." Gary';
    $quotes[] = '"Evil has an obsession with getting its ass kicked." Gary';
    $quotes[] = '"We\'ve become masters of the five-mile drive by." Gary';
    $quotes[] = '"We\'d be dangerous if we didn\'t keep hurting ourselves." James';
    $quotes[] = '"Instead of toilet paper, we\'ll use corpses."  Josh(Rifts)';
    $quotes[] = '"Remember, lubrication is your friend." Josh(Rifts)';
    $quotes[] = '"I see all. Dark, evil, *******s." Thomas';
    $quotes[] = '"Crucifixion, five dollars." Gary';
    $quotes[] = '"It\'s a short bus dragon now." Darenism';
    $quotes[] = '"Night of the Living Jawas." Adrian';
    $quotes[] = '"Like ****ing warm apple pie.*pause* Like ****ing a cold cheesecake." Adrian On necrophilia ';
    $quotes[] = '"The Beer God cometh." Dave';
    $quotes[] = '"A map. That\'s an archaic astronavigation device." Brent';
    $quotes[] = '"You are not taking the bunny up the ass? Wrong kind of rodent for you?" Adrian to Dave';
    $quotes[] = '"Rustling their women and raping their cattle." Gary';
    $quotes[] = '"Ignite and strike." Dave';
    $quotes[] = '"Hey kids, join the Empire and get a free Pokemon backpack." Daren\'s SW quote';
    $quotes[] = '"I don\'t know if I want this on the internet. It makes me look like a pervert." Adrian on the book of quotes';
    $quotes[] = '"Experience raises your stats." Darenism';
    $quotes[] = '"I kill things, not read stuff." Brent(Abyssals)';
    $quotes[] = '"With great power comes the ability to **** with people." Darenism';
    $quotes[] = '"Have fun here. Look, there\'s a TV here." Trevor to Evil Trevor';
    $quotes[] = '"Nigel, she\'s 19. You\'re not stupid. *pause* I\'ll take care of this." Cam/Nick, talking about Sam\'s virginity';
    $quotes[] = '"Patch me, Lord." Frank/Adrian';
    $quotes[] = '"You will inherit the socks of Jesus." Brent';
    $quotes[] = 'Stanley/Brent: [chocks shotgun] Jellystone\'s got a new ranger, bitch! [shoots bear and it drops like a stone]';
    $quotes[] = 'Adrian, after eating the best pecan pie ever: "It\'s like Willy Wonka shot a load in my mouth!" ';
    $quotes[] = 'Zombies?  No, I said Rhombies... you know Rhombuses.. we\'re mathematicians  -Brent';
    srand ((double) microtime() * 1000000);
    $random_number = rand(0,count($quotes)-1);  
    return $quotes[$random_number];
    }
    
    function netbios_info(  )
    {
    	$crap = array(" ", "\n","\t","Lookingupstatusof",$_SERVER['REMOTE_ADDR'],);
    	$morecrap=array("<20>-B","<00>-<GROUP>B","<20>-M","<00>-M","<00>-<GROUP>M","<ACTIVE>","//");
    	$results =str_replace($crap,"",shell_exec("nmblookup -A  ".$_SERVER['REMOTE_ADDR']));
    	$results =str_replace($morecrap,"/",$results);
    	return $results;
    }
    
    function print_long_line($string, $offset, $line, $color, $im){
    	$string=$string.' ';
    	$slen=strlen($string);
    	if ($slen>52){
    		$splitspace = strpos($string, " ", 52);
    		imagestring($im, 1, $offset, $line, substr($string,0,$splitspace), $color);
    		print_long_line(substr($string,$splitspace ,$slen),$offset, $line+7, $color, $im);
    	}else{
    		imagestring($im, 1, $offset, $line, $string, $color);
    	}
    }
    
    
    function find_os()
    {
    $browserarray=explode("; ",$_SERVER['HTTP_USER_AGENT']);
    $os= $browserarray[2];  
    return $os;
    }
    
    function find_browser()
    {
    $browserarray=explode("; ",$_SERVER['HTTP_USER_AGENT']);
    if ($browserarray[1]=="U"){
    	$browser = $browserarray[4];
    }else {
    	$browser = $browserarray[1];
    }
    return $browser;
    }
    
    ?>

  6. #6
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    lol...I live in Not Found. I assume it must work for some places?

    ac

  7. #7
    King Tutorial-ankhamun
    Join Date
    Jul 2004
    Posts
    897
    It works at my work. It depends on what "whois" returns.

  8. #8
    Member
    Join Date
    Jul 2003
    Posts
    38
    Nice addition to your signature Irongeek, I only wish there was an easier way to get better detection rates. The only way I could think to improve this could be to use a sql table filled with country or city information by IP blocks and use php to search and pull the correct information. I have found these list actually work quite well, they had my location fingered just right! The downside is that these DB’s can get quite large, the plane text version of my cities list is around 170 megs, but you might want to check it out nonetheless.

    My 2 Pesos
    -AzE-

  9. #9
    King Tutorial-ankhamun
    Join Date
    Jul 2004
    Posts
    897
    Where can I get it from?

  10. #10
    Member
    Join Date
    Jul 2003
    Posts
    38
    I'm trying to remember where in the world I came across a free IP to City database, but so far I'm drawing a blank. The best I can do right now is to say http://ip-to-country.webhosting.info/ they have a free IP-Country database if memory serves. I'll keep looking around for a free IP to city DB however, who knows maybe I still have one

    AzE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •