<?php
/* add-alloc.php
** Quick hack to allow manual editing of data in postgres:via_ipdb:allocations table
**   -> add allocation to table
** 07/13/2004 kdeugau@vianet
*/
  $dbh = pg_connect("dbname=ipdb user=ipdb");

  $maskbits = explode("/", $cidr);

  $qu = pg_exec($dbh, "delete from freeblocks where cidr='$cidr'");
  $qu = pg_exec($dbh, "insert into allocations values ".
	"('$cidr','$custid','$alloctype','$city','$desc','$notes',$maskbits[1])");
  if (!$qu) {
    print "INSERT failed.  Check data and db.";
  } else {
    header("Location: http://".$HTTP_SERVER_VARS['HTTP_HOST'].
	"/ip/cgi-bin/edit-alloc.php");
  }
?>
