|
#!/usr/bin/perl require 'parse.pl'; &parse_form; print "Content-type:text/html\n\n"; $filename="regist.txt"; open(myfile,"$filename"); @rm = <myfile>; close(myfile); foreach $r (@rm) { @rec = split(/,/,$r); if ($rec[2] eq $v{'id'}) { $found = 1; } } if ($found eq "1") { print "Already in database, error."; } else { open(myfile,">>$filename"); print myfile "$v{'ryear'},$v{'sem'},$v{'id'},"; foreach $k (keys %v) { if ($v{$k} eq "on") { print myfile "$k,"; } } print myfile "\n"; close(myfile); print "Add new record ok"; } |