#!/usr/bin/perl -wT # # Script: Dynamic Dungeon Siege IP Database Activate IP Script # Author: Guildencrantz # Version: 4-13-02 # use strict; use DB_File; use CGI; use CGI::Carp 'fatalsToBrowser'; my $q = new CGI; my $userIP = $q->remote_host; my $allIPsPath = "/var/www/cgi-bin/ds/database/allIPs.db"; my $activeIPsPath = "/var/www/cgi-bin/ds/database/activeIPs.db"; tie my %allIPs, "DB_File", $allIPsPath or die "Cannot open allIPs database: $!"; tie my %activeIPs, "DB_File", $activeIPsPath or die "Cannot open activeIPs database: $!"; print "userIP = $userIP\n"; print "userdata = $allIPs{$userIP}\n"; if( exists $allIPs{$userIP} ) { print "exists in allIPs\n"; if( exists $activeIPs{$userIP} ) { print "exists in activeIPs\n"; print "Content-type: html/text"; print < ACTIVE

Your IP is already marked as active!

You will be forwarded in 5 seconds

END_OF_BLOCK } else { print "does not exist in activeIPs\n"; $activeIPs{$userIP} = $allIPs{$userIP}; print "active IPs= $activeIPs{$userIP}\n"; print "Content-type: html/text"; print < Added!

Your IP has been activated!

You will be forwarded in 5 seconds

END_OF_BLOCK } } else { print "Content-type: text/html\n\n"; print < IP Not Registered

There is no entry in the database for this IP. You must register this IP and the associated server attributes

You will be forwarded in 5 seconds

END_OF_BLOCK } untie %activeIPs; untie %allIPs;