| 
            Last change
 on this file since 663 was             263, checked in by Kris Deugau, 20 years ago           | 
        
        
          | 
             
/branches/dns 
 
Add/create dns.cgi stub 
 
 
           | 
        
        
          
            
              - 
Property                 svn:executable
 set to                 
*
               
              - 
Property                 svn:keywords
 set to                 
Date Rev Author
               
             
           | 
        
        
          | 
            File size:
            1.1 KB
           | 
        
      
      
| Rev | Line |   | 
|---|
| [263] | 1 | #!/usr/bin/perl
 | 
|---|
 | 2 | # ipdb/cgi-bin/dns.cgi
 | 
|---|
 | 3 | ###
 | 
|---|
 | 4 | # SVN revision info
 | 
|---|
 | 5 | # $Date: 2005-06-21 21:12:52 +0000 (Tue, 21 Jun 2005) $
 | 
|---|
 | 6 | # SVN revision $Rev: 263 $
 | 
|---|
 | 7 | # Last update by $Author: kdeugau $
 | 
|---|
 | 8 | ###
 | 
|---|
 | 9 | # Copyright (C) 2004,2005 - Kris Deugau
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | use strict;
 | 
|---|
 | 12 | use warnings;
 | 
|---|
 | 13 | use CGI::Carp qw(fatalsToBrowser);
 | 
|---|
 | 14 | use DBI;
 | 
|---|
 | 15 | use CommonWeb qw(:ALL);
 | 
|---|
 | 16 | use MyIPDB;
 | 
|---|
 | 17 | use POSIX qw(ceil);
 | 
|---|
 | 18 | use NetAddr::IP;
 | 
|---|
 | 19 | 
 | 
|---|
 | 20 | use Sys::Syslog;
 | 
|---|
 | 21 | 
 | 
|---|
 | 22 | openlog "IPDB-dns","pid","local2";
 | 
|---|
 | 23 | 
 | 
|---|
 | 24 | # Collect the username from HTTP auth.  If undefined, we're in
 | 
|---|
 | 25 | # a test environment, or called without a username.
 | 
|---|
 | 26 | my $authuser;
 | 
|---|
 | 27 | if (!defined($ENV{'REMOTE_USER'})) {
 | 
|---|
 | 28 |   $authuser = '__temptest';
 | 
|---|
 | 29 | } else {
 | 
|---|
 | 30 |   $authuser = $ENV{'REMOTE_USER'};
 | 
|---|
 | 31 | }
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 | # Why not a global DB handle?  (And a global statement handle, as well...)
 | 
|---|
 | 34 | # Use the connectDB function, otherwise we end up confusing ourselves
 | 
|---|
 | 35 | my $ip_dbh;
 | 
|---|
 | 36 | my $sth;
 | 
|---|
 | 37 | my $errstr;
 | 
|---|
 | 38 | ($ip_dbh,$errstr) = connectDB_My;
 | 
|---|
 | 39 | if (!$ip_dbh) {
 | 
|---|
 | 40 |   printAndExit("Database error: $errstr\n");
 | 
|---|
 | 41 | }
 | 
|---|
 | 42 | initIPDBGlobals($ip_dbh);
 | 
|---|
 | 43 |  
 | 
|---|
 | 44 | printHeader('test','<td>test again</td>');
 | 
|---|
 | 45 | 
 | 
|---|
 | 46 | 
 | 
|---|
 | 47 | # Global variables
 | 
|---|
 | 48 | my %webvar = parse_post();
 | 
|---|
 | 49 | cleanInput(\%webvar);
 | 
|---|
 | 50 | 
 | 
|---|
 | 51 | 
 | 
|---|
 | 52 | #main()
 | 
|---|
 | 53 | 
 | 
|---|
 | 54 | if(!defined($webvar{action})) {
 | 
|---|
 | 55 |   $webvar{action} = "<NULL>";   #shuts up the warnings.
 | 
|---|
 | 56 | }
 | 
|---|
 | 57 | 
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.