Example #1
0
$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;
        }
        /*else
        		echo "order ko";*/
    }
}
include TPL_HEADER;
Example #2
0
/*
 * INCLUSIONE CARELLO
 * << ATTENZIONE!!! >>
 * Le classi del carrello devono essere incluse prima della chiamata "session_start()"
 */
require_once "classes/cart/product.class.php";
require_once "classes/cart/cart.class.php";
// INCLUSIONI
include "config.inc.php";
include LANG_CONFIG;
@(include LANG_PATH . $_SESSION['lang']['label'] . '/' . LANG_CART);
//inclusione dizionario preventivo
include DB;
// GESTIONE ORDINI
require_once "classes/class.ordini.php";
$ordine = new ordini($db_conn, $_SESSION['lang']['id']);
//REGISTRAZIONE
require_once "classes/class.registrazione.php";
$reg = new registrazione($db_conn, $lang['prev']);
// INIT. CARRELLO
$cart = new cart($db_conn, CART, true, 1, $_SESSION['lang']['id'], $lang['prev'], DIR);
$id_ordine;
// VERIFICA TOKEN CARRELLO
if (isset($_GET['token']) && ($id_ordine = $ordine->verifica_token($_GET['token'])) != -1) {
    if (isset($_SESSION[TOKEN])) {
        if ($_SESSION[TOKEN] != $_GET['token']) {
            $cart->empty_cart();
            //svuoto il carrello attuale
            $_SESSION[TOKEN] = $_GET['token'];
            //rigenero il token
            $cart->init_cart($id_ordine);
 * SMARTY ------------------------------------------------------------------------------------------------
 */
require_once "tools/smarty/Smarty.class.php";
$smarty = new Smarty();
$smarty->force_compile = true;
$smarty->debugging = false;
$smarty->caching = false;
$smarty->compile_dir = 'tools/smarty/templates_c/';
$smarty->config_dir = 'tools/smarty/configs/';
$smarty->cache_dir = 'tools/smarty/cache/';
/*
 * MAILER
 */
include_once "tools/mailer/send-email.inc.php";
$cart = new cart($db_conn, PREV, false, 1, $_SESSION['lang']['id'], $lang['prev'], DIR);
$ord = new ordini($db_conn, $_SESSION['lang']['id']);
$curr_page = "preventivo_riepilogo";
if (isset($_SESSION['prev_sended']) && $cart->get_quantity() > 0) {
    $clt = $ord->verifica_ordine($_SESSION['prev_sended']);
    if (!empty($clt)) {
        $spesa = $cart->print_cart('print');
        $nome = ucwords($clt->fields['nome']) . ' ' . ucwords($clt->fields['cognome']);
        $tel = $clt->fields['tel'];
        $mail = $clt->fields['email'];
        /*
         * INVIO MAIL ----------------------------------------------------------------------------
         */
        //Variabili Smarty
        $smarty->assign('table_prod', $spesa);
        $smarty->assign('nome', $nome);
        $smarty->assign('tel', $tel);
 */
require_once "tools/smarty/Smarty.class.php";
$smarty = new Smarty();
$smarty->force_compile = true;
$smarty->debugging = false;
$smarty->caching = false;
$smarty->compile_dir = 'tools/smarty/templates_c/';
$smarty->config_dir = 'tools/smarty/configs/';
$smarty->cache_dir = 'tools/smarty/cache/';
/*
 * MAILER
 */
include_once "tools/mailer/configSMTP.php";
require_once "tools/mailer/mailer.php";
$cart = new cart($db_conn, CART, true, 1, $_SESSION['lang']['id'], $lang['prev'], DIR);
$ord = new ordini($db_conn, $_SESSION['lang']['id']);
$curr_page = "carrello_riepilogo";
if (isset($_SESSION['cart_sended']) && $cart->get_quantity() > 0) {
    $clt = $ord->verifica_ordine($_SESSION['cart_sended']);
    if (!empty($clt)) {
        $spesa = $cart->print_cart('print', 'table-prod-cart');
        $nome = ucwords($clt->fields['nome']) . ' ' . ucwords($clt->fields['cognome']);
        $tel = $clt->fields['tel'];
        $mail = $clt->fields['email'];
        /*
         * INVIO MAIL ----------------------------------------------------------------------------
         */
        //Variabili Smarty
        $pagamento = $lang['prev']['payments'][$clt->fields['pagamento']];
        //$mp = sprintf($pagamento['info'],$cart->getTotal());
        $mp = $pagamento['label'];