1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863
| <?php session_start(); header("Content-Type: text/html; charset=UTF-8"); ?>
<?php
/*
* Formulaire généré par formallin v2.3.0
* Auteur : Grégory Toucas
* http://www.atomestudio.com / contact@atomestudio.com
* Soutenu par l'agence web IDEEMATIC : http://www.ideematic.com
*
* Programme sous licence GPL:
* http://www.gnu.org/licenses/gpl.html
*
*/
echo '
<!--
Formulaire généré par formallin v2.3.0
Auteur : Grégory Toucas
http://www.atomestudio.com / contact@atomestudio.com
Soutenu par l agence web IDEEMATIC : http://www.ideematic.com
Programme sous licence GPL:
http://www.gnu.org/licenses/gpl.html
-->
';
?>
<?php
$tabFieldsetLegends[5]="Titre";
?>
<?php
// Ensemble de fonctions
function fa_phpToJs($var) {
if (is_array($var)) {
$res = "[";
$array = array();
foreach ($var as $a_var) {
$array[] = fa_phpToJs($a_var);
}
return "[" . join(",", $array) . "]";
}
elseif (is_bool($var)) {
return $var ? "true" : "false";
}
elseif (is_int($var) || is_integer($var) || is_double($var) || is_float($var)) {
return $var;
}
elseif (is_string($var)) {
return "\"" . addslashes(stripslashes($var)) . "\"";
}
// autres cas: objets, on ne les gère pas
return FALSE;
}
function fa_str_post($string){
if (isset($_POST[$string])) { $return_string = trim($_POST[$string]); } else { $return_string = ""; }
return $return_string;
}
?>
<script type="text/javascript">
var tabErrorFields=new Array();
var tabErrorFormats=new Array();
var tabFieldsRequired=new Array();
var tabFormatsRequired=new Array();
</script><?php $list_langIds="5"; $tab_langIds=explode(",",$list_langIds); ?>
<?php
$tabShortNames[0]="zh";
$tabShortNames[1]="ca";
$tabShortNames[2]="da";
$tabShortNames[3]="de";
$tabShortNames[4]="fr";
$tabShortNames[5]="it";
$tabShortNames[6]="pt";
$tabShortNames[7]="ru";
$tabShortNames[8]="es";
$tabShortNames[9]="en";
$tabShortNames[10]="ro";
$tabShortNames[11]="pl";
$tabShortNames[12]="nl";
?>
<?php if(is_array($tabShortNames)){ $lang_id=array_search($_GET['lang'],$tabShortNames)+1; }else{ $lang_id=""; }?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo $_GET['lang'];?>" xml:lang="<?php echo $_GET['lang'];?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<script type="text/javascript">var langId="<?php echo $lang_id;?>"; var issetCaptcha=false;</script>
<style type="text/css">
body {
margin: 0px; padding: 0px; width:100%;
font-family: "Trebuchet MS",arial,verdana, serif;
font-weight: normal; font-size: 10px; color: #48566e; text-align: left; /* line-height: 1.3em; */
overflow-x: hidden;
/* overflow-y: hidden; */
}
span.span_chbx_radio { float:left; width:200px; }
input[type=submit] { opacity: 0.8; padding:5px; -moz-border-radius:5px; -webkit-border-radius:5px; -khtml-border-radius:5px; border:1px solid #E2E2E7; background-color:#8BA9DC; color:#ffffff; cursor: pointer;}
input[type=reset] { opacity: 0.8; padding:5px; -moz-border-radius:5px; -webkit-border-radius:5px; -khtml-border-radius:5px; border:1px solid #E2E2E7; background-color:#f5f5f5; color:#333333; cursor: pointer;}
input[type=submit]:hover, input[type=reset]:hover { opacity:0.5; }
a { color:#48566e; }
input[type=text], input[type=password] {
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
border:1px solid #8BA9DC;
background-color:#ffffff;
color:#48566e;
}
textarea {
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
border:1px solid #8BA9DC;
background-color:#ffffff;
color:#48566e;
}
fieldset {
border:1px solid #8BA9DC;
background-color:#ffffff;
margin: 5px;
min-height: 100px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
-khtml-border-radius:5px;
}
legend {
border:1px solid #ffffff;
background-color: #ffffff;
padding:4px;
color:#8BA9DC;
-moz-border-radius:4px;
-webkit-border-radius:4px;
-khtml-border-radius:4px;
font-size:1.2em;
}
.errorMessage {
font-size: 0.8em;
color:#cc0000;
}
.errorField, .errorFormat {
background-color: #ffe6e6;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
}
.submitError {
padding:5px;
color:#cc0000;
border: 1px solid #cc0000;
background-color: #ffe6e6;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-khtml-border-radius:3px;
}
label, .span_chbx_radio {
color:#48566e;
font-size: 0.8em;
}
.obligatoryField {
color:#cc0000;
font-size: 1.2em;
}
#success {
padding: 20px;
font-size: 16px;
}
</style>
<link rel="stylesheet" type="text/css" href="http://jquery-ui.googlecode.com/svn/tags/latest/themes/base/jquery.ui.all.css" />
<script src="../js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="../js/jquery-ui.min.js" type="text/javascript"></script>
<script src="../js/jquery.ui.datepicker.min.js"></script>
<script type="text/javascript">
$(function(){ $(".datepicker").datepicker({changeMonth: true,changeYear: true}); });
</script>
<script type="text/javascript">function validForm(){
/*
* Initialisation des variables
*/
var nbrErrors=0;
/*
* Fonctions de vérification des formatages
*/
function verifNumber(myString){ // idTag 3
if(isNaN(myString)){ return false; }else { return true; }
}
function verifEmail(myString){ // idTag 4
var reg= /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;
if(reg.test(myString)==true){
return true; // adresse valide
}
else{
return false; // adresse non valide
}
}
function verfifUrl(myString){ // idTag 5
var reg= /(http):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
if(reg.test(myString)==true){
return true; // adresse valide
}
else{
return false; // adresse non valide
}
}
function verifCaptcha(myString){ // idTag 15
myString = jQuery.trim(myString);
if(myString==''){
return false;
}else{
return true;
}
}
/*
* Gestion des FieldsetErrors
*/
function verifField(){
$.each(tabFieldsRequired, function(index,n){
var i=0;
var type=$('#element_id'+n+'-'+i).attr("type");
var str=$('#element_id'+n+'-'+i).val();
if(type=="checkbox" || type=="radio"){
var checkStr=false;
while(typeof $('#element_id'+n+'-'+i).attr('checked')!=="undefined"){
if($('#element_id'+n+'-'+i).attr('checked')==true){checkStr=true;}
i++;
}
if(checkStr==false){
$('#errorField_'+n).html(tabErrorFields[n][langId]).hide().fadeIn(2000).css({"padding":"2px 2px 2px 8px"});
nbrErrors++;
}else{
$('#errorField_'+n).html('').css({"padding":"0px"});
}
}else{
str = jQuery.trim(str);
if(str==''){
$('#errorField_'+n).html(tabErrorFields[n][langId]).hide().fadeIn(2000).css({"padding":"2px 2px 2px 8px"});
nbrErrors++;
}
else{
if(str!=''){
$('#errorField_'+n).html('').css({"padding":"0px"});
}
}
}
// Gestion du captcha
var ElemClass=$('#element_id'+n+'-'+i).attr("class");
if(ElemClass=='formallin_captcha' && !verifCaptcha(str)){
$('td#tdCaptcha input').css({"background-color":"FFE6E6"});
nbrErrors++;
}else{
$('td#tdCaptcha input').css({"background-color":"fff"});
}
});
}
/*
* Gestion des FormatErrors
*/
function verifFormat(){
$.each(tabFormatsRequired, function(index,n){
var i=0;
var ElemClass=$('#element_id'+n+'-'+i).attr("class");
var ElemValue=$('#element_id'+n+'-'+i).val();
ElemValue = jQuery.trim(ElemValue);
switch(ElemClass){
case 'formallin_numeric' : if(!verifNumber(ElemValue) && ElemValue!=''){
$('#errorFormat_'+n).html(tabErrorFormats[n][langId]).hide().fadeIn(2000).css({"padding":"2px 2px 2px 8px"});
nbrErrors++;
}else{
$('#errorFormat_'+n).html('').css({"padding":"0px"});
}
break;
case 'formallin_email' : if(!verifEmail(ElemValue) && ElemValue!=''){
$('#errorFormat_'+n).html(tabErrorFormats[n][langId]).hide().fadeIn(2000).css({"padding":"2px 2px 2px 8px"});
nbrErrors++;
}else{
$('#errorFormat_'+n).html('').css({"padding":"0px"});
}
break;
case 'formallin_url' : if(!verfifUrl(ElemValue) && ElemValue!=''){
$('#errorFormat_'+n).html(tabErrorFormats[n][langId]).hide().fadeIn(2000).css({"padding":"2px 2px 2px 8px"});
nbrErrors++;
}else{
$('#errorFormat_'+n).html('').css({"padding":"0px"});
}
break;
// case 'datepicker' : ;
// break;
}
});
}
/*
* Execution des tests
*/
verifField();
verifFormat();
/*
* Evaluation finale
*/
if(nbrErrors==0){
return true;
}else{
return false;
}
}</script>
<?php
switch($lang_id){
case 1 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-zh-CN.js"></script>';
break;
case 2 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-ca.js"></script>';
break;
case 3 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-da.js"></script>';
break;
case 4 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-de.js"></script>';
break;
case 5 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-fr.js"></script>';
break;
case 6 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-it.js"></script>';
break;
case 7 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-pt-BR.js"></script>';
break;
case 8 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-ru.js"></script>';
break;
case 9 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-es.js"></script>';
break;
case 10 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-en-GB.js"></script>';
break;
case 11 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-ro.js"></script>';
break;
case 12 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-pl.js"></script>';
break;
case 13 : echo '<script src="../js/datepicker_i8n/jquery.ui.datepicker-nl.js"></script>';
break;
}
?>
</head>
<body>
<?php define("_TAB_FORMALLEX","formallin_formallex"); ?>
<?php $sessionFormallinEditor = "W74sbtAurtDHqKSHwsTQL71KinteXLdSi7kjICvY"; ?>
<?php if( isset($_POST['submit']) ){ // le formulaire a été posté
$depart = substr(element_id4,0,2); // 0 ou 1 à vérifier
if (strpos('93;95;60;62;80;59;02;27;28;76;14;50',$depart) !== false) {
$email = "adresseA@gmail.com";
$formName="Devis TEST";
$emailSubject="Informations transmises par le formulaire";
} else {
if( date("d") % 2 == 0 )
$email="adresseA@gmail.com";// nous sommes un jour pair
else
$email="adresseB@gmail.com";// nous sommes un jour impair
$formName="Devis TEST";
$emailSubject="Informations transmises par le formulaire";
}
?>
<?php
//-------------------------------------------------------------------------------------------------------
/* version 1.3 | author : Leo West | lwest@free.fr
*/
class Mail{
var $sendto = array();
var $acc = array();
var $abcc = array();
var $aattach = array();
var $xheaders = array();
var $priorities = array( '1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)' );
var $charset = "utf-8"; /* us-ascii */
var $ctencoding = "7bit";
var $receipt = 0;
function Mail(){
$this->autoCheck( true );
$this->boundary= "--" . md5( uniqid("myboundary") );
}
function autoCheck( $bool ){
if( $bool )
$this->checkAddress = true;
else
$this->checkAddress = false;
}
function Subject( $subject ){
$this->xheaders['Subject'] = strtr( $subject, "\r\n" , " " );
}
function From( $from ){
if( ! is_string($from) ) {
echo "Class Mail: error, From is not a string";
exit;
}
$this->xheaders['From'] = $from;
}
function ReplyTo( $address ){
if( ! is_string($address) )
return false;
$this->xheaders["Reply-To"] = $address;
}
function Receipt(){
$this->receipt = 1;
}
function To( $to ){
if( is_array( $to ) )
$this->sendto= $to;
else
$this->sendto[] = $to;
if( $this->checkAddress == true )
$this->CheckAdresses( $this->sendto );
}
function Cc( $cc ){
if( is_array($cc) )
$this->acc= $cc;
else
$this->acc[]= $cc;
if( $this->checkAddress == true )
$this->CheckAdresses( $this->acc );
}
function Bcc( $bcc ){
if( is_array($bcc) ) {
$this->abcc = $bcc;
} else {
$this->abcc[]= $bcc;
}
if( $this->checkAddress == true )
$this->CheckAdresses( $this->abcc );
}
function Body( $body, $charset="" ){
$this->body = $body;
if( $charset != "" ) {
$this->charset = strtolower($charset);
if( $this->charset != "utf-8" ) /* us-ascii */
$this->ctencoding = "8bit";
}
}
function Organization( $org ){
if( trim( $org != "" ) )
$this->xheaders['Organization'] = $org;
}
function Priority( $priority ){
if( ! intval( $priority ) )
return false;
if( ! isset( $this->priorities[$priority-1]) )
return false;
$this->xheaders["X-Priority"] = $this->priorities[$priority-1];
return true;
}
function Attach( $filename, $filetype = "", $disposition = "inline" ){
if( $filetype == "" )
$filetype = "application/x-unknown-content-type";
$this->aattach[] = $filename;
$this->actype[] = $filetype;
$this->adispo[] = $disposition;
}
function BuildMail(){
$this->headers = "";
if( count($this->acc) > 0 )
$this->xheaders['CC'] = implode( ", ", $this->acc );
if( count($this->abcc) > 0 )
$this->xheaders['BCC'] = implode( ", ", $this->abcc );
if( $this->receipt ) {
if( isset($this->xheaders["Reply-To"] ) )
$this->xheaders["Disposition-Notification-To"] = $this->xheaders["Reply-To"];
else
$this->xheaders["Disposition-Notification-To"] = $this->xheaders['From'];
}
if( $this->charset != "" ) {
$this->xheaders["Mime-Version"] = "1.0";
$this->xheaders["Content-Type"] = "text/plain; charset=$this->charset";
$this->xheaders["Content-Transfer-Encoding"] = $this->ctencoding;
}
$this->xheaders["X-Mailer"] = "Php/libMailv1.3";
if( count( $this->aattach ) > 0 ) {
$this->_build_attachement();
} else {
$this->fullBody = $this->body;
}
reset($this->xheaders);
while( list( $hdr,$value ) = each( $this->xheaders ) ) {
if( $hdr != "Subject" )
$this->headers .= "$hdr: $value\n";
}
}
function Send(){
$this->BuildMail();
$this->strTo = implode( ", ", $this->sendto );
$res = @mail( $this->strTo, $this->xheaders['Subject'], $this->fullBody, $this->headers );
}
function Get(){
$this->BuildMail();
$mail = "To: " . $this->strTo . "\n";
$mail .= $this->headers . "\n";
$mail .= $this->fullBody;
return $mail;
}
function ValidEmail($address){
if( preg_match( "#.*<(.+)>#", $address, $regs ) ) {
$address = $regs[1];
}
if(preg_match( "#^[^@ ]+@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-]{2}|net|com|gov|mil|org|edu|int)\$#",$address) )
return true;
else
return false;
}
function CheckAdresses( $aad ){
for($i=0;$i< count( $aad); $i++ ) {
if( ! $this->ValidEmail( $aad[$i]) ) {
echo "Class Mail, method Mail : invalid address $aad[$i]";
exit;
}
}
}
function _build_attachement(){
$this->xheaders["Content-Type"] = "multipart/mixed;\n boundary=\"$this->boundary\"";
$this->fullBody = "This is a multi-part message in MIME format.\n--$this->boundary\n";
$this->fullBody .= "Content-Type: text/plain; charset=$this->charset\nContent-Transfer-Encoding: $this->ctencoding\n\n" . $this->body ."\n";
$sep= chr(13) . chr(10);
$ata= array();
$k=0;
for( $i=0; $i < count( $this->aattach); $i++ ) {
$filename = $this->aattach[$i];
$basename = basename($filename);
$ctype = $this->actype[$i]; // content-type
$disposition = $this->adispo[$i];
if( ! file_exists( $filename) ) {
echo "Class Mail, method attach : file $filename can't be found"; exit;
}
$subhdr= "--$this->boundary\nContent-type: $ctype;\n name=\"$basename\"\nContent-Transfer-Encoding: base64\nContent-Disposition: $disposition;\n filename=\"$basename\"\n";
$ata[$k++] = $subhdr;
$linesz= filesize( $filename)+1;
$fp= fopen( $filename, 'r' );
$ata[$k++] = chunk_split(base64_encode(fread( $fp, $linesz)));
fclose($fp);
}
$this->fullBody .= implode($sep, $ata);
}
}
//-------------------------------------------------------------------------------------------------------
?><?php
$tabGroupeElementsLabel=unserialize(base64_decode($_POST['tabGroupeElementsLabel']));
$tabLabelText=unserialize(base64_decode($_POST['tabLabelText']));
$tabErrorFields=unserialize(base64_decode($_POST['tabErrorFields']));
$tabErrorFormats=unserialize(base64_decode($_POST['tabErrorFormats']));
$tabShortNames=unserialize(base64_decode($_POST['tabShortNames']));
$lang_id=array_search($_GET['lang'],$tabShortNames)+1;
$sys_lang_id=$_POST['sli'];
$lines='IP : '.$_SERVER['SERVER_ADDR'].'<br />'; // collecte de l'ip du visiteur
$nbrErrors=0;
$errorsText='';
foreach($tabGroupeElementsLabel as $key=>$tab){
$tagId=$tab[0];
$textLabel=$tabLabelText[$key][$lang_id];
$fieldRequired=$tab[2];
if($fieldRequired=="yes"){
switch($tagId){
case 1 : if(isset($_POST['element_text'][$key])){$val=trim($_POST['element_text'][$key]);} if(empty($val)){ $nbrErrors++; $errorsText.="\"$textLabel\" : ".$tabErrorFields[$key][$lang_id]."<br />";} break;
case 2 : if(isset($_POST['element_password'][$key])){$val=trim($_POST['element_password'][$key]);} if(empty($val)){ $nbrErrors++; $errorsText.="\"$textLabel\" : ".$tabErrorFields[$key][$lang_id]."<br />";} break;
case 3 : if(isset($_POST['element_numeric'][$key])){$val=trim($_POST['element_numeric'][$key]);} if(empty($val)){ $nbrErrors++; $errorsText.="\"$textLabel\" : ".$tabErrorFields[$key][$lang_id]."<br />";} break;
case 4 : if(isset($_POST['element_email'][$key])){$val=trim($_POST['element_email'][$key]);} if(empty($val)){ $nbrErrors++; $errorsText.="\"$textLabel\" : ".$tabErrorFields[$key][$lang_id]."<br />";} break;
case 5 : if(isset($_POST['element_url'][$key])){$val=trim($_POST['element_url'][$key]);} if(empty($val)){ $nbrErrors++; $errorsText.="\"$textLabel\" : ".$tabErrorFields[$key][$lang_id]."<br />";} break;
case 6 : if(isset($_POST['element_textarea'][$key])){$val=trim($_POST['element_textarea'][$key]);} if(empty($val)){ $nbrErrors++; $errorsText.="\"$textLabel\" : ".$tabErrorFields[$key][$lang_id]."<br />";} break;
case 7 : if(isset($_POST['element_checkbox'][$key])){$val=trim($_POST['element_checkbox'][$key][0]);} if(empty($val)){ $nbrErrors++; $errorsText.="\"$textLabel\" : ".$tabErrorFields[$key][$lang_id]."<br />";} break;
case 8 : if(isset($_POST['element_radio'][$key])){$val=trim($_POST['element_radio'][$key]);} if(empty($val)){ $nbrErrors++; $errorsText.="\"$textLabel\" : ".$tabErrorFields[$key][$lang_id]."<br />";} break;
case 9 : if(isset($_POST['element_select'][$key])){$val=trim($_POST['element_select'][$key]);} if(empty($val)){ $nbrErrors++; $errorsText.="\"$textLabel\" : ".$tabErrorFields[$key][$lang_id]."<br />";} break;
case 10 : if(isset($_POST['element_datepicker'][$key])){$val=trim($_POST['element_datepicker'][$key]);} if(empty($val)){ $nbrErrors++; $errorsText.="\"$textLabel\" : ".$tabErrorFields[$key][$lang_id]."<br />";} break;
case 11 : if(isset($_POST['element_file'][$key])){$val=trim($_POST['element_file'][$key]);} if(empty($val)){ $nbrErrors++; $errorsText.="\"$textLabel\" : ".$tabErrorFields[$key][$lang_id]."<br />";} break;
case 15 : if(isset($_POST['element_captcha'][$key])){$val=trim($_POST['element_captcha'][$key]);} if(empty($val)){ $nbrErrors++; $errorsText.=$tabErrorFields[$key][$lang_id]."<br />";} break;
}
}
}
if($nbrErrors==0){
foreach($tabGroupeElementsLabel as $key=>$tab){
foreach($tab as $tagId=>$textLabel){
$tagId=$tab[0];
$textLabel=$tabLabelText[$key][$lang_id];
}
if($tagId==3){
if (!is_numeric($_POST['element_numeric'][$key]) && !empty($_POST['element_numeric'][$key])){
$nbrErrors++;
$errorsText.='"'.$textLabel.'" : ';
$errorsText.=$tabErrorFormats[$key][$lang_id]."<br />";
$errorsText.="<br />";
}
}
elseif($tagId==4){
if (!preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#", $_POST['element_email'][$key]) && !empty($_POST['element_email'][$key])){
$nbrErrors++;
$errorsText.='"'.$textLabel.'" : ';
$errorsText.=$tabErrorFormats[$key][$lang_id]."<br />";
$errorsText.="<br />";
}
}
elseif($tagId==5){
if(strpos($_POST['element_url'][$key], 'http://') === FALSE && !empty($_POST['element_url'][$key])){
$nbrErrors++;
$errorsText.='"'.$textLabel.'" : ';
$errorsText.=$tabErrorFormats[$key][$lang_id]."<br />";
$errorsText.="<br />";
}
}
elseif($tagId==10){
}
elseif($tagId==11){
//print_r($tabExtension);
}
elseif($tagId==15){
if( isset($_SESSION['security_code']) && ($_SESSION['security_code'] != $_POST['element_captcha'][$key])) {
$nbrErrors++;
$errorsText.=$tabErrorFields[$key][$lang_id]."<br />";
$errorsText.="<br />";
}
}
}
if($nbrErrors==0){
/*
* Récupération des Labels et des champs pour l'email envoyé au contact administratif
*/
foreach($tabGroupeElementsLabel as $key=>$tab){
foreach($tab as $tagId=>$textLabel){
$tagId=$tab[0];
$textLabel=$tab[1];
}
if($tagId!=15){$lines.=$textLabel.' : ';}
switch($tagId){
case 1 : if(isset($_POST['element_text'][$key])){$lines.=trim($_POST['element_text'][$key]);} break;
case 2 : if(isset($_POST['element_password'][$key])){$lines.=trim($_POST['element_password'][$key]);} break;
case 3 : if(isset($_POST['element_numeric'][$key])){$lines.=trim($_POST['element_numeric'][$key]);} break;
case 4 : if(isset($_POST['element_email'][$key])){$lines.=trim($_POST['element_email'][$key]);} break;
case 5 : if(isset($_POST['element_url'][$key])){$lines.=trim($_POST['element_url'][$key]);} break;
case 6 : if(isset($_POST['element_textarea'][$key])){$lines.=trim($_POST['element_textarea'][$key]);} break;
case 7 : if(isset($_POST['element_checkbox'][$key]) && !empty($_POST['element_checkbox'][$key])){foreach($_POST['element_checkbox'][$key] as $key=>$value){$lines.=trim($value).", ";}} break;
case 8 : if(isset($_POST['element_radio'][$key])){$lines.=trim($_POST['element_radio'][$key]);} break;
case 9 : if(isset($_POST['element_select'][$key])){$lines.=trim($_POST['element_select'][$key]);} break;
case 10 : if(isset($_POST['element_datepicker'][$key])){$lines.=trim($_POST['element_datepicker'][$key]);} break;
case 11 : if(isset($_POST['element_file'][$key])){$lines.=trim($_POST['element_file'][$key]);} break;
}
$lines.="<br /><br />";
}
/*
* Envoi de l'email
*/
$lines=str_replace("<br />","\n",$lines);
$em=explode(";",$email);
foreach($em as $e){ // boucle pour transmettre la soumission du formulaire à tous les destinataires concernés
// construction de l'email
$subject=$emailSubject.' ['.$formName.']';
$tab=explode("@",$e);
$ndd=$tab[1];
$expediteur="no-reply@$ndd";
$m= new Mail;
$m->From($expediteur);
$m->To($e);
$m->Subject($subject);
$m->Body(stripslashes($lines));
$m->Priority(1);
// envoie de l'email
$m->Send();
}
include_once("../../connectors/formallin_connector_bddAcces.php"); /* FORMALLIN */
// connexion
global $db;
include("../../db.php");
$db=new DB;
$db->_connectar();
include_once('../classes/FA_Sql.class.php');
include_once('../classes/FA_Formallex.class.php');
function fa_inDB($string){
return mysql_real_escape_string(stripslashes($string));
}
$formallex = new FA_Formallex();
$formallex->setSessionFormallinEditor($sessionFormallinEditor);
$formallex->setContent(stripslashes($lines));
$formallex->createFormallex();
$db->_desconnectar();
}
}
?><?php } ?><?php if(in_array($lang_id,$tab_langIds)){ ?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>?lang=<?php echo $_GET['lang'];?>" onSubmit="return validForm();">
<fieldset>
<legend><?php echo $tabFieldsetLegends[$lang_id];?></legend>
<table>
<?php
$tabLabelText[0][5]="Code postal";
?>
<script type="text/javascript">
tabErrorFormats[0] = new Array();
tabErrorFormats[0][5]="le format n'est pas respecté";
tabFormatsRequired.push(0);
</script>
<tr>
<td><label for="element_id0-0"><?php echo $tabLabelText[0][$lang_id];?></label></td>
<td><input type="text" size="20" maxlength="45" class="formallin_numeric" name="element_numeric[0]" id="element_id0-0"/></td>
</tr>
<tr><td></td><td><div class="errorMessage" id="error_0"><div class="errorField" id="errorField_0"></div><div class="errorFormat" id="errorFormat_0"></div></div></td></tr><tr><td></td><td></td></tr>
<input type="hidden" name="tabGroupeElementsLabel" value="YToxOntpOjA7YTozOntpOjA7czoxOiIzIjtpOjE7czoxMToiQ29kZSBwb3N0YWwiO2k6MjtzOjI6Im5vIjt9fQ==" />
<input type="hidden" name="tabErrorFields" value="czowOiIiOw==" />
<input type="hidden" name="tabErrorFormats" value="YToxOntpOjA7YToxOntpOjU7czoyOToibGUgZm9ybWF0IG4nZXN0IHBhcyByZXNwZWN0w6kiO319" />
<input type="hidden" name="tabShortNames" value="<?php echo base64_encode(serialize($tabShortNames));?>" />
<input type="hidden" name="tabLabelText" value="<?php echo base64_encode(serialize($tabLabelText));?>" />
<input type="hidden" name="sli" value="5" />
<tr><td> </td><td><?php if(isset($_POST['submit']) && $nbrErrors>0){ echo '<div class="submitError"><br />'.$errorsText.'<br /></div>'; }?></td></tr>
<?php
$tabAttributesValues_1['value'][5]="valider";
?>
<tr><td><input id="element_id1-0" name="submit" type="submit" class="formallin_submit" value="<?php echo $tabAttributesValues_1['value'][$lang_id];?>" /> -
<?php
$tabAttributesValues_2['value'][5]="effacer";
?>
<input id="element_id2-0" name="reset" type="reset" class="formallin_reset" value="<?php echo $tabAttributesValues_2['value'][$lang_id];?>" /></td></tr>
</table>
</fieldset>
</form>
<?php
if(isset($_POST['submit']) && $nbrErrors==0){
$lang = $_GET['lang'];
// si le message a bien été transmis
$tabLangSuccess['fr'] = "Les informations que vous avez saisies ont bien été transmises. Nous vous en remercions."; // France
// si le message n'a pu être transmis
$tabLangFailure['fr'] = "Les informations que vous avez saisies n'ont pu être transmises, veuillez réessayer ultérieurement."; // France
$messageText = $tabLangSuccess[$lang];
$successMessage=<<<msn
<script type="text/javascript">
var SUCCESS_MESSAGE="$messageText";
</script>
msn;
echo $successMessage;
?>
<script type="text/javascript">
$(document).ready(function(){
var bgColor = $('fieldset').css('backgroundColor');
// effet lumineux et confirmation de soumission du formulaire
$('fieldset').animate({backgroundColor:"#9ee19a", opacity:0},500)
.animate({backgroundColor:bgColor,opacity:1},500 )
.animate({opacity:0},500 )
.queue(function(){
$('fieldset').html('<div id="success">'+SUCCESS_MESSAGE+'</div>').css({opacity:1});
$('#success').hide().fadeIn('slow');
})
});
</script>
<?php
};
?>
<?php } ?>
</body>
</html> |
Partager