More than 1 ip address

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coolgames
    New Member
    • Oct 2007
    • 168

    More than 1 ip address

    Hello all, ip0.txt contains the *list* of ip's but, the system only takes 1 ip. (if i put in more than 1 ip, it says error)
    so, is there anyway i can split the ip's?

    00.00.00.000, 00.xx.xx.xxx, etc....
    can someone make the below code so it takes more than 1 ip (seperated by a ;)

    thanks (=
    [php]$ip = fopen("/home/yuvoo/public_html/uzumakionline/ip0.txt", "r");
    if ($ip) {
    while (!feof($ip)) {
    $line = fgets($ip, 4096);
    if($_SERVER['REMOTE_ADDR'] != $line)
    {
    exit('|PROXY|PR OXY|');
    }}
    }fclose($ip);
    }[/php]
    Last edited by ronverdonk; Apr 7 '08, 09:13 AM. Reason: warning: use code tags!
  • coolsti
    Contributor
    • Mar 2008
    • 310

    #2
    I see nothing wrong in the logic that you are using. However, if you use some good coding practice (and not by shy by using an excessive amount of lines in your script code) then you can rewrite your code to look like below:

    Code:
    $ip = fopen("/home/yuvoo/public_html/uzumakionline/ip0.txt", "r");
    if ($ip) 
    {
        while (!feof($ip)) 
        {
             $line = fgets($ip, 4096);
             if  ($_SERVER['REMOTE_ADDR'] != $line)
             {
                    exit('|PROXY|PROXY|');
             }
        }
        }  // Syntax error, extra bracket!
        fclose($ip);
    }
    When you do this, it will immediately become obvious that you have an extra closing bracket in your script.

    Is this maybe your problem? Or did the extra bracket come when you typed the example into your post?

    Steve, Denmark

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      coolgames

      Warning: As a full member now, you should know that we expect your code to be posted in [CODE] tags (See How to Ask a Question).

      This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

      Please use the tags in future.

      MODERATOR.

      Comment

      • coolgames
        New Member
        • Oct 2007
        • 168

        #4
        Originally posted by ronverdonk
        coolgames
        Sorry, and coolsti, coming to your reply...

        yes, that bracket is there because of the code before this (= sorry i didn't post it since the top part is way too long.

        yes, but how can i *explode* the lps? so that the system realises

        xx.xx.xxx.xx ; xx.xx.xxx.XX are 2 different ip's, not one weird one.

        Comment

        Working...