Author | Post | |||
r3d5pik3 |
ok its time i release the source to my completed sig. yes its finaly finished if anythink i will just tweak a few things after this point. NOTE: it is coded to fit my image at negative-bliss.roaddoggsmc.com/images/phpsig.jpg but after reading the source code you will find it very easy to manipulate the string locations on the image to make it fit yur custom background ok set up would be something like this: Find a webhost with php support , .htaccess, and the gd library installed www.ripway.com < everything required but .htaccess if you find a host that supports .htaccess put create a folder (this folder will be refered to as sig/ in this tut) with no onther files in it and in that folder make another folder called images. in the folder sig/ create a .htaccess file with the following ForceType application/x-httpd-php that tells the webserver to treat everythin in this webserver as php no matter what the extension is now if you have .htaccess you can create a file in that folder called sig.jpg if you dont have .htaccess you HAVE TO save the file with a .php extension so something like sig.php and now the source (i hope i documented it good enough) <?php /* tell the browser requesting the file to treat it as a jpg */ header("Content-type: image/jpeg"); /*grab the user agent make it all lower case then assign it to $agent*/ $agent = strtolower($_SERVER["HTTP_USER_AGENT"]); /*check the user agent for os references. you could add more os's but i just added the most popular*/ if (strpos($agent, "windows"))$OS = "Microshit's Winblowz"; if (strpos($agent, "linux"))$OS = "Some Linux Distro"; if (strpos($agent, "freebsd"))$OS = "Free BSD (a.k.a. teh good shit)"; if (!isset($OS))$OS = "(bastardized useragent)"; /*check user agent for browser references*/ if (strpos($agent, "msie"))$browser = "Internet Exploder"; if (strpos($agent, "mozilla"))$browser = "Mozilla or Netscape"; if (strpos($agent, "opera"))$browser = "Opera (Better then IE)"; if (strpos($agent, "firefox"))$browser = "FireFox (good choice)"; if (!isset($OS))$browser = "(bastardized useragent)"; /*if the user is using a proxy it will still try to get the users original IP but if it fails it will just return the proxies IP*/ if ($_SERVER["HTTP_X_FORWARDED_FOR"]) { $UserIP = $_SERVER["HTTP_X_FORWARDED_FOR"]; } else { $UserIP = $_SERVER["REMOTE_ADDR"]; } /*grabe the referer header to see where there coming from*/ if(!$_SERVER["HTTP_REFERER"]) { $CameFrom = "Unknown"; } else { $CameFrom = $_SERVER["HTTP_REFERER"]; } /*random sayings*/ $number = rand(1,9); if($number==1)$Saying = "Ph34r teh r3d 1z"; if($number==2)$Saying = "You have been haxxored by r3d5pik3"; if($number==3)$Saying = "Just because yur paraniod dont mean there not after you"; if($number==4)$Saying = "My Sig is better than yurz"; if($number==5)$Saying = "Can you beleive people are still christians?"; if($number==6)$Saying = "Open yur mind. Toke some herb"; if($number==7)$Saying = "The economy is weak. Lets throw rocks at it!"; if($number==8)$Saying = "Those who would sacrifice freedom for security deserve neither. -BF"; if($number==9)$Saying = "More a question then a course. How can hell be any worse?"; /*making the data gathered look more detailed*/ $Line1 = "Your IP is: " . $UserIP; $Line2 = "Your O/S: " . $OS; $Line3 = "Your Browswer: " . $browser; $Line4 = $CameFrom; $Line5 = $Saying; /*loads the bg pic*/ $BGImage = imagecreatefromjpeg("images/phpsig.jpg"); /*set up the color of the text using imagecolorallocate(bgpic, r3d, gr33n, blu3) */ $textcolor = imagecolorallocate($BGImage, 255, 255, 255); /*establish the base cordinates for the first string NOTE:doing this makes the strings easier to play with*/ $x=95; $y=6; /*one line at a time we will print the gathered strings onto the upper layer of the image*/ imagestring($BGImage, 2,$x, $y, $Line1, $textcolor); imagestring($BGImage, 2,$x, $y+15, $Line2, $textcolor); imagestring($BGImage, 2,$x, $y+30, $Line3, $textcolor); imagestring($BGImage, 2,$x, $y+44, "You came from:", $textcolor); imagestring($BGImage, 1,$px, $py+56, $Line4, $textcolor); imagestring($BGImage, 2,$px-10, $py+64, $Line5, $textcolor); /*k now lets up it all together*/ imagejpeg($BGImage); /*Now we kill the image*/ imagedestroy($BGImage); ?> |
|||
24.07.2004 22:30:03 |
|
|||
Dreamcatcher |
this may be a stupid question but how would i get this image working, do i have to save the source code as "image.jpg" ore something and place it in /sig/images ? i coudnt get it myself so pls tell me how i would get this working ( yes i did setup the .htaccess abd yes my server supports resume ) whem i call the image at its location eg: http://localhost/sig/images/image.jpg it tells me the file cannot be displayed cause it has errors |
|||
07.08.2004 00:17:01 |
|
|||
r3d5pik3 |
yah save it as .php ^^^ if you dont have .htaccess if you do have .htaccess then just save it as .jpg make sure yur server has the gdlibrary this wont work without the gd library |
|||
Edited by r3d5pik3 on 07.08.2004 00:27:40 | ||||
07.08.2004 00:21:23 |
|
|||
beerhunter |
It'd be funny to have a dynamic image that detects the user's browser and OS and insults them. |
|||
07.08.2004 07:15:08 |
|
|||
r3d5pik3 |
/me points at the line of codes in my sig in os and browser detection saying "microshit's winblowz" and "internet exploder" |
|||
08.08.2004 06:52:57 |
|
|||
beerhunter |
My point is that you should insult all operating systems and browsers. Besides — "microshit's winblowz"? "internet exploder"? Those aren't even insulting. You could stand to do a little reading. |
|||
11.08.2004 06:26:30 |
|
|||
r3d5pik3 |
gotcha, you should make one |
|||
13.08.2004 04:37:11 |
|
|||
pjsk8 |
@theblacksheep: You realize that http://www.bright-shadows.net/script/userinfo.php has the same info, right? |
|||
15.08.2004 20:14:30 |
|
|||
theblacksheep |
yes why? is it a problem? |
|||
16.08.2004 06:30:13 |
|
|||
pjsk8 |
Oh no, I was just saying that instead of making a page for your avatar, you could've just used this page. Oh well. |
|||
16.08.2004 12:21:31 |
|