Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
web
/
vhosts
/
www.volley92.asso.fr
/
htdocs
/
functions
/
/srv/data/web/vhosts/www.volley92.asso.fr/htdocs/functions/pre-paiement.php
<?php //Si le formulaire est rempli par un robot if(isset($_POST['pseudo']) && $_POST['pseudo']!="") header("Location: ".$routes['devis-success']); //Init Variables $form_is_valid = true; $form_has_errors = false; $form_is_submitted = false; $form_has_errors_cgv = false; $form_has_errors_rgpd = false; //how to use it $data = array( 'firstname' => array('value' => null,'status'=>null,'regex'=> _2_CHARS_REGEX_, 'label'=>'Prénom'), 'lastname' => array('value' => null,'status'=>null,'regex'=> _2_CHARS_REGEX_, 'label'=>'Nom'), 'email' => array('value' => null,'status'=>null,'regex'=> _EMAIL_REGEX_, 'label'=>'E-mail'), 'phone' => array('value' => null,'status'=>null,'regex'=> _PHONE_REGEX_, 'label'=>'Téléphone'), 'price' => array('value' => null,'status'=>null,'regex'=> null, 'label'=>'Prix'), 'formation' => array('value' => null,'status'=>null,'regex'=> null, 'label'=>'Formule'), 'message' => array('value' => null,'status'=>null,'regex'=> null, 'label'=>'Message'), 'cgv' => array('value' => null,'status'=>null,'regex'=> null, 'label'=>'J\'accepte <a href="'.$routes['page-single'].'-conditions-generales-de-vente-15" target="_blank">les conditions générales de vente</a>','force_display'=>true), 'rgpd' => array('value' => null,'status'=>null,'regex'=> null, 'label'=>'En utilisant ce formulaire, vous acceptez le stockage et la gestion de vos données par ce site *','force_display'=>true), //'input1' => array('value' => null,'status'=>null,'regex'=> null, 'label'=>'Nombre de personnes'), //'company' => array('value' => null,'status'=>null,'regex'=> _2_CHARS_REGEX_, 'label'=>'Entreprise'), //'date1' => array('value' => null,'status'=>null,'regex'=> null, 'label'=>'Date de l\'évènement'), //'file' => array('value' => null,'status'=>null,'regex'=> null, 'label'=>'Pièce jointe'), //'pseudo' => array('value' => null,'status'=>null,'regex'=> null, 'label'=>'Pseudo'), ); //Formulaire envoyé if(isset($_POST['recap'])) { if (empty($_POST['cgv'])) { $form_has_errors_cgv = true; $form_is_valid = false; } if (empty($_POST['rgpd'])) { $form_has_errors_rgpd = true; $form_is_valid = false; } $data['email']['value'] = (isset($_POST['email']))?$_POST['email']:null; $data['firstname']['value'] = (isset($_POST['firstname']))?$_POST['firstname']:null; $data['lastname']['value'] = (isset($_POST['lastname']))?$_POST['lastname']:null; $data['phone']['value'] = (isset($_POST['phone']))?$_POST['phone']:null; $data['price']['value'] = (isset($_SESSION['prix']))?$_SESSION['prix']:null; $data['formation']['value'] = (isset($_SESSION['formation']))?$_SESSION['formation']:null; $data['message']['value'] = (isset($_POST['message']))?$_POST['message']:null; // $data['rgpd']['value'] = (isset($_POST['rgpd']))?$_POST['rgpd']:null; // $data['cgv']['value'] = (isset($_POST['cgv']))?$_POST['cgv']:null; //$data['address']['value'] = (isset($_POST['address']))?$_POST['address']:null; //$data['company']['value'] = (isset($_POST['company']))?$_POST['company']:null; //$data['city']['value'] = (isset($_POST['city']))?$_POST['city']:null; //$data['checkbox1']['value'] = (isset($_POST['checkbox1']))?$_POST['checkbox1']:null; //$data['checkbox2']['value'] = (isset($_POST['checkbox2']))?$_POST['checkbox2']:null; // $data['checkbox3']['value'] = (isset($_POST['checkbox3']))?$_POST['checkbox3']:null; // $data['company']['value'] = (isset($_POST['company']))?$_POST['company']:null; //$data['date1']['value'] = (isset($_POST['date1']))?$_POST['date1']:null; //$data['file']['value'] = (isset($_FILES['file']))?$_FILES['file']:null; //$data['input1']['value'] = (isset($_POST['input1']))?$_POST['input1']:null; //$data['pseudo']['value'] = (isset($_POST['pseudo']))?$_POST['pseudo']:null; // $data['radio1']['value'] = (isset($_POST['radio1']))?$_POST['radio1']:null; // $data['select1']['value'] = (isset($_POST['select1']))?$_POST['select1']:null; // $data['select2']['value'] = (isset($_POST['select2']))?$_POST['select2']:null; // $data['zipcode']['value'] = (isset($_POST['zipcode']))?$_POST['zipcode']:null; $_SESSION['email'] = $data['email']['value']; $_SESSION['firstname'] = $data['firstname']['value']; $_SESSION['lastname'] = $data['lastname']['value']; $_SESSION['phone'] = $data['phone']['value']; $_SESSION['formation'] = $data['formation']['value']; $form_is_submitted = true; //Form validation rules foreach($data as $key => $field) { if (!is_null($field['regex'])){ if (validate($field['regex'],$field['value'])){$data[$key]['status'] = 'has-success';} else{$data[$key]['status'] = 'has-error';$form_is_valid = false;} } } //file check //if(is_null($data['file']['value']) || file_is_uploaded($data['file']['value'])){$data['file']['status'] = 'has-success';} //else{$data['file']['status'] = 'has-error';$form_is_valid = false;} if ($form_is_valid) { //validation rules are OK //Filling my product field foreach($data as $field => $params) { //just fill the 'demande' section of the order if(!in_array($field,array('firstname','lastname','email','phone','message','formation','price'))) { //search for checkboxN and fill it with Oui (checked) or No (unchecked) if(substr($field, 0, 8) == 'checkbox') { $product[$params['label']] = ($params['value'])?'Oui':'Non'; } //search for radio and fill it with the checked option label elseif(substr($field, 0, 5) == 'radio'){ $product[$params['label']['title']] = $params['label']['options'][$params['value']]; } //fill all the remain fields into products else{ $product[$params['label']] = $params['value']; } } } $form_data = array( $data['firstname']['value'], $data['lastname']['value'], $data['email']['value'], $data['phone']['value'], $data['price']['value'], $data['formation']['value'], //$data['zipcode']['value'], //$data['city']['value'], $data['message']['value'], serialize($product), $conf_id_company, ); //Send emails //mailContact($data); //mailConfirmation($data); header("Location: " . $routes['paiement']); }else{ //On affichera un message d'erreur $form_has_errors = true; } }