Jump to content

IP Address/Image Combo


chris collins

Recommended Posts

If you are merely assigning images to predefined IP's (You already know the IP's you will be assigning the images to) then yes, it is very easy. Paste your code here and maybe we can help you implement it into your existing site. You can do this using only PHP...or you can use PHP/MySQL. Depends on how your site is set up and how you manage your site's visitors.
Link to comment
Share on other sites

[!--quoteo(post=364959:date=Apr 14 2006, 07:57 PM:name=Caesar)--][div class=\'quotetop\']QUOTE(Caesar @ Apr 14 2006, 07:57 PM) [snapback]364959[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If you are merely assigning images to predefined IP's (You already know the IP's you will be assigning the images to) then yes, it is very easy. Paste your code here and maybe we can help you implement it into your existing site. You can do this using only PHP...or you can use PHP/MySQL. Depends on how your site is set up and how you manage your site's visitors.
[/quote]

Right, I will have predefined IP's that I will be using. I really haven't created any code yet. I plan to display the images into table cells or something. I'd rather use only PHP if possible, although I can create a database if necessary....
Link to comment
Share on other sites

OK here is the script I want to use, if possible:

[code]
<?php
$img_number = imagecreate(275,25);
$backcolor = imagecolorallocate($img_number,102,102,153);
$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);
?>
[/code]

and it is called with this:

[code]
<img src="http://yoursite/image.php" border="1">
[/code]

Instead of displaying the IP of the person viewing the page (which I want it to do as well), I want each IP associated with a picture, which I will set up. What do you all think?

Chris
Link to comment
Share on other sites

you could have an array of IP's/images. so:


[code]
<?php
// extend this array for all your ip's+corresponding images.
$ip2img = array("123.456.789.012"=>"an_image.jpg", "200.123.150.234"=>"another_image.jpg");

$ip = $_SERVER['REMOTE_ADDR'];
$file = $ip2img[$ip];

$img_number = imagecreatefromjpeg($file);

$number = " Your IP is $_SERVER[REMOTE_ADDR]";

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

header("Content-type: image/jpeg");
imagejpeg($img_number);
?>
[/code]

obviously this is not exactly how you want the code, as i'm not 100% sure what you need, but it should get you started.
cheers
Mark
Link to comment
Share on other sites

[!--quoteo(post=365111:date=Apr 15 2006, 11:41 AM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Apr 15 2006, 11:41 AM) [snapback]365111[/snapback][/div][div class=\'quotemain\'][!--quotec--]
you could have an array of IP's/images. so:
[code]
<?php
// extend this array for all your ip's+corresponding images.
$ip2img = array("123.456.789.012"=>"an_image.jpg", "200.123.150.234"=>"another_image.jpg");

$ip = $_SERVER['REMOTE_ADDR'];
$file = $ip2img[$ip];

$img_number = imagecreatefromjpeg($file);

$number = " Your IP is $_SERVER[REMOTE_ADDR]";

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

header("Content-type: image/jpeg");
imagejpeg($img_number);
?>
[/code]

obviously this is not exactly how you want the code, as i'm not 100% sure what you need, but it should get you started.
cheers
Mark
[/quote]


Thanks Mark, I'll see what I can do with that :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.