LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-05-2005, 02:51 PM   #1
benrose111488
Member
 
Registered: Jun 2004
Location: Wantage, NJ
Distribution: Fedora 7
Posts: 177

Rep: Reputation: 30
Quick & Simple Question


okay, one time I was browsing a forum, not linuxquestions.org, and I saw this one guy who had a unique signature. His signature said "Your IP is xx.xx.xxx.xxx" only the x's were my real IP. I went to view source, but i saw that it was actually an image! How is this possible? Could someone tell me how to manage such a thing?!?
 
Old 01-05-2005, 03:48 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
The image was probably being pulled from his server, with a bit of quick php scripting and using gd for graphics you can quickly create an image and overlay some text. The IP itself can obviously be found from examining the REMOTE_ADDR environment variable.
 
Old 01-05-2005, 04:13 PM   #3
Boby
Member
 
Registered: Feb 2004
Posts: 781

Rep: Reputation: Disabled
Take a look at this one: http://www.danasoft.com/

Boby
 
Old 01-05-2005, 08:17 PM   #4
benrose111488
Member
 
Registered: Jun 2004
Location: Wantage, NJ
Distribution: Fedora 7
Posts: 177

Original Poster
Rep: Reputation: 30
yeah I figured the remote server part, but could someone help me with the code? I'm quite interested in writing my own
 
Old 01-05-2005, 08:20 PM   #5
benrose111488
Member
 
Registered: Jun 2004
Location: Wantage, NJ
Distribution: Fedora 7
Posts: 177

Original Poster
Rep: Reputation: 30
I have PHP installed, and am quite proficient at it. If someone could just outline the basic process to me, I would be able to carry on myself

Thanks!
 
Old 01-06-2005, 03:24 AM   #6
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Basically:
1) Manage to print the IP of someone who views your script.
2) Manage to put some text into an image using gd.
3) Manage to put the IP into the image.
Which bit's holding you up?
 
Old 01-06-2005, 10:55 AM   #7
benrose111488
Member
 
Registered: Jun 2004
Location: Wantage, NJ
Distribution: Fedora 7
Posts: 177

Original Poster
Rep: Reputation: 30
Printing the IP into the image is the part that's lagging me up the most. I think I've got it now, though

Code:
<?php
$img_number = imagecreate(275,25);
$backcolor = imagecolorallocate($img_number,000,000,000);
$textcolor = imagecolorallocate($img_number,255,255,255);

imagefill($img_number,0,0,$backcolor);
$number = " Your IP is $_SERVER[REMOTE_ADDR]";

Imagestring($img_number,10,5,5,$number,$textcolor);

header("Content-type: image/jpeg");
imagejpeg($img_number);
?>
It's working for me, but please test it for me, everyone, especially those behind a firewall and such. The link is:
http://www.freepgs.com/darkflame/hacks/image.php

Thanks everyone!
 
Old 01-06-2005, 11:02 AM   #8
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Urg, you got me! Yep it works fine
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick and simple question please! lonecrow Linux - Software 13 11-15-2005 08:38 AM
Quick simple KDE question dangerousdave Linux - Newbie 1 03-29-2005 12:33 PM
Quick Simple Question Oracl3 Linux - Newbie 4 04-05-2004 08:40 PM
very quick/simple rpm question thugbot3oo5 Linux - Newbie 13 03-03-2004 01:31 PM
simple, quick question.. b0uncer Linux - Hardware 4 12-28-2003 12:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration