We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
  • Pages:
  • 1
Javascript?
Topic Started: Jan 28 2005, 12:51 AM (876 Views)
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
Anyone know if there is a way for Javascript to find and act on a persons IP adress?

I am trying to make a pop-up that only works with certain peoples IP so the code would be
Quote:
 


function IPblocker( IF USERS IP = WHATEVER) {

    var result = window.confirm("The Text Would Go Here")
}
Offline Profile Quote Post Goto Top
 
Captain Kam
Custom member title
[ *  *  *  *  * ]
dunno if that would be in Javascript. It WOULD be in PHP or Perl or something though o.o'
Offline Profile Quote Post Goto Top
 
Stefan
Member Avatar
Mew?
[ *  *  *  *  *  *  * ]
Code:
 
ip = '<!--#echo var="REMOTE_ADDR"-->'

That bit of code assigns the user's IP address to the ip variable.
Don't know if it will work with all browsers, but it does with Firefox (so Mozilla and Netscape too) and IE.
Offline Profile Quote Post Goto Top
 
kingy
1 in 10 people understands binary, the other 1 doesn't
[ *  *  *  *  *  * ]
it should include in all browsers, its general ssi
Offline Profile Quote Post Goto Top
 
Stefan
Member Avatar
Mew?
[ *  *  *  *  *  *  * ]
You can't say it should work in all browsers because it's ssi. It's used in client context.
Offline Profile Quote Post Goto Top
 
Seth
Member Avatar
I has a pony
[ *  *  *  *  *  *  *  *  * ]
Stefan
January 28, 2005 10:34 AM
You can't say it should work in all browsers because it's ssi. It's used in client context.

:ermm:

SSI = Server-side Include? :unsure:
Offline Profile Quote Post Goto Top
 
kingy
1 in 10 people understands binary, the other 1 doesn't
[ *  *  *  *  *  * ]
thats what i thought Seth, i didn't think it mattered on the user end
Offline Profile Quote Post Goto Top
 
FearKiller
Member Avatar
www.drewscripts.com
[ *  *  *  *  * ]
Javascript, VBScript, etc. = Client Side
PHP, Perl, ASP, etc. = Server Side
Java = Client Side and/or Server Side

Client side - executed by the client; can be disabled by the user
Server side - executed by the server; can not be disabled by the user
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
Yay for you, you managed to say something totally random, which didn;t really have anything to do with what was being discussed :)
Offline Profile Quote Post Goto Top
 
FearKiller
Member Avatar
www.drewscripts.com
[ *  *  *  *  * ]
Rory
January 28, 2005 12:52 PM
Yay for you, you managed to say something totally random, which didn;t really have anything to do with what was being discussed :)

Quote:
 
dunno if that would be in Javascript. It WOULD be in PHP or Perl or something though o.o'

Quote:
 
Don't know if it will work with all browsers, but it does with Firefox (so Mozilla and Netscape too) and IE.

Quote:
 
SSI = Server-side Include?

Quote:
 
thats what i thought Seth, i didn't think it mattered on the user end


Quote:
 
Javascript, VBScript, etc. = Client Side
PHP, Perl, ASP, etc. = Server Side
Java = Client Side and/or Server Side

Client side - executed by the client; can be disabled by the user
Server side - executed by the server; can not be disabled by the user


Match the colors. I see alot of relation or maybe I just have no idea what the hell is going on.
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
No, you seem to have mistaken slightly. The topic moved to talk about SSI. Which you happened not to mention in the slightest :)
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
When it assigns the Ip adress to ip could I use a function then like
Quote:
 
function ip (ip = THE NUMBER HERE)
so the function would only run for certain ip's?
Offline Profile Quote Post Goto Top
 
Seth
Member Avatar
I has a pony
[ *  *  *  *  *  *  *  *  * ]
That's not how you use functions. But, er, your concept is correct.
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
Then how would you do it?
Offline Profile Quote Post Goto Top
 
kingy
1 in 10 people understands binary, the other 1 doesn't
[ *  *  *  *  *  * ]
Code:
 

<script type='text/javascript'>

ip = '<!--#echo var="REMOTE_ADDR"-->'
allowed = 202.90.38.2

if (ip = allowed)
{
alert('You have the right IP')
} else {
alert('You don't have the right ip')
}



ok that was really quick, and basically shows you how this would work (i think). you could chnage allowed to whatever IP you want to see whatever the content is. For the benifit of this i just made it display alert messages
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Technology Chat · Next Topic »
Add Reply
  • Pages:
  • 1