use strict; use warnings; use POSIX; use CGI qw/:standard/; require SDBM_File; my %list; my $list = "list.dbm"; #change to location of database tie %list, 'SDBM_File', $list, O_CREAT | O_RDWR, 0644; if ( !tied %list ) { print "database unsuccessful $!.\n"; } print header, start_html('Neopets I/S nickname list:'); print start_form(), table( Tr( td("Your username: "), td( textfield( -name => 'username', -size => 40 ) ) ), Tr( td("What you wish to be called: "), td( textfield( -name => 'askname', -size => 40 ) ) ), Tr( td( radio_group( -name => 'update', -values => [ 'add', 'rem' ] ) ), ), Tr( td(), td(submit) ), ), end_form(), hr(); print qq(view the current list!


); if(param()){ my $username = param('username'); my $askname = param('askname'); my $update = param('update'); if($username){ if($username){ if($update eq "add"){ if(exists $list{$username}){ print "Username already exists in database.\n"; } else{ $list{$username} = $askname; print "Username was added to our system!

\n"; } } elsif($update eq "rem"){ if(exists $list{$username}){ del $list{$username}; print "Account information was removed from the system.\n"; } else{ print "Oops, it doesn't appear that username is in our database.\n"; } } } else{ print "For this to work please add your username.\n"; } }else{ print "Unless your name is null, please go back and fill it in.\n"; } } print end_html();