require_once 'tools/php_captcha/php-captcha.inc.php'; include_once 'tools/checkform/' . $_SESSION['lang']['label'] . '_error_const.inc.php'; include_once 'tools/checkform/regole.php'; include_once 'tools/checkform/tipi.php'; include_once 'tools/checkform/form_handler.php'; $fields = array(); $err_input = ""; $fields['nome'] = new FrmField($_POST['nome'], $lang['contatti']['label_name'], true, array(new StrRangeRule(2, 30))); $fields['email'] = new MailField($_POST['email'], $lang['contatti']['label_email'], true); $fields['telefono'] = new PhoneField($_POST['tel'], $lang['contatti']['label_phone'], true); //$fields['captcha'] = new FrmField( $_POST['captcha'], $lang['prev']['label-captcha2'], true, array(new CaptchaRule()) ); $fields['msg'] = new FrmField($_POST['msg'], $lang['contatti']['label_msg'], true, array(new StrRangeRule(5, 300))); $fields['privacy'] = new FrmField($_POST['privacy'], $lang['contatti']['label_privacy2'], true, array(new InListRule(array("on")))); $form = new SmartForm('sendcont', $fields); if (!$form->isSent || !$form->isValid()) { $e = $form->getErrors(); if (!empty($e)) { $err_input = "<div class='warning'><p><b><a name='err'></a>" . $lang['contatti']['err-data'] . ":</b><br>" . join("<br />\r\n", $e) . "</p></div>"; } } else { header('Content-Type: text/html; charset=utf-8'); /* * INVIO MAIL * INCLUSIONE MAILER */ include_once "tools/mailer/configSMTP.php"; require_once "tools/mailer/mailer.php"; //Creazione messaggio $msg = '<h3>Richiesta da contatti</h3> <table> <tr>
$nation_default = "Italia"; $reg_codfisc = "/^[a-zA-Z]{6}[0-9]{2}[abcdehlmprstABCDEHLMPRST]{1}[0-9]{2}([a-zA-Z]{1}[0-9]{3})[a-zA-Z]{1}\$/"; $fields = array(); $fields['nome'] = new FrmField($_POST['nome'], $lang['prev']['label-name'], true, array(new StrRangeRule(2, 30))); $fields['cognome'] = new FrmField($_POST['cognome'], $lang['prev']['label-surname'], true, array(new StrRangeRule(2, 30))); $fields['sonoun'] = new FrmField($_POST['sonoun'], $lang['prev']['label-about'], true, array(new InListRule($sonoun_opt))); $fields['email'] = new MailField($_POST['email'], $lang['prev']['label-mail'], true); $fields['telefono'] = new PhoneField($_POST['telefono'], $lang['prev']['label-tel'], true); $fields['cap'] = new FrmField($_POST['cap'], $lang['prev']['label-cap'], true, array(new StrRangeRule(5, 5))); //$fields['codfiscale'] = new FrmField( $_POST['codfiscale'], $lang['prev']['label-iva'], true, array(new StrRangeRule(11, 16)) ); //$fields['captcha'] = new FrmField( $_POST['captcha'], $lang['prev']['label-captcha2'], true, array(new CaptchaRule()) ); $fields['privacy'] = new FrmField($_POST['privacy'], $lang['prev']['label-privacy2'], true, array(new InListRule(array("on")))); $fields['nazione'] = new FrmField($_POST['nazione'], $lang['prev']['label-nation'], true, array(new InListRule($nations_opt))); $form = new SmartForm('sendprev', $fields); if (!$form->isSent || !$form->isValid()) { $err_input = $form->getErrors(); } else { //REGISTRAZIONE require_once "classes/class.registrazione.php"; require_once "classes/class.ordini.php"; $reg = new registrazione($db_conn, $lang['prev']); $ordine = new ordini($db_conn, $_SESSION['lang']['id']); //Registrazione cliente $rc = $reg->registra_cliente($fields); if ($rc['err'] == 0) { //Registrazione ordine $ro = $ordine->registra($rc['id_usr'], $cart); if ($ro['err'] == 0) { $_SESSION['prev_sended'] = $ro['seed']; header('Location: ' . $lang['prev']['invia_preventivo'][LINK]); exit;