source: trunk/cgi-bin/list-cust.php@ 416

Last change on this file since 416 was 398, checked in by Kris Deugau, 15 years ago

/trunk

Merge add (r343) and updates (r392 and r393) to quick-hack PHP
customer info editor scripts. See #13.

  • Property svn:keywords set to Date Rev Author Id
File size: 2.4 KB
RevLine 
[343]1<?php
2/* list-cust.php
3** List customer data in customers table, and allow editing, adding. Delete
4** is sort of a null action and might Break Things.
5*****
6** SVN revision info
7** $Date: 2010-05-11 18:56:06 +0000 (Tue, 11 May 2010) $
8** SVN revision $Rev: 398 $
9** Last update by $Author: kdeugau $
10*****
11** Copyright (C) 2006 - Kris Deugau
12*/
13?>
14<html><head>
15<title>[IPDB admin] Customer data for rWHOIS export</title>
16</head>
17<body>
18<h2>Customer data for rWHOIS export</h2>
19<a href="/ip/cgi-bin/admin.cgi">Back</a> to admin
20<p><li>Click the CustID to edit information
21<li>Enter information below to add a new entry - it's best if this is done **BEFORE** flipping the "SWIP" option
22on the netblock.
23<form action=editcust.php method=POST>
24CustID:<input name=custid>
25<input type=submit value="Go to edit page for new customer">
26<input type=hidden name=newcust value=1>
27</form>
28<?
[398]29 $db_conn = pg_connect("dbname=ipdb user=ipdb password=ipdbpwd host=ipdb-db");
[343]30
31 if (!$db_conn) {
32 echo ("<H1>Failed connection to db ipdb. Can't continue.</H1>");
[398]33 echo "db err: ". pg_last_error() ."\n";
[343]34 exit;
35 }
36
37 $qu = pg_exec ($db_conn, "SELECT * FROM customers order by custid");
38
39 if (!$qu) {
40 echo "DB error - select on customers. Save this page and tell Kris.<BR>";
41 }
42
43 print "<br>".pg_NumRows($qu)." customers.\n";
44
45 echo "<table border=2 cellpadding=2>";
46 echo "<tr><td width=150>CustID<br>(Click to update)</td>".
47 "<td>Name</td>".
48 "<td>Street address</td>".
49 "<td>Address 2<br>(if needed)</td>".
50 "<td>City</td>".
51 "<td>Province</td>".
52 "<td>Country</td>".
53 "<td>Postal code</td>".
54 "<td>Phone</td>".
55 "<td>Tech handle</td>".
56 "<td>Abuse handle</td>".
57 "<td>Admin handle</td>".
58 "<td>Default rDNS<br>(not used)</td>".
59 "<td>\"Special\"</td></tr>\n";
60
61 $row = 0;
62 for ($row=0; $row < pg_NumRows($qu); $row++) {
63 $data = pg_fetch_array($qu, $row);
64 echo '<tr><td><a href="editcust.php?custid='.$data[0].'&newcust=0">'.$data[0]."</a> &nbsp; ".
65 '<a href="updatecust.php?custid='.$data[0].'&deletecust=1">(delete)</a></td>'.
66 "<td>$data[1]</td>".
67 "<td>$data[2]</td>".
68 "<td>$data[3]</td>".
69 "<td>$data[4]</td>".
70 "<td>$data[5]</td>".
71 "<td>$data[6]</td>".
72 "<td>$data[7]</td>".
73 "<td>$data[8]</td>".
74 "<td>$data[9]</td>".
75 "<td>$data[10]</td>".
76 "<td>$data[11]</td>".
77 "<td>$data[12]</td>".
78 "<td>$data[13]</td></tr>\n";
79 }
80 echo "</table><br>\n";
81
82?>
83</body>
84</html>
Note: See TracBrowser for help on using the repository browser.