diff options
author | ivan <ivan> | 1999-04-22 06:24:57 +0000 |
---|---|---|
committer | ivan <ivan> | 1999-04-22 06:24:57 +0000 |
commit | 153e6f03d3b7e0056983d719aadb5edf0d5feb41 (patch) | |
tree | 9e570f508c3a1ea95761067b09c0473a3b86d4f3 /cgi/persons.cgi | |
parent | 914bb1cf4592983b7d63f3faf748440c072e9c16 (diff) |
*** empty log message ***
Diffstat (limited to 'cgi/persons.cgi')
-rwxr-xr-x | cgi/persons.cgi | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cgi/persons.cgi b/cgi/persons.cgi index 1f1501c..e4eb179 100755 --- a/cgi/persons.cgi +++ b/cgi/persons.cgi @@ -1,5 +1,5 @@ #!/usr/bin/perl -Tw -# $Id: persons.cgi,v 1.8 1999-04-22 06:06:16 ivan Exp $ +# $Id: persons.cgi,v 1.9 1999-04-22 06:24:57 ivan Exp $ # Copyright (c) 1999 Ivan Kohler. All rights reserved. # This program is free software; you can redistribute it and/or modify it under # the same terms as perl itself @@ -82,13 +82,18 @@ unless ( $cgi->param('magic') ) { #first time through foreach $field ( @fields ) { if ( $cgi->param( $field ) ) { $cgi->param( $field ) =~ /^(.*)$/; - $cgi->param( $field, $1); + my $param = $1 || 0; + if ( (DBI::looks_like_number($param))[0] ) { + $cgi->param( $field, $param ); + } else { + $cgi->param( $field, $dbh->quote($param) ); + } } } my $statement = "INSERT INTO $table ( ". join(', ', @fields ). ' ) VALUES ( '. - join( ', ', map { $dbh->quote($cgi->param($_)) } @fields ). + join( ', ', map { $cgi->param($_) } @fields ). ' )' ; my $sth = $dbh->prepare($statement) |