Subversion Repositories ALCASAR

Rev

Rev 3003 | Rev 3011 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log

<?php

/********************************************************************
*                                                                                                                                       *
*                       ALCASAR EMAIL INSCRIPTION                                                               *
*                                                                                                                                       *
*       By K@M3L 1101130512.1901090409 & T3RRY @ La Plateforme_                 *
*       V 1.0 June 2021.                                                                                                *
*                                                                                                                                       *
*       Partie front de la page d'inscription des utilisateurs                  *
*       elle envoi les infos à traiter à la page de traitement                        *
*       via AJAX (email_registration_back)                                                              *
*                                                                                                                                       *
/********************************************************************/

$Language = 'en';
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        $Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
        $Language = strtolower(substr(chop($Langue[0]), 0, 2));
}
if ($Language === 'fr') {               // French
        $l_home = " Accueil";
        $l_title = "Inscription par Email";
        $l_login = "Connexion";
        $l_Email = "Adresse électronique: *";
        $l_mandatory = "* Remplir tous les champs obligatoires";
} else {        // English
        $l_home = " Home";
        $l_title = "Email inscription";
        $l_login = "Login";
        $l_Email = "Email address: *";
        $l_mandatory = "* Fill in all mandatory fields";
}
?>
<!DOCTYPE html>
<html>
<head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>ALCASAR - <?=$l_title ?></title>
        <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="css/pass.css">
        <link rel="icon" href="images/favicon-48.ico" type="image/ico">
        <script type="text/javascript" src="js/jquery.min.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar navbar-inverse" style="margin-bottom:0px;">
        <div class="container-fluid">
                <div class="navbar-header">
                        <a href="index.php"><img src="images/logo-alcasar_70.png" width="50" ><font color=red><b><?=$l_home ?></b></font></a>
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                                <span class="sr-only">Toggle navigation</span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                        </button>
                </div>
                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav">
                                <li>
                                        <a href="index.php?url=www.euronews.com"><?=$l_login ?></a>
                                </li>
                                <li>
                                        <a href="email_registration_front.php"><?=$l_title ?></a>
                                </li>
                        </ul>
                        <ul class="nav navbar-nav navbar-right">
                                <a href="contact.php" class="navbar-brand">Contact</a>
                                <a href="contact.php"><img src="images/organisme.png" width="40"></a>
                        </ul>
                </div>
        </div>
</nav>
        <div class="col-xs-12 col-md-10 col-md-offset-1"> 
                <!-- HeaderBox -->
                <div class="row banner">
                        <!-- Logo box -->
                        <div class="hidden-xs col-sm-3 col-md-2 col-lg-2"> 
                                <img class="img-responsive img-A" src="images/organisme.png">
                        </div>
                        <!-- Title -->
                        <div id="cadre_titre" class="titre_banner col-xs-12 col-sm-8">
                                <div class="row">
                                        <p id="acces_controle" class="titre_controle"><?= $l_title ?></p>
                                </div>
<!--                            <div class="row">
                                <?php if (isset($changePasswordMessage)): ?>
                                        <?= $changePasswordMessage ?>
                                <?php endif; ?>
                                </div>-->
                        </div>
                        <!-- Logo box -->
                        <div class="img_banner hidden-xs col-sm-3 col-md-2 col-lg-2">
                                <img class="img-responsive img-organisme" src="images/logo-alcasar_70.png">
                        </div>
                </div>

                <section id="inscription" class="row">
                        <form name="master" id="contenu_acces" onsubmit="return false;" class="col-xs-12 col-sm-12 col-md-offset-1 col-md-10">
                                <div class="row input_row">
                                        <div class="label_name col-xs-3 col-sm-3 col-md-4"><?=$l_Email?></div>
                                        <div class="col-xs-6 col-sm-6 col-md-4">
                                        <input type="email" placeholder="User@exemple.com" id="email" name="email" required class="form-control"/>
                                        </div>
                                        <small id="output_email" class="row"></small>
                                </div>
                                <div id="status">
                                        <?=$l_mandatory?>
                                </div>
                                <div class="row input_row">
                                        <div class="col-xs-5 col-xs-offset-1 col-sm-4 col-sm-offset-2">
                                                <input id="buttons" class="btn btn-default" value="Annuler" onclick="window.location.href = 'index.php';">
                                        </div>
                                        <div class="col-xs-5 col-sm-4">
                                                <button type="submit" class="btn btn-primary btn-lg" id="buttons" >Inscription</button>
                                        </div>
                                </div>
                        </form>
                </section>

                <script type="text/javascript" src="js/jquery.min.js"></script>
                <script>
                        $(document).ready(function(){
                                $("#contenu_acces input").focus(function(){
                                        $("#status").fadeOut(800);
                                });

                                //Traitement du formulaire d'inscription
                                $("#contenu_acces").submit(function(){
                                        var status = $("#status");
                                        var Fmail = $("#email").val();

                                        $.ajax({
                                                type: "post",
                                                url:  "email_registration_back.php",
                                                data: {
                                                        'Fmail' : Fmail,
                                                },
                                                beforeSend: function(){
                                                        $("#status").attr("value", "Traitement en cours...");
                                                },
                                                success: function(data){
                                                        if (data.match("success")) {
                                                                status.html(data).fadeIn(400);
                                                                alert("Encore une dernière étape!\n\nUn mot de passe temporaire vient de vous être envoyé à votre adresse électronique.\n Veuillez changer votre mot de passe.\n\n(Pensez à vérifier vos spams ou courriers indésirables, si vous ne voyez pas ce mail dans votre boîte de réception).\n\nSi vous ne recevez pas le mail dans les 24 heures contactez votre administrateur.")
                                                                 document.location.href="index.php";
                                                        } else {
                                                        console.log(data);
                                                                alert("Une erreur s'est produite.\n\nVeuillez renouveler votre inscription ou contactez votre administrateur.");
                                                                status.css("color", "red").html(data).fadeIn(400);
                                                        }
                                                }
                                        });
                                });
                        });
                </script>
        </div>
</body>
</html>