- Timestamp:
- 11/07/12 17:45:28 (12 years ago)
- Location:
- trunk/cgi-bin
- Files:
-
- 3 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; -
trunk/cgi-bin/admin.cgi
r545 r546 123 123 my $custid = $def_custids{$webvar{alloctype}}; 124 124 if ($custid eq '') { 125 if ($webvar{custid} !~ /^(?:\d{10}|\d{7}|STAFF)(?:-\d\d?)?$/) { 126 # Force uppercase for now... 127 $webvar{custid} =~ tr/a-z/A-Z/; 128 # Crosscheck with billing. 129 my $status = CustIDCK->custid_exist($webvar{custid}); 130 if ($CustIDCK::Error) { 131 $page->param(errmsg => "Error verifying customer ID: ".$CustIDCK::ErrMsg); 132 goto ERRJUMP; 133 } 134 if (!$status) { 135 $page->param(errmsg => "Customer ID not valid. Make sure the Customer ID ". 136 "is correct.<br>\nUse STAFF for staff static IPs, and $IPDB::defcustid for any other ". 137 "non-customer assignments."); 138 goto ERRJUMP; 139 } 125 # Crosscheck with billing. 126 my $status = CustIDCK->custid_exist($webvar{custid}); 127 if ($CustIDCK::Error) { 128 $page->param(errmsg => "Error verifying customer ID: ".$CustIDCK::ErrMsg); 129 goto ERRJUMP; 130 } 131 if (!$status) { 132 $page->param(errmsg => "Customer ID not valid. Make sure the Customer ID ". 133 "is correct.<br>\nUse STAFF for staff static IPs, and $IPDB::defcustid for any other ". 134 "non-customer assignments."); 135 goto ERRJUMP; 140 136 } 141 137 # Type that doesn't have a default custid -
trunk/cgi-bin/main.cgi
r541 r546 572 572 return; 573 573 } 574 if ($webvar{custid} !~ /^(?:\d{10}|\d{7}|STAFF)(?:-\d\d?)?$/) { 575 # Force uppercase for now... 576 $webvar{custid} =~ tr/a-z/A-Z/; 577 # Crosscheck with billing. 578 my $status = CustIDCK->custid_exist($webvar{custid}); 579 if ($CustIDCK::Error) { 580 $page->param(err => "Error verifying customer ID: ".$CustIDCK::ErrMsg); 581 return; 582 } 583 if (!$status) { 584 $page->param(err => "Customer ID not valid. Make sure the Customer ID ". 585 "is correct.<br>\nUse STAFF for staff static IPs, and $IPDB::defcustid for any other ". 586 "non-customer assignments."); 587 return; 588 } 574 # Crosscheck with billing. 575 my $status = CustIDCK->custid_exist($webvar{custid}); 576 if ($CustIDCK::Error) { 577 $page->param(err => "Error verifying customer ID: ".$CustIDCK::ErrMsg); 578 return; 579 } 580 if (!$status) { 581 $page->param(err => "Customer ID not valid. Make sure the Customer ID ". 582 "is correct.<br>\nUse STAFF for staff static IPs, and $IPDB::defcustid for any other ". 583 "non-customer assignments."); 584 return; 589 585 } 590 586 # print "<!-- [ In validateInput(). Insert customer ID cross-check here. ] -->\n";
Note:
See TracChangeset
for help on using the changeset viewer.