Click to See Complete Forum and Search --> : why doesen't this work???!!!


jakykong
08-07-2003, 04:13 AM
in response to the request in the javascript source's ip address filter(under user details), asking for a workaround for internet explorer, i've been working with that script and the one above it, ip address, merging them together to try to make an all-browser script. so far, i know that the line of code,

var ip = "<!--#echo var="REMOTE_ADDR"-->"

should obtain the ip address for IE and netscape(works at the javascript source). this was what i had hoped to implement in the process of merging the two scripts to make one. what i have posted below is what i am at right now, placed in the head of the document, i am unshure why it does not work. Any and all help is greatly apreciated, and i think it may just be brinkster's server, but i am posting here to make shure. Thanks to all who can help.


<SCRIPT LANGUAGE="JavaScript">
var ip = "<!--#echo var="REMOTE_ADDR"-->"
if (ip.indexOf("12.211") >= -1)
// This would block anyone from 207.136.xxx.xxx

{
alert("You are not permitted to access this site.");
history.go(-1);
}

// End -->
</script>

AdamGundry
08-07-2003, 04:50 AM
The code <!--#echo var="REMOTE_ADDR"--> uses SSI (server-side includes), which have to be enabled on the server (usually by naming the document with a .shtml extension). I believe Brinkster uses ASP instead, which should be able to perform the same command, but I don't know ASP - you could ask in that forum.

Javascript on its own cannot get the IP address to the best of my knowledge.

Adam

jakykong
08-07-2003, 05:14 AM
thanks. i didn't figure javascript could get an IP mostly because it is a client-side script and that is a server operation. ssi was mentioned in the description for the script that used that. i know that brinkster has ASP enabled, but i am not shure about ssi. i'll have to check, in the mean time, i'll ask about the include-type command in the asp board. thanks again.