- Timestamp:
- 11/15/04 12:42:35 (20 years ago)
- Location:
- branches/stable/cgi-bin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/cgi-bin/IPDB.pm
r26 r71 1 1 # ipdb/cgi-bin/IPDB.pm 2 # Contains DB-related functions for IPDB2 # Contains functions for IPDB - database access, subnet mangling, block allocation, etc 3 3 ### 4 4 # SVN revision info … … 7 7 # Last update by $Author$ 8 8 ### 9 10 # Split from CommonWeb.pm 08/13/2004 kdeugau@vianet 9 # Copyright (C) 2004 - Kris Deugau 11 10 12 11 package IPDB; … … 15 14 use warnings; 16 15 use Exporter; 16 use Net::SMTP; 17 use POSIX; 17 18 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); 18 19 19 20 $VERSION = 1.0; 20 21 @ISA = qw(Exporter); 21 @EXPORT_OK = qw(&connectDB &checkDBSanity );22 @EXPORT_OK = qw(&connectDB &checkDBSanity &allocateBlock &mailNotify); 22 23 23 24 @EXPORT = (); # Export nothing by default. 24 %EXPORT_TAGS = ( ALL => [qw( &connectDB &checkDBSanity )]25 %EXPORT_TAGS = ( ALL => [qw( &connectDB &checkDBSanity &allocateBlock &mailNotify)] 25 26 ); 27 26 28 27 29 # Creates connection to IPDB. … … 66 68 } # end checkDBSanity 67 69 70 71 # allocateBlock() 72 # Does all of the magic of actually allocating a netblock 73 sub allocateBlock($) { 74 } 75 76 77 # mailNotify() 78 # Sends notification mail to recipients regarding an IPDB operation 79 sub mailNotify ($$$) { 80 my ($recip,$subj,$message) = @_; 81 my $mailer = Net::SMTP->new("smtp.example.com", Hello => "ipdb.example.com"); 82 83 $mailer->mail('ipdb@example.com'); 84 $mailer->to($recip); 85 $mailer->data("From: \"IP Database\" <ipdb\@example.com>\n", 86 "Date: ".strftime("%a, %d %b %Y %H:%M:%S %z",localtime)."\n", 87 "Subject: {IPDB} $subj\n", 88 "X-Mailer: IPDB Notify v".sprintf("%.1d",$IPDB::VERSION)."\n", 89 "Organization: Example Corp\n", 90 "\n$message\n"); 91 $mailer->quit; 92 } 93 68 94 # Indicates module loaded OK. Required by Perl. 69 95 1; -
branches/stable/cgi-bin/main.cgi
r64 r71 47 47 48 48 my %full_alloc_types = ( 49 "ci"," Cable poolIP",50 "di"," DSL poolIP",49 "ci","Static cable IP", 50 "di","Static DSL IP", 51 51 "si","Server pool IP", 52 52 "mi","Static dialup IP", … … 987 987 print qq(<div class="center"><div class="heading">The IP $cidr has been allocated to customer $webvar{custid}</div></div>); 988 988 syslog "notice", "$authuser allocated $cidr to $webvar{custid}"; 989 # Notify tech@example.com 990 mailNotify('tech@example.com','$full_alloc_types{$webvar{alloctype}} allocation', 991 "$full_alloc_types{$webvar{alloctype}} $cidr allocated to customer $webvar{custid}"); 989 992 990 993 } else { # end IP-from-pool allocation
Note:
See TracChangeset
for help on using the changeset viewer.