Ignore:
Timestamp:
07/27/10 13:56:39 (14 years ago)
Author:
Kris Deugau
Message:

/branches/htmlform

Escape forwarded form data with $q->escapeHTML on most forms in
main.cgi (see #15)
Fix up most subs in IPDB.pm that deal with form data that needs
escaping (see #34)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/htmlform/cgi-bin/IPDB.pm

    r443 r448  
    347347      $cidr = $data[0];  # $cidr is already declared when we get here!
    348348
    349       $sth = $dbh->prepare("update poolips set custid='$custid',".
    350         "city='$city',available='n',description='$desc',notes='$notes',".
    351         "circuitid='$circid',privdata='$privdata'".
    352         " where ip='$cidr'");
    353       $sth->execute;
     349      $sth = $dbh->prepare("update poolips set custid=?,city=?,".
     350        "available='n',description=?,notes=?,circuitid=?,privdata=?".
     351        " where ip=?");
     352      $sth->execute($custid, $city, $desc, $notes, $circid, $privdata, "$cidr");
    354353# node hack
    355354      if ($nodeid && $nodeid ne '') {
     
    399398          $sth = $dbh->prepare("insert into allocations".
    400399                " (cidr,custid,type,city,description,notes,maskbits,circuitid,privdata)".
    401                 " values ('$cidr','$custid','$type','$city','$desc','$notes',".
    402                 $cidr->masklen.",'$circid','$privdata')");
    403           $sth->execute;
     400                " values (?,?,?,?,?,?,?,?,?)");
     401          $sth->execute("$cidr", $custid, $type, $city, $desc, $notes, $cidr->masklen, $circid, $privdata);
    404402
    405403          # And initialize the pool, if necessary
     
    509507          $sth = $dbh->prepare("insert into allocations (cidr,custid,type,city,".
    510508                "description,notes,maskbits,circuitid,privdata)".
    511                 " values ('$cidr','$custid','$type','$city','$desc','$notes',".
    512                 $cidr->masklen.",'$circid','$privdata')");
    513           $sth->execute;
     509                " values (?,?,?,?,?,?,?,?,?)");
     510          $sth->execute("$cidr", $custid, $type, $city, $desc, $notes, $cidr->masklen, $circid, $privdata);
    514511
    515512          # And initialize the pool, if necessary
     
    633630    eval {
    634631      $msg = "Unable to deallocate $disp_alloctypes{$type} $cidr";
    635       $sth = $dbh->prepare("update poolips set custid='$defcustid',available='y',".
    636         "city=(select city from allocations where cidr >>= '$cidr'".
     632      $sth = $dbh->prepare("update poolips set custid=?,available='y',".
     633        "city=(select city from allocations where cidr >>= ?".
    637634        " order by masklen(cidr) desc limit 1),".
    638         "description='',notes='',circuitid='' where ip='$cidr'");
    639       $sth->execute;
     635        "description='',notes='',circuitid='' where ip=?");
     636      $sth->execute($defcustid, "$cidr", "$cidr");
    640637      $dbh->commit;
    641638    };
Note: See TracChangeset for help on using the changeset viewer.