help on htaccess

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    help on htaccess

    im not a newby in coding but am stuck i have made a htaccess script that will log an attempted sqli attack email it to u and log it in a .txt page.

    now what i need help in is some sort of htaccess code that will just select the ips from that .txt page

    if anyone has an idea on howto do this any input will be highly regarded tried searching google for examples but no luck just how to ban an ip in the actual htaccess not from a external page









    Dont Ask Me Dumb Questions.Or you'l get a Dumb Answer..
    Want A Profesional Logo or Theme For Your wap site Pm Me.If I Have The Time Ill Make It For Free


    #2
    Im not sure that htaccess can read from file bro. Whats the idea with it?
    Maybe php to read from that txt and write it to htaccess?
    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

    Comment


      #3
      well ive made it so any sqli attempt is logged to a text file with browser ip and command they used it then emails u a copy of the log it would be kool if htaccess could be used to list those logged ips as an auto ip bann to the server automatically im sure theres a way to do it









      Dont Ask Me Dumb Questions.Or you'l get a Dumb Answer..
      Want A Profesional Logo or Theme For Your wap site Pm Me.If I Have The Time Ill Make It For Free

      Comment


        #4
        think i may have found my solution

        Code:
        <?php
        
        $ip = "deny from $REMOTE_ADDR\n" ;
        $banip = '.htaccess';
        $fp = fopen($banip, "a");
        $write = fputs($fp, $ip);
        fclose($fp);
        
        //@ symbol hides errors from visitors
        @mail('you@yourdmain.whatever',
        'Banned IP '.$_SERVER['REMOTE_ADDR'].
        ' at '.$_SERVER['HTTP_REFERER'],
        ' IP '.$_SERVER['REMOTE_ADDR'].' banned'.
        ' request URI '.$_SERVER['REQUEST_URI'].
        ' referrer '.$_SERVER['HTTP_REFERER'].
        ' agent '.$_SERVER['HTTP_USER_AGENT'].
        ?>
        this will write the ip to ban onto the htaccess file if it chmodded to 666 oh and email u the ban log
        Last edited by ozziemale31; 24.01.12, 08:05.









        Dont Ask Me Dumb Questions.Or you'l get a Dumb Answer..
        Want A Profesional Logo or Theme For Your wap site Pm Me.If I Have The Time Ill Make It For Free

        Comment

        Working...
        X