...

alert message

hongyi
08-20-2002, 08:49 AM
Hi,

if i have a form page and this form page(written in perl) allows user to key in a userid. How do i check if the userid already exists in the database. And if it exists, how do i use a alert box to display the error message:"UserID already exists"

Pls help asap.....

andy7t
08-20-2002, 11:37 AM
#!/usr/bin/perl


print "Content-type: text/html\n\n";


#READS THE INDATA
read(STDIN,$indata,$ENV{'CONTENT_LENGTH'});
@indata = split(/&/,$indata);
foreach $i (0..$#indata)
{$indata[$i] =~ s/\+/ /g;
($key,$val) = split(/=/,$indata[$i],2);
$key =~ s/%(..)/pack("c",hex($1))/ge;
$val =~ s/%(..)/pack("c",hex($1))/ge;
$indata{$key} .= "\0" if (defined($indata{$key}));
$indata{$key} .= $val;
}


if (-e "$indata{'userid'}.txt")
{

print("Userid Already Exisits.\n");
exit;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum