Example #1
0
$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;
        }
        /*else
        		echo "order ko";*/
    }
}
include TPL_HEADER;
?>
<section class="pageContent">
	<?php 
include_once TPL_TITLE;
?>
Example #2
0
$fields['cittaFatt'] = new FrmField($_POST['citta-fatt'], $lang['prev']['label-citta'], $bool_fatt, array(new StrRangeRule(2, 35)), $cliente->fields['cittaFatt']);
$fields['provFatt'] = new FrmField($_POST['provincia-fatt'], $lang['prev']['label-prov'], $bool_fatt, array(new StrRangeRule(2, 35)), $cliente->fields['provinciaFatt']);
$fields['capFatt'] = new FrmField($_POST['cap-fatt'], $lang['prev']['label-cap'], $bool_fatt, array(new StrRangeRule(5, 5)), $cliente->fields['capFatt']);
$fields['viaFatt'] = new FrmField($_POST['via-fatt'], $lang['prev']['label-via'], $bool_fatt, array(new StrRangeRule(2, 80)), $cliente->fields['viaFatt']);
//$fields['captcha'] = new FrmField( $_POST['captcha'], $lang['prev']['label-captcha2'], true, array(new CaptchaRule()) );
$fields['pagamento'] = new FrmField($_POST['pagamento'], $lang['prev']['label-pagam'], true, array(new InListRule(array(1, 2, 3, 4))));
$fields['privacy'] = new FrmField($_POST['privacy'], $lang['prev']['label-privacy2'], true, array(new InListRule(array("on"))));
$form = new SmartForm('sendcart', $fields);
if (!$form->isSent || !$form->isValid()) {
    $err_input = $form->getErrors();
} else {
    //Registrazione cliente
    $rc = $reg->registra_cliente($fields);
    if ($rc['err'] == 0) {
        //Registrazione ordine
        $ro = $ordine->registra($rc['id_usr'], $cart, 1, $fields['pagamento']->val);
        if ($ro['err'] == 0) {
            $_SESSION['cart_sended'] = $ro['seed'];
            header('Location: ' . DIR . $lang['prev']['link-end-order']);
            exit;
        }
    }
}
?>

<?php 
include TPL_HEADER;
?>
<section class="pageContent">
	<div class="titlePage">
		<div class="container">