...

View Full Version : Resolved Emergency! - Visiter IP Script Gone



embeebutterly
08-29-2011, 12:46 AM
Hi guys, this is urgent, my whole site depends on it really!

I have been using a script that was here
http://scripts.hashemian.com/js/visitorIPHOST.js.php




BUT NOW ITS GONE!!!:eek:




Some of you may be aware of it.

What it was, was a script to read ip address and i used it alot do decide what info was shown to who on my site. I know it was stupid to depend on an outside script but i have learned from my mistake.

The problem is, WHAT DO I DO NOW????

An example of my code is :


<script language="JavaScript">
VIH_ForeColor = "navy";
VIH_FontPix = "16";
VIH_DisplayFormat = "%%IP%%";
VIH_DisplayOnPage = "no";
</script>
<script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script>

<script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script>
<script>
if (VIH_HostIP == "111.111.111" || VIH_HostIP ==


well you get the point


Please help me as my site is gone to sh1t now and wont even load for most....


Thanks in advance

webdev1958
08-29-2011, 12:54 AM
BUT NOW ITS GONE!!!:eek:

The problem is, WHAT DO I DO NOW????


Restore it from your backups?

embeebutterly
08-29-2011, 01:08 AM
It was an external script..... i was using it from an external site

Old Pedant
08-29-2011, 01:18 AM
His site is *NOT* hashemian.com. It's a foreign-to-him site, that was, essentially, giving him a web service that told him the IP address of a visitor.

***********

embee: It's really a pretty simple-minded task to create a PHP or ASP or JSP server-side script/code that will do this for you.

I don't know what all those variables in your code controlled in that external script:


VIH_ForeColor = "navy";
VIH_FontPix = "16";
VIH_DisplayFormat = "%%IP%%";
VIH_DisplayOnPage = "no";

But I'm *guessing* that the DisplayOnPage = "no" means that all you really wanted the script to do was plunk the IP address into the JavaScript variable VIM_HostIP

If you have ASP capabilities on your site, then you could do that thus:

Create a file named getIPAddress.asp that has just this code in it:


var VIM_HostIP = "<%=Request.ServerVariables("REMOTE_ADDR")%>";

and then in your HTML page you just do


<script type="text/javascript" src="getIPAddress.asp"></script>


I'm not a PHP person, but I *THINK* the PHP equivalent would to create a file named getIPAddress.php that has just this code:


<?php
echo 'var VIM_HostIP = "' . $_SERVER["REMOTE_ADDR"] . '";';
?>

and then use

<script type="text/javascript" src="getIPAddress.php"></script>
in your HTML.

But, of course, you would need to have a host that offers you either ASP or PHP to make one of those work.

embeebutterly
08-29-2011, 01:36 AM
thank you a million times over Sir Old Pedant! dthis is perfect, simple and is about to restore my site to normal working order, plus, i no longer have to rely on an outside script. Thank you very much!

Old Pedant
08-29-2011, 01:46 AM
Don't thank me until it works!

webdev1958
08-29-2011, 01:54 AM
It was an external script..... i was using it from an external site

oh ok, I thought you were saying you got the actual code from an eternal site, not actually linking to it which is a dangerous thing to do as you have found out.

embeebutterly
08-29-2011, 01:58 AM
Don't thank me until it works!


I tested it mate it works! Your a lightsaber!

_______________________________________________

For anyone reading this (and for search engine)

What i use to get the users IP address is a php file with the following:


<?php
echo 'var VIM_HostIP = "' . $_SERVER["REMOTE_ADDR"] . '";';
?>

Thank you once again Old Pedant :thumbsup:

Old Pedant
08-29-2011, 02:22 AM
Good. Was doing minor guessing on the PHP code, but the docs seemed clear enough. And the analogy to ASP is pretty easy to see.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum