1 | <?php
|
---|
2 | /* editcust.php
|
---|
3 | ** Show customer data in form for editing.
|
---|
4 | *****
|
---|
5 | ** SVN revision info
|
---|
6 | ** $Date: 2006-08-10 20:18:49 +0000 (Thu, 10 Aug 2006) $
|
---|
7 | ** SVN revision $Rev: 343 $
|
---|
8 | ** Last update by $Author: kdeugau $
|
---|
9 | *****
|
---|
10 | ** Copyright (C) 2006 - Kris Deugau
|
---|
11 | */
|
---|
12 | ?>
|
---|
13 | <html><head>
|
---|
14 | <title>[IPDB admin] Edit customer data for rWHOIS export</title>
|
---|
15 | </head>
|
---|
16 | <body>
|
---|
17 | <h2>Edit customer data for rWHOIS export</h2>
|
---|
18 | <a href="/ip/cgi-bin/admin.cgi">Back</a> to admin<br>
|
---|
19 | <a href="/ip/cgi-bin/list-cust.php">Back</a> to WHOIS customer list
|
---|
20 | <form action=updatecust.php method=post>
|
---|
21 | <?
|
---|
22 | $db_conn = pg_connect("dbname=ipdb user=ipdb password=ipdbpwd");
|
---|
23 |
|
---|
24 | if (!$db_conn) {
|
---|
25 | echo ("<H1>Failed connection to db ipdb. Can't continue.</H1>");
|
---|
26 | exit;
|
---|
27 | }
|
---|
28 |
|
---|
29 | // snag form data into local vars. Not being excessively paranoid because we're
|
---|
30 | // buried deep and this is a hack anyway.
|
---|
31 | $newcust = $_REQUEST['newcust'];
|
---|
32 | $custid = $_REQUEST['custid'];
|
---|
33 |
|
---|
34 | if ($newcust==1) {
|
---|
35 | echo "New customer. Creating blank record in the database...\n";
|
---|
36 | $qu = pg_exec ($db_conn, "INSERT INTO customers (custid) VALUES ('$custid')");
|
---|
37 | }
|
---|
38 |
|
---|
39 | $qu = pg_exec ($db_conn, "SELECT * FROM customers WHERE custid='$custid'");
|
---|
40 | if (!$qu) {
|
---|
41 | echo "DB error - select on customers. Save this page and tell Kris.<BR>";
|
---|
42 | }
|
---|
43 |
|
---|
44 | $data = pg_fetch_array($qu, 0);
|
---|
45 |
|
---|
46 | echo "<table border=2 cellpadding=2>".
|
---|
47 | "<tr><td align=right>CustID</td><td>$data[0]<input type=hidden name=custid value=$data[0]></td></tr>\n".
|
---|
48 | "<tr><td>Name</td><td><input name=name value=\"$data[1]\"></td></tr>\n".
|
---|
49 | "<tr><td>Street address</td><td><input name=addr1 value=\"$data[2]\"></td></tr>\n".
|
---|
50 | "<tr><td>Address 2</td><td><input name=addr2 value=\"$data[3]\"></td></tr>\n".
|
---|
51 | "<tr><td>City</td><td><input name=city value=\"$data[4]\"></td></tr>\n".
|
---|
52 | "<tr><td>Province</td><td><input name=prov value=\"$data[5]\"></td></tr>\n".
|
---|
53 | "<tr><td>Country</td><td><input name=country value=\"$data[6]\"></td></tr>\n".
|
---|
54 | "<tr><td>Postal code</td><td><input name=pocode value=\"$data[7]\"></td></tr>\n".
|
---|
55 | "<tr><td>Phone</td><td><input name=phone value=\"$data[8]\"></td></tr>\n".
|
---|
56 | "<tr><td>Tech handle</td><td><input name=tech value=\"$data[9]\"></td></tr>\n".
|
---|
57 | "<tr><td>Abuse handle</td><td><input name=abuse value=\"$data[10]\"></td></tr>\n".
|
---|
58 | "<tr><td>Admin handle</td><td><input name=admin value=\"$data[11]\"></td></tr>\n".
|
---|
59 | "<tr><td>Default rDNS</td><td><input name=rdns value=\"$data[12]\"></td></tr>\n".
|
---|
60 | "<tr><td>\"Special\"</td><td><textarea name=special rows=4 cols=40>$data[13]</textarea></td></tr>\n".
|
---|
61 | '<tr><td colspan=2 align=center><input type=submit value="Add/update customer data"></td></tr>'.
|
---|
62 | "\n</table></form><br>\n";
|
---|
63 |
|
---|
64 | ?>
|
---|
65 | <h3>Explanation for "Special" field:</h3>
|
---|
66 | This is the field I've mangled into providing a custom WHOIS netname identifier for blocks tagged "SWIP".
|
---|
67 | It may be removed later.
|
---|
68 | <p>It's formatted like this, one line for each custom net name:
|
---|
69 | <pre>NetName[CIDR block]: NET-NAME</pre>
|
---|
70 | Example:
|
---|
71 | <pre>NetName209.91.133.0/24: CYBERSUDBURY-1</pre>
|
---|
72 | Note:
|
---|
73 | <li>Spacing is important - there should only be ONE space, in between the colon and the net name.
|
---|
74 | <li>The CIDR block name nust include all four octets - no short forms are accepted.
|
---|
75 | <li>Net names must be all uppercase, and consist only of A-Z, 0-9, and - (same as for SWIPed net names).
|
---|
76 | </body>
|
---|
77 | </html>
|
---|