Forum Moderators: bakedjake

Message Too Old, No Replies

Pop up message for visitor from IP Address

how to create a pop up message from a particular IP address

         

Huntress

2:34 am on Oct 22, 2004 (gmt 0)

10+ Year Member



I'm a new member and relatively new at hosting my own server. I was wondering is there a way to get a message to pop up when someone from an IP with #*$!.xxxx.xx to automatically display when that person enters the site?

Any help would be helpful. I run a Linux server.

Thanks

Nutter

9:14 pm on Oct 22, 2004 (gmt 0)

10+ Year Member



I'm thinking you could have a server side script echo a javascript alert("Hey, here's my message") if the ip address is right. There may be a pure JS way to do it, too. You might check in that forum.

- Ryan

Span

9:19 am on Oct 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



With SSI enabled this should work:


<!--#set var="ip" value="$REMOTE_ADDR" -->
<!--#if expr="$ip = /123.123.123.123/" -->
<script type="text/javascript">
window.alert("Welcome to the forums, Huntress.");
</script>
<!--#endif -->

Huntress

7:24 pm on Oct 24, 2004 (gmt 0)

10+ Year Member



Ryan does the page have to be shtml for this to work?
or can it work if it's php?

Thanks

Huntress

Huntress

7:26 pm on Oct 24, 2004 (gmt 0)

10+ Year Member



<!--#set var="ip" value="$REMOTE_ADDR" -->
<!--#if expr="$ip = /123.123.123.123/" -->
<script type="text/javascript">
window.alert("Welcome to the forums, Huntress.");
</script>
<!--#endif -->

This goes between <head> and </head> and can I have this in a php file?

Thanks Span

Span

8:30 pm on Oct 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No.. that's supposed to go in a server parsed (s)htm(l) file. Something similar should be possible with PHP, I guess, but I don't know how. Try asking in the PHP forum.

mincklerstraat

1:46 pm on Nov 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



try:

<?php
if($_SERVER['REMOTE_ADDR'] == '123.123.123.123'){
echo '<script type="text/javascript">
window.alert("Welcome to the forums, Huntress.");
</script>';
}
?>