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 Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

CNET FORUMS TOP DISCUSSION

Help, my PC with Windows 10 won't shut down properly

Since upgrading to Windows 10 my computer won't shut down properly. I use the menu button shutdown and the screen goes blank, but the system does not fully shut down. The only way to get it to shut down is to hold the physical power button down till it shuts down. Any suggestions?