Web Hosting, Design, & Coding forum

General discussion

Different picture seen for different IP addresses

by vmo / February 9, 2004 10:40 AM PST

I want to be able to show a picture on a website. But I also want that picture to change on the website depending on the ip address of the viewer.

Ex: House 1 viewing the website would see Pic 1
House 2 viewing the same website would see Pic 2.

Any help would be appreciated.

Discussion is locked
You are posting a reply to: Different picture seen for different IP addresses
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Different picture seen for different IP addresses
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Re:Different picture seen for different IP addresses
by R. Proffitt Forum moderator / February 10, 2004 1:05 AM PST

Without background on the webserver capabilities or if you want to hardcode such into Java I can see some hundred solutions. Nothing specific as to what your answer will be since I don't know if you do CGI, Java or "other."

Before I write further, my policy is I don't write code for non-GNU projects for other people unless they pay me. So don't ask for code.

I will however supply fishing lessons and directions, but no "fish."

With that disclaimer, look at a prime example of how some swap BANNER ADS?

http://www.google.com/search?&q=BANNER+SWAPPER

Collapse -
Re:Different picture seen for different IP addresses
by raa / February 16, 2004 2:05 AM PST

With millions of ip addresses, how do you hope to track who belongs to what ip?

Anyway, you can use java/javascript tricks to get a users ip. Here's an example:

IE:
if (navigator.javaEnabled()) {
userDomain = java.net.InetAddress.getLocalHostName()
return (userDomain.toString())

NETSCAPE:
if (navigator.javaEnabled()) {
baseAddress = java.net.InetAddress.getLocalHost()
userDomain = baseAddress.getHostName()
return (userDomain.toString())
}

Once you have the ip, simply use string functions like userDomain.split(".") to obtain the parts that you need.

The rest is easy, otherwise you need to learn javascript first.

Richie.

Popular Forums
icon
Computer Help 51,912 discussions
icon
Computer Newbies 10,498 discussions
icon
Laptops 20,411 discussions
icon
Security 30,882 discussions
icon
TVs & Home Theaters 21,253 discussions
icon
Windows 10 1,672 discussions
icon
Phones 16,494 discussions
icon
Windows 7 7,855 discussions
icon
Networking & Wireless 15,504 discussions

BEST LIST

Find the best hybrids on the market!

Hybrid technology can be applied to any type of car, and the best show the most significant fuel economy improvements over a similar gasoline-only car.