Re: [Dave] Web Membership Profile - Error checking a serial number
Hi Dave,
Thanks so much for this - I had been looking at preg_match as an option but wasn't sure how to proceed. This and the resource link are extremely helpful.
I plugged in the following and it's working brilliantly:
// serial error checking
$_REQUEST['serial'] = preg_replace("/[^\da-z]/i", '', @$_REQUEST['serial']); // remove chars that aren't a digit or a letter
$isValidSerial = preg_match("/^\d\d[a-z]\d\d\d\d\d\d$/i", $_REQUEST['serial']); // valid format: 2 numbers, 1 letter, 6 numbers
if (!$_REQUEST['serial']) { $errorsAndAlerts .= "No serial number entered!<br/>\n"; }
elseif (!$isValidSerial) { $errorsAndAlerts .= "You must enter a valid serial number.<br/>\n"; }
As much as I would like to give our users some hints we're concerned about competitors accessing info only meant for product users. So I get to be a generic as possible with my error messages.
Thanks again - your support is always awesome!
Cricket7475