%PDF- %PDF-
Direktori : /home/alliance/domains/sedl.alnetis.fr/public_html/ |
Current File : /home/alliance/domains/sedl.alnetis.fr/public_html/p-inscription.php |
<?php include_once("inc/config.php"); include_once("inc/functions.php"); include_once("inc/init.php"); include_once("inc/phpmailer/class.phpmailer.php"); //edition en cours $actual_edition=$edition->getCurrentEdition("ins_front",$lang->getlangid()); if(isset($_POST['post']) && $_POST['post'] == 1) { $_POST['email_contact']=trim($_POST['email_contact']); $_POST['email']=trim($_POST['email']); $post_data = http_build_query( array( 'secret' => '6Len0VsUAAAAANt76oQqYwUyOOPBskrQAnNfsJ4r', 'response' => $_POST['g-recaptcha-response'], 'remoteip' => $_SERVER['REMOTE_ADDR'] ) ); $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $post_data ) ); $context = stream_context_create($opts); $response = file_get_contents('https://www.google.com/recaptcha/api/siteverify', false, $context); $result = json_decode($response); if (!$result->success) { $erreur = lang("captcha"); } else { $erreur = "ok"; } if($erreur == "ok") $erreur = $db->verif($_POST['community_name'], "Le nom de la collectivité"); if($erreur == "ok") $erreur = $db->verif($_POST['country'], "Le pays"); if($_POST['type']!=3){ if($erreur == "ok") $erreur = $db->verif($_POST['population'], "La population"); } if($erreur == "ok") $erreur = $edition->verifCondition($actual_edition['id'],$_POST['type'],$_POST['condition_'.$_POST['type']],$lang->getlangid()); if($erreur == "ok") $erreur = $db->verif($_POST['civility'], "La civilité"); if($erreur == "ok") $erreur = $db->verif($_POST['firstname'], "Le prénom"); if($erreur == "ok") $erreur = $db->verif($_POST['lastname'], "Le nom de famille"); if($erreur == "ok") $erreur = verifie_email($_POST['email_contact']); if($erreur == "ok") $erreur = verifie_email($_POST['email']); if($erreur == "ok") $erreur = $db->verif($_POST['email_contact'], "L'email de contact"); if($erreur == "ok") $erreur = $db->verif($_POST['function'], "La fonction"); if($erreur == "ok") $erreur = $db->verif($_POST['postcode'], "Le code postal"); if($erreur == "ok") $erreur = $db->verif($_POST['ville'], "La ville"); if($erreur == "ok") $erreur = $db->verif($_POST['email'], "L'email"); if($erreur == "ok") { $queryverif = "SELECT * FROM `user` WHERE email = ".$db->qS($_POST['email']); if($db->isres($queryverif)) { $erreur = $admtext->getText("email_deja_pris",$lang->getlangid()).' <a href="'.$lang->getlang().'/admin/password.php">'.lang("passwoubli").'</a>'; } } if($erreur == "ok") { $next_id = $db->next_id("section"); $next_id_user = $db->next_id("user"); $password=createRandomPassword(); //utilisateur $values = array( "id" => $next_id_user, "email" => $_POST['email'], "email_contact" => $_POST['email_contact'], "password" => md5("amicalesite".$password), "type" => 1, "section" => $next_id, "nom" => $_POST['lastname'], "prenom" => $_POST['firstname'], "civilite" => $_POST['civility'], "fonction" => $_POST['function'], "telephone" => $_POST['phone'], "lang" => $lang->getlangid(), "service" => $_POST['service']); $db->insert("user", $values); $values = array( "id" => $next_id, "pays" => $_POST['country'], "type" => $_POST['type'], "site" => $_POST['website'], "profil" => $_POST['type'], "adresse" => $_POST['address'], "codepostal" => $_POST['postcode'], "ville" => $_POST['ville'], "population" => $_POST['population'] ); $db->insert("section", $values); //section fr $values = array( "section" => $next_id, "lang" =>1, "titre" => $_POST['community_name'], "permalien"=>cleanUrl($_POST['community_name']), "partenaire" => $_POST['part_partner'] ); $db->insert("section_lang", $values); //section en $values = array( "section" => $next_id, "lang" =>2, "titre" => $_POST['community_name'], "permalien"=>cleanUrl($_POST['community_name']), "partenaire" => $_POST['part_partner'] ); $db->insert("section_lang", $values); //valide pour l'edition $values = array( "section" => $next_id, "valide" =>0, "edition" => $actual_edition['id'] ); $db->insert("section_edition", $values); $query = "SELECT q.*,ql.libelle FROM `question` q LEFT JOIN `question_lang` ql ON q.id=ql.question WHERE q.edition = ".$actual_edition['id']." AND q.profil=".$_POST['type']." AND ql.lang = 1 ORDER BY ordre ASC"; $questions = $db->select_arrays($query); $query_en = "SELECT q.*,ql.libelle FROM `question` q LEFT JOIN `question_lang` ql ON q.id=ql.question WHERE q.edition = ".$actual_edition['id']." AND q.profil=".$_POST['type']." AND ql.lang = 2 ORDER BY ordre ASC"; $questions_en = $db->select_arrays($query_en); $text_response=""; $text_response_en=""; foreach($questions as $numquestion=>$question){ $text_response.="<p><strong>".$question['libelle']."</strong></p>"; $text_response_en.="<p><strong>".$questions_en[$numquestion]['libelle']."</strong></p>"; if($question['type']=="radio"){ // test du champ libre if(!isset($_POST['response_'.$_POST['question_'.$question['id']]]) && $_POST['response_'.$_POST['question_'.$question['id']]]!=""){ $next_id_response = $db->next_id("section_response"); $values = array( "id" => $next_id_response, "section" => $next_id, "response" => $_POST['question_'.$question['id']], "question" => $question['id'], "libre" => 0); $db->insert("section_response", $values); $query='SELECT * FROM `response_lang` WHERE response='.$_POST['question_'.$question['id']].' AND lang=1'; $value=$db->select_array($query); $query_en='SELECT * FROM `response_lang` WHERE response='.$_POST['question_'.$question['id']].' AND lang=2'; $value_en=$db->select_array($query_en); $text_response.="<p>".$value['libelle']."</p>"; $text_response_en.="<p>".$value_en['libelle']."</p>"; } else{ $next_id_response = $db->next_id("section_response"); $values = array( "id" => $next_id_response, "section" => $next_id, "response" => $_POST['question_'.$question['id']], "question" => $question['id'], "libre" => 1); $db->insert("section_response", $values); $value=""; $value=$_POST['response_'.$_POST['question_'.$question['id']]]; //lang fr $next_id_response = $db->next_id("section_response"); $values = array( "section_response" => $next_id_response, "lang" =>1, "value" => $value); $text_response.="<p>".$value."</p>"; $text_response_en.="<p>".$value."</p>"; $db->insert("section_response_lang", $values); $value=""; if($lang->getlangid()==2){ $value=$_POST['response_'.$_POST['question_'.$question['id']]]; } //lang en $next_id_response = $db->next_id("section_response"); $values = array( "section_response" => $next_id_response, "lang" =>2, "value" => $value); $db->insert("section_response_lang", $values); } } else{ foreach($_POST['question_'.$question['id']] as $une_res){ $query='SELECT r.*,rl.libelle FROM `response` r LEFT JOIN `response_lang` rl ON r.id=rl.response WHERE response='.$une_res.' AND lang=1'; $value=$db->select_array($query); $query_en='SELECT r.*,rl.libelle FROM `response` r LEFT JOIN `response_lang` rl ON r.id=rl.response WHERE response='.$une_res.' AND lang=2'; $value_en=$db->select_array($query_en); if($value['libre']==0){ $text_response.="<p>".$value['libelle']."</p>"; $text_response_en.="<p>".$value_en['libelle']."</p>"; } else{ if(isset($_POST['response_'.$une_res]) && $_POST['response_'.$une_res]!=""){ $value=$_POST['response_'.$une_res]; $text_response.="<p>".$value."</p>"; $text_response_en.="<p>".$value."</p>"; } } } } } $next_id_response = $db->next_id("response_champ"); $values = array( "section" => $next_id, "edition" =>$actual_edition['id'] ); $db->insert("response_champ", $values); //fr $values = array( "response" => $next_id_response, "lang" =>1, "texte" => $text_response ); $db->insert("response_champ_lang", $values); //en $values = array( "response" => $next_id_response, "lang" =>2, "texte" => $text_response_en ); $db->insert("response_champ_lang", $values); // envoi du mail de validation $message=''; $message.=stripslashes($admtext->getText("adm_mail_ins",$lang->getlangid(),null,$_POST['type'])." <p>".$admtext->getText("info_con",$lang->getlangid())."</p> <p><strong>".$admtext->getText("ins_email",$lang->getlangid())."</strong> : ".$_POST['email']."</p> <p><strong>".$admtext->getText("password",$lang->getlangid())."</strong> : ".$password."</p> <br /><p></p>"); /*mail($_POST['email'], $subject, " <html> <head> <title>Contact letter</title> </head> <body> <br> ".$message." </body> </html>" , $headers);*/ $yes = true; $header = get_temp("templates/newsletter/header_page.php", $url_site); $footer = get_temp("templates/newsletter/header_page.php", $url_site); $message=$header.$message.$footer; $subject="=?UTF-8?B?".base64_encode(stripslashes("Confirmation de votre inscription"))."?="; $headers= "From: \"SEDL\" <".$email_contact.">\n"; $headers.='Content-type: text/html; charset=utf-8'; $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; $mail->From = "sedl@octomail.info"; $mail->FromName = "SEDL"; $mail->addReplyTo($email_contact); $mail->Subject =$subject; $mail->MsgHTML($message); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPDebug = 0; // enables SMTP debug information (for testing) $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "smtp.octomail.info"; // sets the SMTP server $mail->Port = 587; // set the SMTP port for the GMAIL server $mail->Username = "sedl@octomail.info"; // SMTP account username $mail->Password = "2UFvaB1eqj5QeQv8"; $mail->MsgHTML($message); $mail->AddAddress($_POST['email']); $mail->Send(); $mail->ClearAddresses(); header("Location:inscription-".$_POST['email'].".html"); exit(0); } else { $err = true; } } //affichage du html include("theme/html.php"); //affichage des metas include("theme/meta.php"); echo "\n<title>Inscription - ".$info_titresite."</title>\n"; //affichage du header include("theme/header.php"); //colonne de droite include("theme/droite.php"); ?> <?$actual_edition=$edition->getCurrentEdition("ins",$lang->getlangid()); ?> <div class="blanc padding mt10"> <h1><?=lang("Inscription") ?></h1> <div class="presentation"><?=$admtext->getText("libreins",$lang->getlangid());?><div> <div class="presentation"><p><br/><?=$admtext->getText("inscription_coordinateur",$lang->getlangid());?> <b><a href="<?=$lang->getlang()?>/inscription_coordinateur.html"><?=$admtext->getText("lien_inscription_coordinateur",$lang->getlangid());?></a></b></p></div> <? if(date('Y-m-d')<=$actual_edition['date_finins']):?> <div class="choix_profil"><?=$admtext->getText("community_choose",$lang->getlangid());?></div> <div class="profil flexcontent"> <? $profils=$profil->getProfils(); foreach ($profils as $unprofil): if($unprofil['id'] != 2):?> <div class="profil_ins bg_profil_<?=$unprofil['id']?>" id="profil_<?=$unprofil['id']?>"> <div class="hover padding2"> <h3><?=$unprofil['libelle']?></h3> <?=$admtext->getText("formins",$lang->getlangid(),$actual_edition['id'],$unprofil['id']);?> </div> </div> <?endif; endforeach; ?> </div> <div style="clear:both"></div> <div id="form_profil_1" class="form_profil"> <h3 class="ins_top padding2"><?=$admtext->getText("ins_youregisterhas",$lang->getlangid(),null,1);?></h3> <?php if(isset($err) && $err) { echo "<p class=\"erreurbloc\">".$erreur."</p>"; } if(isset($yes) && $yes) { echo $admtext->getText("ins_validation",$lang->getlangid()); echo "<p class=\"infobloc\">".lang("You will receive an email with our informations at :").$_POST['email']."</p>"; } ?> <form id="insc_form" method="post" action="<?=$lang->getlang();?>/inscription.html?type=1"><input type="hidden" name="type" value="1" /> <div class="title"><h3><?=$admtext->getText("ins_identcon",$lang->getlangid());?></h3></div> <input type="hidden" name="type" value="1" /> <div class="ligne"> <div class="label"><label for="email"><?=$admtext->getText("ins_email",$lang->getlangid());?></label> <span class="etoile">*</span></div> <div class="field"><input type="text" name="email" value="<?=(isset($_POST['email'])?$_POST['email']:'')?>" /></div> </div> <div class="title"><h3><?=$admtext->getText("our_collectivity",$lang->getlangid());?></h3></div> <div class="ligne"> <div class="label"><label for="community_name"><?=$admtext->getText("community_name",$lang->getlangid());?> <span class="etoile">*</span></label></div> <div class="field"><input type="text" name="community_name" value="<?=(isset($_POST['community_name'])?$_POST['community_name']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="address"><?=lang("Address") ?></label></div> <div class="field"><input type="text" name="address" value="<?=(isset($_POST['address'])?$_POST['address']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="postcode"><?=lang("Postcode") ?> <span class="etoile">*</span></label></div> <div class="field"><input type="text" name="postcode" value="<?=(isset($_POST['postcode'])?$_POST['postcode']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="ville"><?=lang("City") ?> <span class="etoile">*</span></label></div> <div class="field"><input type="text" name="ville" value="<?=(isset($_POST['ville'])?$_POST['ville']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="country"><?=lang("Country") ?> <span class="etoile">*</span></label></div> <div class="field"> <select name="country"> <?=$pays->getCountry($lang->getlangid(),$_POST['country'])?> </select> </div> </div> <div class="ligne"> <div class="label"><label for="population"><?=lang("Population") ?> <span class="etoile">*</span></label></div> <div class="field"><input type="text" name="population" value="<?=(isset($_POST['population'])?$_POST['population']:'')?>" /></div> </div> <div class="formatinsc"><?=lang("Populationformat") ?></div> <?$engagements=$edition->getConditions($actual_edition['id'],1,$lang->getlangid()); if($engagements!=null):?> <div class="ligne"> <div class="label_full"><label for="part_partner"><?=$admtext->getText("engagements",$lang->getlangid());?> <span class="etoile">*</span></label></div> </div> <?=$engagements?> <? endif; ?> <div class="ligne"> <div class="label"><label for="website"><?=lang("Website") ?></label></div> <div class="field"><input type="text" name="website" value="<?=(isset($_POST['website'])?$_POST['website']:'')?>" /></div> </div> <?=$edition->getQuestions($actual_edition['id'],1,$lang->getlangid())?> <div class="ligne"> <div class="label_full"><label for="part_partner"><?=$admtext->getText("question_colpartner",$lang->getlangid());?></label></div> </div> <div class="ligne"> <div class="field"><input type="text" name="part_partner" value="<?=(isset($_POST['part_partner'])?$_POST['part_partner']:'')?>" /></div> </div> <div class="title"><h3><?=$admtext->getText("contact_person",$lang->getlangid());?></h3></div> <div class="ligne"> <div class="label"><?=lang("Civility") ?> <span class="etoile">*</span></div> <div class="check"><input type="radio" name="civility" value="<?=lang("Mrs.") ?>"/> <?=lang("Mrs.") ?> <input type="radio" name="civility" value="<?=lang("Mr.") ?>"/> <?=lang("Mr.") ?></div> </div> <div class="ligne"> <div class="label"><label for="lastname"><?=lang("Last name") ?></label> <span class="etoile">*</span></div> <div class="field"><input type="text" name="lastname" value="<?=(isset($_POST['lastname'])?$_POST['lastname']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="firstname"><?=lang("First name") ?></label> <span class="etoile">*</span></div> <div class="field"><input type="text" name="firstname" value="<?=(isset($_POST['firstname'])?$_POST['firstname']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="email_contact"><?=lang("Email contact") ?></label> <span class="etoile">*</span></div> <div class="field"><input type="text" name="email_contact" value="<?=(isset($_POST['email_contact'])?$_POST['email_contact']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="function"><?=lang("Function") ?></label> <span class="etoile">*</span></div> <div class="field"><input type="text" name="function" value="<?=(isset($_POST['function'])?$_POST['function']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="phone"><?=lang("Phone") ?></label></div> <div class="field"><input type="text" name="phone" value="<?=(isset($_POST['phone'])?$_POST['phone']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="service"><?=lang("Activities's department") ?></label></div> <div class="field"><input type="text" name="service" value="<?=(isset($_POST['service'])?$_POST['service']:'')?>" /></div> </div> <div class="form_bouton"> <div class="captchabox mt10"> <div class="captcha"> <div class="g-recaptcha" data-sitekey="6Len0VsUAAAAAM3_8GB1s3xDWWBbUvYhlXKN2LvC"></div> </div> </div> <input type="hidden" value="1" name="post"> <input id="maj_bouton" class="bouton mt10" type="submit" value="<?=lang("Register your community") ?>"> </div> </form> </div> <div id="form_profil_3" class="form_profil" style="display:none"> <h3 class="ins_top padding2"><?=$admtext->getText("ins_youregisterhas",$lang->getlangid(),null,3);?></h3> <?php if(isset($err) && $err) { echo "<p class=\"erreurbloc\">".$erreur."</p>"; } if(isset($yes) && $yes) { echo "<p class=\"infobloc\">Merci pour votre inscription vous allez recevoir un mail contenant vos identifiants de connexion</p>"; } ?> <form id="insc_form" method="post" action="<?=$lang->getlang();?>/inscription.html?type=3"><input type="hidden" name="type" value="3" /> <div class="ligne"> <div class="title"><h3><?=$admtext->getText("ins_identcon",$lang->getlangid());?></h3></div> </div> <div class="ligne"> <input type="hidden" name="type" value="3" /> <div class="label"><label for="email"><?=$admtext->getText("ins_email",$lang->getlangid());?></label> <span class="etoile">*</span></div> <div class="field"><input type="text" name="email" value="<?=(isset($_POST['email'])?$_POST['email']:'')?>" /></div> </div> <div class="title"><h3><?=$admtext->getText("our_collectivity",$lang->getlangid());?></h3></div> <div class="ligne"> <div class="label"><label for="community_name"><?=lang("Association name") ?> <span class="etoile">*</span></label></div> <div class="field"><input type="text" name="community_name" value="<?=(isset($_POST['community_name'])?$_POST['community_name']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="address"><?=lang("Address") ?></label></div> <div class="field"><input type="text" name="address" value="<?=(isset($_POST['address'])?$_POST['address']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="postcode"><?=lang("Postcode") ?> <span class="etoile">*</span></label></div> <div class="field"><input type="text" name="postcode" value="<?=(isset($_POST['postcode'])?$_POST['postcode']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="ville"><?=lang("City") ?> <span class="etoile">*</span></label></div> <div class="field"><input type="text" name="ville" value="<?=(isset($_POST['ville'])?$_POST['ville']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="country"><?=lang("Country") ?> <span class="etoile">*</span></label></div> <div class="field"> <select name="country"> <?=$pays->getCountry($lang->getlangid(),$_POST['country'])?> </select> </div> </div> <?$engagements=$edition->getConditions($actual_edition['id'],3,$lang->getlangid()); if($engagements!=""):?> <div class="ligne"> <div class="label_full"><label for="part_partner"><?=$admtext->getText("engagements",$lang->getlangid());?> <span class="etoile">*</span></label></div> </div> <?=$engagements?> <? endif; ?> <div class="ligne"> <div class="label"><label for="website"><?=lang("Website") ?></label></div> <div class="field"><input type="text" name="website" value="<?=(isset($_POST['website'])?$_POST['website']:'')?>" /></div> </div> <?=$edition->getQuestions($actual_edition['id'],3,$lang->getlangid())?> <div class="ligne"> <div class="title"><h3><?=$admtext->getText("contact_person",$lang->getlangid());?></h3></div> </div> <div class="ligne"> <div class="label"><?=lang("Civility") ?> <span class="etoile">*</span></div> <div class="check"><input type="radio" name="civility" value="<?=lang("Mrs.") ?>"/> <?=lang("Mrs.") ?> <input type="radio" name="civility" value="<?=lang("Mr.") ?>"/> <?=lang("Mr.") ?></div> </div> <div class="ligne"> <div class="label"><label for="lastname"><?=lang("Last name") ?></label> <span class="etoile">*</span></div> <div class="field"><input type="text" name="lastname" value="<?=(isset($_POST['lastname'])?$_POST['lastname']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="firstname"><?=lang("First name") ?></label> <span class="etoile">*</span></div> <div class="field"><input type="text" name="firstname" value="<?=(isset($_POST['firstname'])?$_POST['firstname']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="email_contact"><?=lang("Email contact") ?></label> <span class="etoile">*</span></div> <div class="field"><input type="text" name="email_contact" value="<?=(isset($_POST['email_contact'])?$_POST['email_contact']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="function"><?=lang("Function") ?></label></div> <div class="field"><input type="text" name="function" value="<?=(isset($_POST['function'])?$_POST['function']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="phone"><?=lang("Phone") ?></label></div> <div class="field"><input type="text" name="phone" value="<?=(isset($_POST['phone'])?$_POST['phone']:'')?>" /></div> </div> <div class="ligne"> <div class="label"><label for="service"><?=lang("Activities's department") ?></label></div> <div class="field"><input type="text" name="service" value="<?=(isset($_POST['service'])?$_POST['service']:'')?>" /></div> </div> <div class="form_bouton"> <div class="captchabox mt10"> <div class="captcha"> </div> </div> <input type="hidden" value="1" name="post"> <input id="maj_bouton" class="bouton mt10" type="submit" value="<?=lang("Register your association") ?>"> </div> </form> </div> <script type="text/javascript"> $(document).ready(function() { $('#namefield').hide(); }); $(".profil_ins").click(function(){ if($("#form_"+$(this).attr('id')).is(':visible')){ return false; } else{ var id=$(this).attr('id') var $oldcaptcha=$(".form_profil:visible .captchabox .captcha") $(".form_profil").stop(); $(".form_profil:visible").stop(true, true).fadeOut({ duration: 300, queue: false }).slideUp(300,function(){ $("#form_"+id).stop(true, true).fadeIn({ duration: 300, queue: false }).css('display', 'none').slideDown(300, function() { $("#form_"+id+" .captchabox").append($oldcaptcha); }); }); } }); <? if(isset($_POST['type'])): ?> $("#profil_<?=$_POST['type']?>").click(); <? endif; ?> </script> <? else:?> <p><br/><br/><br/><div class="bouton7"><strong><?=$admtext->getText("date_ins_ferme",$lang->getlangid())?></strong></div></p> <? endif;?> </div> <?php //affichage du footer include("theme/footer.php"); ?>