rph wrote:No way to tell without seeing the validateFAX function (you should probably just roll it into the regular validate function anyway).
The function is:
Code: Select all
private function validateFAX () {
{
$ncn = preg_replace( '/[^0-9A-Z]/i', '', $this->request->post['fax'] );
if (preg_match('/X?[0-9]{8}[A-Z]/i', $ncn))
{
$ncn = preg_replace('/^X/i', '', $ncn);
$stack = 'TRWAGMYFPDXBNJZSQVHLCKE';
$pos = substr($ncn, 0, 8) % 23;
if (strtoupper( substr($ncn, 8, 1) ) == substr($stack, $pos, 1) )
return TRUE;
}
else if (preg_match('/[A-HK-NPQS][0-9]{7}[A-J0-9]/i', $ncn))
{
$sum = 0;
for ($i=2; $i<strlen($ncn)-1; $i+=2) {
$sum += substr($ncn, $i, 1);
}
for ($i=1; $i<strlen($ncn)-1; $i+=2) {
$t = substr($ncn, $i, 1) * 2;
$sum += ($t>9)?($t-9):$t;
}
$control = 10 - ($sum % 10);
if ( substr($ncn, 8, 1) == $control ||
strtoupper(substr($ncn, 8, 1)) == substr('JABCDEFGHI', $control, 1 ))
return TRUE;
}
$this->error['fax'] = $this->language->get('error_fax');
return FALSE;
}
}
I think that the trouble could be how is called the function:
Code: Select all
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate() && $this->validateFAX()) {
unset($this->session->data['guest']);
$this->model_account_customer->addCustomer($this->request->post);
$this->customer->login($this->request->post['email'], $this->request->post['password']);
$this->redirect($this->url->link('account/success'));
}
I hope your help. Thank you