Exemplo n.º 1
0
$page = $main->getPage(TABLE_cms, $curr_page_id, $_SESSION['lang']['id']);
// FRAMEWORK CORREZIONE INPUT
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>
Exemplo n.º 2
0
$sonoun_opt = array("privato", "ingrosso");
$nations_opt = array("Italia", "Germania", "Spagna", "Francia", "Inghilterra");
$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'];
Exemplo n.º 3
0
							' . SmartForm::print_field('solo', SmartForm::FORM_FIELD_RADIO, 'One Radio only (minimal setup)', null, true) . '
						</fieldset>
						<fieldset>
							<div class="row">
								' . SmartForm::print_field('toggle_checkbox', SmartForm::FORM_FIELD_CHECKBOX, array('items' => array('Switch 1', 'Switch 2', 'Switch 3'), 'toggle' => true, 'label' => 'Checkbox Toggle'), 6, true) . '

								' . SmartForm::print_field('toggle_checkbox', SmartForm::FORM_FIELD_RADIO, array('items' => array('Switch 1', 'Switch 2', 'Switch 3'), 'toggle' => true, 'label' => 'Radio Toggle'), 6, true) . '
							</div>
						</fieldset>
						<fieldset>
							' . SmartForm::print_field('rating-star', SmartForm::FORM_FIELD_RATING, 10, null, true) . '
							' . SmartForm::print_field('rating-star2', SmartForm::FORM_FIELD_RATING, array('max' => 8, 'icon' => 'fa-asterisk', 'label' => 'Rating', 'note' => '<strong>Note:</strong> This is a customized rating field'), null, true) . '

						</fieldset>
						<fieldset>
							' . SmartForm::print_field('rating-multiple', SmartForm::FORM_FIELD_RATINGS, array('items' => array(array('max' => 6, 'icon' => 'fa-trophy', 'label' => 'The Rating'), 3, 7, 10, 20), 'label' => 'Multiple Ratings? No problem!'), null, true) . '
						</fieldset>
						<footer>
							' . $ui->create_button('Submit', 'primary')->container('button')->attr(array('type' => 'submit'))->print_html(true) . '
						</footer>
					</form>

				';
$ui->create_widget()->body('content', $body)->options('editbutton', false)->body('class', 'no-padding')->header('title', '<h2>SmartUI::SmartForm</h2>')->print_html();
// print html output
$run_time = $ui->run_time(false);
$hb = new HTMLIndent();
$html_snippet = SmartUtil::clean_html_string($hb->indent($body), false);
$contents = array("body" => '<pre class="prettyprint linenums">' . $html_snippet . '</pre>', "header" => array("icon" => 'fa fa-code', "title" => '<h2>HTML Output (Run Time: ' . $run_time . ')</h2>'));
$options = array("editbutton" => false, "colorbutton" => false, "collapsed" => true);
$ui->create_widget($options, $contents)->color('pink')->print_html();
Exemplo n.º 4
0
        }
    }
}
$fields = array();
$cross = array();
/*
Definizione dei campi
*/
$fields['nome'] = new FrmField($_REQUEST['nome'], 'Nome', false, array(new PatternRule("/^\\w{3,15}\$/i")));
$fields['cognome'] = new FrmField($_REQUEST['cognome'], 'Cognome', false, array(new PatternRule("/^\\w{3,20}\$/i")));
$fields['userid'] = new MailField($_REQUEST['userid'], 'Userid', true);
$fields['pw1'] = new FrmField($_REQUEST['pw1'], 'Password 1', true, array(new StrRangeRule(8, 10)));
$fields['pw2'] = new FrmField($_REQUEST['pw2'], 'Password 2', true, array(new StrRangeRule(8, 10)));
/*
Regole che incrociano i campi
*/
$cross[] = new CrossPassword($_REQUEST['pw1'], $_REQUEST['pw2'], 'I campi password non contengono gli stessi valori');
$form = new SmartForm('invia', $fields, $cross);
/*
Se il form non è stato inviato o è inviato ma ci sono errori
*/
if (!$form->isSent || !$form->isValid()) {
    /*
    	Mostra il form ed eventuali errori
    */
    $form->display('testTpl.php');
}
//Se invece è tutto ok
//elabora i dati inviati
echo "Dati inviati:<br><br>";
var_export($_POST);