View Full Version : Remote host header?
[fastdetect]
04-21-02, 12:41 PM
I know there is a ip header like this: <!--#echo var="REMOTE_ADDR"-->
but is there a header which will retreve a HOST NAME?????
thnxx
master7
04-21-02, 02:36 PM
<!--#echo var="REMOTE_HOST"-->
[fastdetect]
04-21-02, 07:59 PM
thnx
[fastdetect]
04-21-02, 08:30 PM
does not seems to be wroking........
here is the link:
http://df_xfiles.tripod.com/host.shtml
the source is:
<SCRIPT LANGUAGE="JavaScript">
var ht = '<!--#echo var="REMOTE_HOST"-->';
alert("Your host is "+ht);
window.defaultStatus = "Your host is "+ht;
document.write("<title>Your host is "+ht+"</title>");
</script>
just a little script to test out the header itmsays my host name is (none) ??????
prolly only works in netscape
Tony is partially correct. It can be done on all browesers, but I think SSI is needed for that. Otherwise NS is the only one that it will work corretly on.
Try this:
<script language="javascript">
var host = '<!--#echo var="REMOTE_HOST"-->'
function hostval() {
document.myform.host.value=host;
}
window.onload=hostval
</script>
<form method="post" action="" name="myform">
<input type="text" name="host" readonly>
</form>
You cannot display or have emailed the IP of an IE browser without the use of a server side app using asp, perl, php scripting or an actual c coded app.
This is how SG does it on the TCP Optimizer Page. As you can see, the actual script is in cgi-bin:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html><head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function loadurl(url) {
if (document.images)
window.location.replace(url);
else
window.location.href = url;}
//-->
</script>
<title>Connection Diagnostics</title></head><body bgcolor="white">
<SCRIPT LANGUAGE="JavaScript">
<!--
window.loadurl('http://forums.speedguide.net/cgi-bin/optd/optd.cgi?DATA_OFFSET=40&TCP_Options_string=020405b40103030201010402&IP_MTU_DISCOVER=1&WIN=64240&RWIN=256960&MSS=1460&SCALE=2&TTL=54&TSOPT=0&SACK_PERM=1&IP_TOS=0&IP=XX.XX.XX.XX×tamp=1019516484');
//--> </SCRIPT><h1>Connection parameters retrieved</h1></body> </html>
This code above is built as host.shtml on my site.
I'm sure that it can be done in pure javascript under NS. It is not supported across all browsers that way.
The code above works just fine though.
As Seen Here (http://telecomgeeks.com/Misc/host.shtml)
Everything that I have found on the net suggests that JS is not the best for doing this and that a server side scripting language is the best bet, but it can be done without ASP, PHP, or CGI.
I am also confident that the IP / Host can be e-mailed after it is turned into a variable.
That code will not work with all webhosts though. It is still dependant upon the apps installed on the server. The server must support SSI. Many do not.
This works in Netscape w/ Java enabled:
<SCRIPT LANGUAGE="JavaScript">
if ((navigator.appVersion.indexOf("4.") != -1) && (navigator.appName.indexOf("Netscape") != -1)){
ip = "" + java.net.InetAddress.getLocalHost().getHostAddress();
document.write("Your IP address is " + ip);
}
else {
document.write("IP Address only shown in Netscape with Java enabled!");
}
</script>
This will work in IE and Netscape with SSI supported server:
<SCRIPT LANGUAGE="JavaScript">
// Depending on your server set-up,
// you may need to use the ".shtml"
// extension [instead of the "html"
// or "htm"] as the script uses Server
// Side Includes. To display in the
// title bar, exclude the
//"<title></title>" code from the page.
// This part gets the IP
var ip = '<!--#echo var="REMOTE_ADDR"-->';
// This part is for an alert box
alert("Your IP address is "+ip);
// This part is for the status bar
window.defaultStatus = "Your IP address is "+ip;
// This part is for the title bar
document.write("<title>Your IP address is "+ip+"</title>");
</script>
Tony, you and I are talking apples and apples. I'm granny smith and you're golden delicious (don't read into that!) :)
We both had the right idea. JS is neutered and there is some need for an app that can handle what he is trying to do.
Bottom line is that SSI is probably needed as a minimum. I mean even sites that don't suppot perl support SSI. Then again there are some that support jack squat. Basically, I wanted him to try the code I found and see if it worked. If so, no damage done.
Anyway, I hope that he gets what he needs from what we posted. I know I learned from it and that's all that matters.
Thanks for the info BTW. Good Stuff as usual
Here's an apple pie!
Most webhosts have php installed!
<?php
$ip = $REMOTE_ADDR;
print "ip = $ip";
?>
HA! Good one!
But, I doubt that he does as he's on tripod.
Tripod Plus - Only $4.95 a Month!
Looking for the freedom to build your site without banner ads or other restrictions? Plus is your plan!
NO ADS!
25 MB of Disk Space
More Bandwidth
File Sharing
Web Folders
JavaScript & CGI Library
Easy to Use Building Tools
Page Design Templates
FREE Images
FrontPage Enabled
That's the advanced plan.
I guess the CGI solution you posted earlier would have been best.
P.S. This is the most action this forum has had all week.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.