source: branches/stable/cgi-bin/editcust.php@ 393

Last change on this file since 393 was 393, checked in by Kris Deugau, 14 years ago

/branches/stable

Use host=ipdb-db in PHP pages so live version can connect to db

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