source: branches/stable/cgi-bin/list-cust.php@ 343

Last change on this file since 343 was 343, checked in by Kris Deugau, 18 years ago

/trunk

Add quick PHP bits to add/update/delete customer data for rWHOIS export

  • Property svn:keywords set to Date Rev Author Id
File size: 2.3 KB
Line 
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: 2006-08-10 20:18:49 +0000 (Thu, 10 Aug 2006) $
8** SVN revision $Rev: 343 $
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<?
29 $db_conn = pg_connect("dbname=ipdb user=ipdb password=ipdbpwd");
30
31 if (!$db_conn) {
32 echo ("<H1>Failed connection to db ipdb. Can't continue.</H1>");
33 exit;
34 }
35
36 $qu = pg_exec ($db_conn, "SELECT * FROM customers order by custid");
37
38 if (!$qu) {
39 echo "DB error - select on customers. Save this page and tell Kris.<BR>";
40 }
41
42 print "<br>".pg_NumRows($qu)." customers.\n";
43
44 echo "<table border=2 cellpadding=2>";
45 echo "<tr><td width=150>CustID<br>(Click to update)</td>".
46 "<td>Name</td>".
47 "<td>Street address</td>".
48 "<td>Address 2<br>(if needed)</td>".
49 "<td>City</td>".
50 "<td>Province</td>".
51 "<td>Country</td>".
52 "<td>Postal code</td>".
53 "<td>Phone</td>".
54 "<td>Tech handle</td>".
55 "<td>Abuse handle</td>".
56 "<td>Admin handle</td>".
57 "<td>Default rDNS<br>(not used)</td>".
58 "<td>\"Special\"</td></tr>\n";
59
60 $row = 0;
61 for ($row=0; $row < pg_NumRows($qu); $row++) {
62 $data = pg_fetch_array($qu, $row);
63 echo '<tr><td><a href="editcust.php?custid='.$data[0].'&newcust=0">'.$data[0]."</a> &nbsp; ".
64 '<a href="updatecust.php?custid='.$data[0].'&deletecust=1">(delete)</a></td>'.
65 "<td>$data[1]</td>".
66 "<td>$data[2]</td>".
67 "<td>$data[3]</td>".
68 "<td>$data[4]</td>".
69 "<td>$data[5]</td>".
70 "<td>$data[6]</td>".
71 "<td>$data[7]</td>".
72 "<td>$data[8]</td>".
73 "<td>$data[9]</td>".
74 "<td>$data[10]</td>".
75 "<td>$data[11]</td>".
76 "<td>$data[12]</td>".
77 "<td>$data[13]</td></tr>\n";
78 }
79 echo "</table><br>\n";
80
81?>
82</body>
83</html>
Note: See TracBrowser for help on using the repository browser.