help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • FiremanSAM

    help

    <?php
    $ip = $_SERVER['REMOTE_ADDR'];

    $bestand = "ipblock.tx t";
    $iparray = file("ipblock.t xt");

    $ans = array_search($i p, $iparray);

    if ($ans == $ip) {

    print(" ");
    print("<div align='center'> <font face='Geneva, Arial, Helvetica,
    sans-serif'><strong> Your ip [$ip] has
    been suspended as a result of your actions on this
    website</strong></font></div>");
    print ("<div align='center'> <font face='Geneva, Arial, Helvetica,
    sans-serif'><strong>--------------------------------------------------------
    -</strong></font></div>");
    }
    else {

    $db = mysql_connect(" localhost","use r","password ");
    ....etc

    Why does this not work?? And in which format must i add ip adresses into the
    file??

    FiremanSAM


  • Pedro

    #2
    Re: help

    FiremanSAM wrote:
    [...][color=blue]
    > $ans = array_search($i p, $iparray);
    >
    > if ($ans == $ip) {[/color]
    [...][color=blue]
    >Why does this not work?? And in which format must i add ip adresses into the
    >file??[/color]

    After reading http://www.php.net/array_search the first reason that
    comes to mind is that you're comparing the array index ($ans) to the
    array value ($ip). Check that you compare "comparable " things!

    I think the file should have something like
    10.11.12.13
    10.43.76.109



    Happy Coding :-)


    --
    I have a spam filter working.
    To mail me include "urkxvq" (with or without the quotes)
    in the subject line, or your mail will be ruthlessly discarded.

    Comment

    Working...