Changeset 418


Ignore:
Timestamp:
07/02/10 17:11:30 (14 years ago)
Author:
Kris Deugau
Message:

/trunk

Shuffle pieces of admin.cgi dealing with rWHOIS customer data
to more closely match the PHP versions. This should reduce some
HTML duplication. (Preparation for #3)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/admin.cgi

    r417 r418  
    309309<form action=admin.cgi method=POST>
    310310<table border=1><tr>
    311 <input type=hidden name=action value=newcust>
     311<input type=hidden name=action value=edcust>
     312<input type=hidden name=newcust value=1>
    312313<td>CustID:</td><td><input name=custid></td>
    313 <td>Name:</td><td><input name=name></td></tr>
    314 <tr><td>Street:</td><td><input name=street></td></tr>
     314<!-- <td>Name:</td><td><input name=name></td></tr>
     315<tr><td>Street:</td><td><input name=street></td></tr> -->
    315316<!-- <td>Street2:</td><td><input name=street2></td> -->
    316 <tr><td>City:</td><td><input name=city></td>
     317<!-- <tr><td>City:</td><td><input name=city></td>
    317318<td>Province: (2-letter code)</td><td><input name=province value=ON length=2 size=2></td></tr>
    318319<tr><td>Country: (2-letter code)</td><td><input name=country value=CA length=2 size=2></td>
    319320<td>Postal/ZIP Code:</td><td><input name=pocode></td></tr>
    320 <tr><td>Phone:</td><td><input name=phone></td>
     321<tr><td>Phone:</td><td><input name=phone></td> -->
    321322<!-- <td>Default rDNS:</td><td><input name=def_rdns></td></tr>
    322323<td>Description:</td><td><input name=description></td> -->
     324<!-- </tr>
     325<tr>
    323326<td>ARIN Handles:</td><td>
    324327 Tech: <input name=tech_handle value="VH25-ORG-ARIN"><br>
     
    326329 Admin: <input name=admin_handle><br>
    327330Note:  Only tech is required at the moment.
    328 </td></tr>
    329 <tr><td colspan=4 align=center><input type=submit value="Add"></td></tr>
     331</td>
     332<td>"Special":</td><td><textarea name=special rows=4 cols=40></textarea></td>
     333</tr> -->
     334<td align=center><input type=submit value="Go to edit page for this custid"></td></tr>
    330335</form></table>
    331336);
     
    373378  } # bad custid
    374379} elsif ($webvar{action} eq 'edcust') {
     380  if ($webvar{newcust}) {
     381    print "got here?\n";
     382    $sth = $ip_dbh->prepare("INSERT INTO customers (custid) VALUES (?)");
     383    $sth->execute($webvar{custid});
     384  }
    375385  $sth = $ip_dbh->prepare("select custid,name,street,city,province,".
    376386        "country,pocode,phone,tech_handle,abuse_handle,admin_handle ".
     
    384394<td>CustID:</td><td>$custid<input type=hidden name=custid value=$custid></td>
    385395<td>Name:</td><td><input name=name value="$name"></td></tr>
    386 <tr><td>Street:</td><td><input name=street value="$street"></td></tr>
     396<tr><td>Street:</td><td><input name=street value="$street"></td>
    387397<!-- <td>Street2:</td><td><input name=street2></td> -->
    388 <tr><td>City:</td><td><input name=city value="$city"></td>
    389 <td>Province: (2-letter code)</td><td><input name=province value="$prov" length=2 size=2></td></tr>
    390 <tr><td>Country: (2-letter code)</td><td><input name=country value="$country" length=2 size=2></td>
    391 <td>Postal/ZIP Code:</td><td><input name=pocode value="$pocode"></td></tr>
    392 <tr><td>Phone:</td><td><input name=phone value="$pocode"></td>
     398<td>City:</td><td><input name=city value="$city"></td></tr>
     399<tr><td>Province/State: (2-letter code)</td><td><input name=province value="$prov" length=2 size=2></td>
     400<td>Country: (2-letter code)</td><td><input name=country value="$country" length=2 size=2></td></tr>
     401<tr><td>Postal/ZIP Code:</td><td><input name=pocode value="$pocode"></td>
     402<td>Phone:</td><td><input name=phone value="$pocode"></td></tr>
    393403<!-- <td>Default rDNS:</td><td><input name=def_rdns></td></tr>
    394404<td>Description:</td><td><input name=description></td> -->
    395 <td>ARIN Handles:</td><td>
     405<tr><td>Contacts/ARIN Handles:</td><td>
    396406 Tech: <input name=tech_handle value="$tech"><br>
    397407 Abuse: <input name=abuse_handle value="$abuse"><br>
    398408 Admin: <input name=admin_handle value="$admin"><br>
    399409Note:  Only tech is required at the moment.
    400 </td></tr>
     410</td>
     411<td>"Special":</td><td><textarea name=special rows=4 cols=40></textarea></td>
     412</tr>
    401413<tr><td colspan=4 align=center><input type=submit value="Update"></td></tr>
    402414</form></table>
     415<div style="margin-left:5px">
     416<h3>Explanation for "Special" field:</h3>
     417This is the field I've mangled into providing a custom WHOIS netname identifier for blocks tagged "SWIP".
     418It may be removed later, more likely migrated elsewhere.
     419<p>It's formatted like this, one line for each custom net name:
     420<pre>NetName[CIDR block]: NET-NAME</pre>
     421Example:
     422<pre>NetName209.91.133.0/24: CYBERSUDBURY-1</pre>
     423Note:
     424<ul style="margin-top: 0px;">
     425<li>Spacing is important - there should only be ONE space, in between the colon and the net name.
     426<li>The CIDR block name nust include all four octets - no short forms are accepted.
     427<li>Net names must be all uppercase, and consist only of A-Z, 0-9, and - (same as for SWIPed net names).
     428</ul>
     429</div>
    403430);
    404431
    405432} elsif ($webvar{action} eq 'updcust') {
    406   print "Updated $webvar{custid}\n";
     433  $sth = $ip_dbh->prepare("UPDATE customers SET".
     434        " name=?, street=?, city=?, province=?, country=?, pocode=?,".
     435        " phone=?, tech_handle=?, abuse_handle=?, admin_handle=?, special=?".
     436        " WHERE custid=?");
     437  $sth->execute($webvar{name}, $webvar{street}, $webvar{city}, $webvar{province},
     438        $webvar{country}, $webvar{pocode}, $webvar{phone}, $webvar{tech_handle},
     439        $webvar{abuse_handle}, $webvar{admin_handle}, $webvar{special}, $webvar{custid});
     440  print "Updated $webvar{custid}<br>\n".
     441        qq(<table border=1>
     442<tr><td>CustID:</td><td>$webvar{custid}</td></tr>
     443<tr><td>Name:</td><td>$webvar{name}</td></tr>
     444<tr><td>Street:</td><td>$webvar{street}</td></tr>
     445<tr><td>City:</td><td>$webvar{city}</td></tr>
     446<tr><td>Province/State:</td><td>$webvar{province}</td></tr>
     447<tr><td>Country:</td><td>$webvar{country}</td></tr>
     448<tr><td>Postal/ZIP Code:</td><td>$webvar{pocode}</td></tr>
     449<tr><td>Phone:</td><td>$webvar{phone}</td></tr>
     450<!-- <td>Default rDNS:</td><td>$webvar{def_rdns}</td></tr> -->
     451<tr><td>Contacts/ARIN Handles:</td><td>
     452 Tech: $webvar{tech_handle}<br>
     453 Abuse: $webvar{abuse_handle}<br>
     454 Admin: $webvar{admin_handle}<br>
     455</td></tr>
     456<tr><td>"Special":</td><td><textarea name=special rows=4 cols=40>$webvar{special}</textarea></td></tr>
     457</table>
     458<a href="admin.cgi?action=listcust">Back</a> to rWHOIS customer list<br>\n);
     459
    407460} elsif ($webvar{action} eq 'showpools') {
    408461  print "IP Pools currently allocated:\n".
Note: See TracChangeset for help on using the changeset viewer.