Changeset 546 for trunk/cgi-bin/CustIDCK.pm
- Timestamp:
- 11/07/12 17:45:28 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/CustIDCK.pm
r517 r546 34 34 my $custid = shift; 35 35 36 return 1 if $custid =~ /^STAFF$/; 37 return 1 if $custid =~ /^5554242$/; # just in case some later change might block this 38 return 1 if $custid =~ /^\d{7}$/; 39 return 1 if $custid =~ /^\d{10}$/; 36 # hardcoded "OK" custids. 37 return 1 if $custid =~ /^STAFF(?:-\d\d?)?$/; 38 return 1 if $custid =~ /^5554242(?:-\d\d?)?$/; # just in case some later change might block this 39 return 1 if $custid =~ /^\d{7}(?:-\d\d?)?$/; 40 return 1 if $custid =~ /^\d{10}(?:-\d\d?)?$/; 41 42 # Force uppercase for now... 43 $custid =~ tr/a-z/A-Z/; 40 44 41 45 # some example code for a database check … … 66 70 67 71 # We should have a valid DB connection by now. 68 my $sth = $dbh->prepare("SELECT custid FROM custid WHERE custid = '$custid'"); 69 $sth->execute; 72 73 my $hr = $dbh->selectrow_hashref("SELECT custid FROM custid WHERE custid = ?", undef, ($custid) ); 74 my $status = 0; 70 75 if ($dbh->err) { 71 76 $CustIDCK::Error = 1; 72 77 $CustIDCK::ErrMsg = $dbh->errstr(); 73 $sth->finish; 74 $dbh->disconnect; 75 return 0; 78 } else { 79 $status = 1 if ( $hr->{custid} ); 76 80 } 77 my $hr = $sth->fetchrow_hashref();78 my $status = 0;79 $status = 1 if ( $hr->{custid} );80 $sth->finish;81 81 $dbh->disconnect; 82 82 return $status;
Note:
See TracChangeset
for help on using the changeset viewer.