[Release] Codes for anti injections

Results 1 to 3 of 3
  1. #1
    Member Hamtaro is offline
    MemberRank
    Jun 2010 Join Date
    31Posts

    [Release] Codes for anti injections

    This is my SQL anti injection for people out there that didnt know how to secured their registration panel.

    <?php
    // Begin
    function xw_sanitycheck($str){
    if(strpos(str_replace("''",""," $str"),"'")!=false)
    return str_replace("'", "''", $str);
    else
    return $str;
    }

    function secure($str){
    // Case of an array
    if (is_array($str)) {
    foreach($str AS $id => $value) {
    $str[$id] = secure($value);
    }
    }
    else
    $str = xw_sanitycheck($str);

    return $str;
    }

    // Get Filter
    $xweb_AI = array_keys($_GET);
    $i=0;
    while($i<count($xweb_AI)) {
    $_GET[$xweb_AI[$i]]=secure($_GET[$xweb_AI[$i]]);
    $i++;
    }
    unset($xweb_AI);

    // Request Filter
    $xweb_AI = array_keys($_REQUEST);
    $i=0;
    while($i<count($xweb_AI)) {
    $_REQUEST[$xweb_AI[$i]]=secure($_REQUEST[$xweb_AI[$i]]);
    $i++;
    }
    unset($xweb_AI);

    // Post Filter
    $xweb_AI = array_keys($_POST);
    $i=0;
    while($i<count($xweb_AI)) {
    $_POST[$xweb_AI[$i]]=secure($_POST[$xweb_AI[$i]]);
    $i++;
    }

    // Cookie Filter (do we have a login system?)
    $xweb_AI = array_keys($_COOKIE);
    $i=0;
    while($i<count($xweb_AI)) {
    $_COOKIE[$xweb_AI[$i]]=secure($_COOKIE[$xweb_AI[$i]]);
    $i++;
    }

    <?
    Push thank if i helped
    Last edited by Hamtaro; 03-07-10 at 10:55 AM.


  2. #2
    One word! Im Fawkin Pro! Xakzi is offline
    Grand MasterRank
    Jul 2010 Join Date
    SwedenLocation
    1,356Posts

    Re: [Release] Codes for anti injections

    i have seen alot of secured script for different stuff, i am sorry to say that this one does not seem like one of that kind Dx anyways, i dont have a web to try it out :p

  3. #3
    Member Hamtaro is offline
    MemberRank
    Jun 2010 Join Date
    31Posts

    Re: [Release] Codes for anti injections

    Well you can try it out if you didnt believe that is a secured codes



Advertisement