Google Community
Latest Forums Rules Resources
Custom Search

Go Back   Google Community > The Community > GC Announcements

GoogleCommunity Sponsor
Cirtex Hosting
Use coupon "forum" for 50% Off!

Reply
 
LinkBack Thread Tools Display Modes
Old 07-10-2006, 10:44 PM   #1 (permalink)
Master Googler
 
Join Date: Mar 2006
Location: Terminus
Posts: 531
Thanks: 0
Thanked 0 Times in 0 Posts
cruocitae
Call to PHP in signature

I have a PHP script which detects the visitors' ip, and creates a [email]root@you.rip.adr.ess[/url] image using the gd library.I've seen that script used on other forums (in siggies), and I'd like to add it here too. br
cruocitae is offline   Reply With Quote
 
Sponsored Links
Old 07-11-2006, 09:38 AM   #2 (permalink)
Google Guru
 
andrew247's Avatar
 
Join Date: Oct 2005
Location: c:\GoogleCommunity
Posts: 3,368
Thanks: 3
Thanked 12 Times in 12 Posts
andrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of light
PNG image [I think other image types work too, but PNG springs to mind].
You have to generate the PNG using PHP then destroy the image when done.

You need a folder on your webserver, and you need to put a .htaccess file in this folder with the following code:
Code:
AddType application/x-httpd-php .png
You need to put an image in this folder called sigback.png (called in php file).


Then, this should be saved as sig.png:
Code:
<?php

header("Content-type: imageNG");

$text2 = "Your IP is: '.$_SERVER['REMOTE_ADDR'].'.";

$image = imagecreatefrompng("sigback.png");
/* Hex text colour */
$colour = imagecolorallocate($image, 255, 255, 255);

/* X and Y coordinates for the text on your image */

$px=120;
$py=30;

imagestring($image, 2, $px, $py+12, $text2, $colour);

imagepng($image);
imagedestroy($image);
?>
This is untested, so I don't know if it'll work.
andrew247 is offline   Reply With Quote
Old 07-11-2006, 12:53 PM   #3 (permalink)
Master Googler
 
Join Date: Mar 2006
Location: Terminus
Posts: 531
Thanks: 0
Thanked 0 Times in 0 Posts
cruocitae
You didn't understand me, I already have a script.

Code:
<?php
header("Content-type: image/png");
$im = imagecreatefrompng("rootsig.png");
$color = imagecolorallocate($im, 0, 0, 0);
$font = "fonts/verdana.ttf";
$rmpath = $_SERVER['REMOTE_ADDR'];
$curup = "root@".$rmpath;
imageAlphaBlending($im, true);
imageSaveAlpha($im, true);
imagettftext($im, 7.5, 0, 0, 12, $color, $font, $curup);
imagepng($im);
imagedestroy($im);
?>
Well, I admit that yours is a bit more simple.
But how can I insert this png HERE (GC), so every once a user visits the forum he would get this image with his own IP.
cruocitae is offline   Reply With Quote
Old 07-11-2006, 12:58 PM   #4 (permalink)
Google Guru
 
andrew247's Avatar
 
Join Date: Oct 2005
Location: c:\GoogleCommunity
Posts: 3,368
Thanks: 3
Thanked 12 Times in 12 Posts
andrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of light
Insert the PNG in your signature.
Code:
[img]http://www.yoursite.com/images/sig.png[/img]
I don't understand your question now.
andrew247 is offline   Reply With Quote
Old 07-14-2006, 03:22 AM   #5 (permalink)
Master Googler
 
Join Date: Mar 2006
Location: Terminus
Posts: 531
Thanks: 0
Thanked 0 Times in 0 Posts
cruocitae
If I isnert the png, there will only show up a blank white png, and it won't show the user it's ip. Not my ip.
cruocitae is offline   Reply With Quote
Old 07-14-2006, 04:10 AM   #6 (permalink)
Google Guru
 
andrew247's Avatar
 
Join Date: Oct 2005
Location: c:\GoogleCommunity
Posts: 3,368
Thanks: 3
Thanked 12 Times in 12 Posts
andrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of lightandrew247 is a glorious beacon of light
Um, I dunno.

Did you by any chance put rootsig.png in your signature instead of sig.png?

Does your host support the GD Library?

Hang on, and I'll try and set up mine, and see if I have any difficulties.


EDIT: I have difficulties telling the PNG file to be a PHP file.

I got my PHP file to work. [Here], but when I rename it sig.png, when I try to open the file, it asks what program I want to use to download it. I have a .htaccess file telling all files to open as PHP, regardless of extension, so I'm not sure if it's just my host.
andrew247 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call Of Duty 2 357_magnum Gaming 23 11-05-2006 09:04 AM
pls call me by Gtalk! zglzhl Google Talk 0 09-08-2005 05:11 AM
call me an idiot if u want sirlaguna Social Networking 9 08-11-2005 05:29 AM
Old timers call dude66 Chit Chat 12 07-17-2005 06:09 AM


All times are GMT -8. The time now is 05:44 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004–2007 Google Community