예제 #1
0
                    <div class="col-lg-12">
                        <h1 class="page-header">
                            Pays
                            <small>Ajouts</small>
                        </h1>
                    </div>
                </div>

                <?php 
if (!empty($_POST['ajout_pays'])) {
    $error = 0;
    // Vérification données absurdes
    if (isset($_POST["code_tdf"]) && !empty($_POST["code_tdf"]) && isset($_POST["c_pays"]) && !empty($_POST["c_pays"]) && isset($_POST["nom"]) && !empty($_POST["nom"])) {
        $code_tdf = strtoupper(str_to_trim($_POST["code_tdf"]));
        $c_pays = strtoupper(str_to_trim($_POST["c_pays"]));
        $nom = strtoupper(str_to_trim($_POST["nom"]));
        if (!preg_match_all('/^[a-zA-Z]*$/', $code_tdf)) {
            $_SESSION['flash'] = 'Le code tdf ne doit contenir que des lettres';
            $error = 1;
            header('location: ajout_pays.php');
        } else {
            if (!preg_match_all('/^[a-zA-Z]*$/', $c_pays)) {
                $_SESSION['flash'] = 'Le code Pays ne doit contenir que des lettres';
                $error = 1;
                header('location: ajout_pays.php');
            } else {
                if (strlen($code_tdf) > 3 && strlen($code_tdf) < 2) {
                    $_SESSION['flash'] = 'Le code TDF Pays doit être composé d\'un maximum de 3 lettres';
                    $error = 1;
                    header('location: ajout_pays.php');
                } else {
예제 #2
0
function traitement_nom($chaine)
{
    $chaine = str_to_noaccent_nom($chaine);
    $chaine = str_to_trim($chaine);
    $chaine = strtoupper($chaine);
    return $chaine;
}