Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    82
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Exclamation Emergency! - Visiter IP Script Gone

    Hi guys, this is urgent, my whole site depends on it really!

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



    BUT NOW ITS GONE!!!





    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 :

    Code:
    <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
    Last edited by embeebutterly; 08-29-2011 at 01:37 AM.

  • #2
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    Quote Originally Posted by embeebutterly View Post

    BUT NOW ITS GONE!!!


    The problem is, WHAT DO I DO NOW????
    Restore it from your backups?

  • #3
    New Coder
    Join Date
    Jan 2011
    Posts
    82
    Thanks
    9
    Thanked 0 Times in 0 Posts
    It was an external script..... i was using it from an external site

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,561
    Thanks
    80
    Thanked 4,496 Times in 4,460 Posts
    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:
    Code:
    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:
    Code:
    var VIM_HostIP = "<%=Request.ServerVariables("REMOTE_ADDR")%>";
    and then in your HTML page you just do
    Code:
    <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:
    Code:
    <?php
    echo 'var VIM_HostIP = "' . $_SERVER["REMOTE_ADDR"] . '";';
    ?>
    and then use
    Code:
    <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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    embeebutterly (08-29-2011)

  • #5
    New Coder
    Join Date
    Jan 2011
    Posts
    82
    Thanks
    9
    Thanked 0 Times in 0 Posts
    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!

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,561
    Thanks
    80
    Thanked 4,496 Times in 4,460 Posts
    Don't thank me until it works!
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #7
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    Quote Originally Posted by embeebutterly View Post
    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.

  • #8
    New Coder
    Join Date
    Jan 2011
    Posts
    82
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    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 Code:
    <?php
    echo 'var VIM_HostIP = "' $_SERVER["REMOTE_ADDR"] . '";';
    ?>
    Thank you once again Old Pedant

  • #9
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,561
    Thanks
    80
    Thanked 4,496 Times in 4,460 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •