source: branches/stable/cgi-bin/updatecust.php@ 395

Last change on this file since 395 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.7 KB
RevLine 
[343]1<?php
2/* updatecust.php
3** Stuff updated cust data into db
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 $db_conn = pg_connect("dbname=ipdb user=ipdb password=ipdbpwd");
14
15 if (!$db_conn) {
16 echo ("<H1>Failed connection to db ipdb. Can't continue.</H1>");
17 exit;
18 }
19
20 $custid = $_REQUEST['custid'];
21 if (isset($_REQUEST['deletecust'])) {
22 print "<html><head><title>Deleting $custid from WHOIS</title></head><body>\n".
23 "<h2>Deleting $custid from WHOIS</h2>\n".
24 "<a href=\"/ip/cgi-bin/admin.cgi\">Back</a> to admin<br>\n".
25 "<a href=\"/ip/cgi-bin/list-cust.php\">Back</a> to WHOIS customer list\n";
26 $qu = pg_exec ("DELETE FROM customers WHERE custid='$custid'");
27 if (!$qu) {
28 print "Error deleting $custid. Mail Kris.\n";
29 }
30 print "</body></html>\n";
31 exit;
32 }
33?>
34<html><head>
35<title>[IPDB admin] Updating WHOIS data</title>
36</head>
37<body>
38<h2>Updating WHOIS data for <? print $custid; ?></h2>
39<a href="/ip/cgi-bin/admin.cgi">Back</a> to admin<br>
40<a href="/ip/cgi-bin/list-cust.php">Back</a> to WHOIS customer list
41<?
42
43// snag form data into local vars. Not being excessively paranoid because we're
44// buried deep and this is a hack anyway.
45
46 $name = $_REQUEST['name'];
47 $addr1 = $_REQUEST['addr1'];
48 $addr2 = $_REQUEST['addr2'];
49 $city = $_REQUEST['city'];
50 $prov = $_REQUEST['prov'];
51 $country = $_REQUEST['country'];
52 $pocode = $_REQUEST['pocode'];
53 $phone = $_REQUEST['phone'];
54 $tech = $_REQUEST['tech'];
55 $abuse = $_REQUEST['abuse'];
56 $admin = $_REQUEST['admin'];
57 $rdns = $_REQUEST['rdns'];
58 $special = $_REQUEST['special'];
59
60 $qu = pg_exec ($db_conn, "UPDATE customers SET name='$name',street='$addr1',street2='$addr2',".
61 "city='$city',province='$prov',country='$country',pocode='$pocode',phone='$phone',".
62 "tech_handle='$tech',abuse_handle='$abuse',admin_handle='$admin',".
63 "def_rdns='$rdns',special='$special' WHERE custid='$custid'");
64
65 echo "<table border=2 cellpadding=2>".
66 "<tr><td align=right>CustID</td><td>$custid</td></tr>\n".
67 "<tr><td>Name</td><td>$name</td></tr>\n".
68 "<tr><td>Street address</td><td>$addr1</td></tr>\n".
69 "<tr><td>Address 2</td><td>$addr2</td></tr>\n".
70 "<tr><td>City</td><td>$city</td></tr>\n".
71 "<tr><td>Province</td><td>$prov</td></tr>\n".
72 "<tr><td>Country</td><td>$country</td></tr>\n".
73 "<tr><td>Postal code</td><td>$pocode</td></tr>\n".
74 "<tr><td>Phone</td><td>$phone</td></tr>\n".
75 "<tr><td>Tech handle</td><td>$tech</td></tr>\n".
76 "<tr><td>Abuse handle</td><td>$abuse</td></tr>\n".
77 "<tr><td>Admin handle</td><td>$admin</td></tr>\n".
78 "<tr><td>Default rDNS</td><td>$rdns</td></tr>\n".
79 "<tr><td>\"Special\"</td><td><pre>$special</pre></td></tr>\n".
80 "</table>\n";
81
82?>
83</body>
84</html>
Note: See TracBrowser for help on using the repository browser.