s/CGI::Request/CGI.pm/; etc
[freeside.git] / htdocs / edit / process / svc_domain.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: svc_domain.cgi,v 1.2 1998-12-17 08:40:30 ivan Exp $
4 #
5 # Usage: post form to:
6 #        http://server.name/path/svc_domain.cgi
7 #
8 # Note: Should br run setuid root as user nobody.
9 #
10 # lots of yucky stuff in this one... bleachlkjhui!
11 #
12 # ivan@voicenet.com 97-jan-6
13 #
14 # kludged for new domain template 3.5
15 # ivan@voicenet.com 97-jul-24
16 #
17 # moved internic bits to svc_domain.pm ivan@sisd.com 98-mar-14
18 #
19 # Changes to allow page to work at a relative position in server
20 #       bmccane@maxbaud.net     98-apr-3
21 #
22 # $Log: svc_domain.cgi,v $
23 # Revision 1.2  1998-12-17 08:40:30  ivan
24 # s/CGI::Request/CGI.pm/; etc
25 #
26
27 use strict;
28 use CGI;
29 use CGI::Carp qw(fatalsToBrowser);
30 use FS::UID qw(cgisuidsetup);
31 use FS::Record qw(qsearchs);
32 use FS::svc_domain;
33
34 #remove this to actually test the domains!
35 $FS::svc_domain::whois_hack = 1;
36
37 my($cgi) = new CGI;
38 &cgisuidsetup($cgi);
39
40 $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
41 my($svcnum)=$1;
42
43 my($new) = create FS::svc_domain ( {
44   map {
45     $_, scalar($cgi->param($_));
46   } qw(svcnum pkgnum svcpart domain action purpose)
47 } );
48
49 my($error);
50 if ($cgi->param('legal') ne "Yes") {
51   $error = "Customer did not agree to be bound by NSI's ".
52     qq!<A HREF="http://rs.internic.net/help/agreement.txt">!.
53     "Domain Name Resgistration Agreement</A>";
54 } elsif ($cgi->param('svcnum')) {
55   $error="Can't modify a domain!";
56 } else {
57   $error=$new->insert;
58   $svcnum=$new->svcnum;
59 }
60
61 unless ($error) {
62   print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum");
63 } else {
64   idiot($error);
65 }
66