sulfericacid
Programmer
I have a form which asks for a real name and username and it checks against the DB to prevent duplicates from the same username. Problem is I can type in 'webmaster' and 'webmaster ' and 'webmaster ' and they will each be unique and still get saved to DB. I tried using a substitution but that didn't work. Can anyone help?
if(param()){
my $username = param('username');
$username =~ s/\s+\z//;
my $askname = param('askname');
$askname =~ s/\s+\z//;
my $update = param('update');
if($username){
if($askname){
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!<p>\n";
}
}
elsif($update eq "rem"
{
if(exists $list{$username}){
delete $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";
}
}
"Age is nothing more than an inaccurate number bestowed upon each of us at birth as just another means for others to judge and classify us- sulfericacid
if(param()){
my $username = param('username');
$username =~ s/\s+\z//;
my $askname = param('askname');
$askname =~ s/\s+\z//;
my $update = param('update');
if($username){
if($askname){
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!<p>\n";
}
}
elsif($update eq "rem"
if(exists $list{$username}){
delete $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";
}
}
"Age is nothing more than an inaccurate number bestowed upon each of us at birth as just another means for others to judge and classify us- sulfericacid