function insert_event($url_sponsor1, $url_sponsor2, $url_sponsor3, $url_sponsor4, $codepostal, $numerorue, $pays, $rue, $ville, $date_e, $date_f, $description_e, $heuredebut, $heurefin, $nb_max, $Nom_e, $privacy, $prix, $urlsite)
{
    global $connect;
    /*sponsor/ adresse/ event/ multimedia / sponsorise/ typeevent*/
    mysqli_query($connect, "insert into adresse(codepostal, numerorue, pays, rue, ville) values('{$codepostal}', '{$numerorue}', '{$pays}', '{$rue}', '{$ville}')");
    $id_adresse = mysqli_fetch_assoc(mysqli_query($connect, "select max(id_adresse) as max from adresse"));
    $idadresse = $id_adresse['max'];
    $idutilisateur = $_SESSION['id_utilisateur'];
    mysqli_query($connect, "insert into event(date_e, date_f, description_e, heuredebut, heurefin, id_adresse, id_utilisateur, nb_max_participant, Nom_e, privacy, prix) values('{$date_e}', '{$date_f}', '{$description_e}', '{$heuredebut}', '{$heurefin}', '{$idadresse}', '{$idutilisateur}', '{$nb_max}', '{$Nom_e}', '{$privacy}', '{$prix}')");
    $id_event = mysqli_fetch_assoc(mysqli_query($connect, "select max(Event_id) as max from event"));
    $idevent = $id_event['max'];
    //Une suite de vérification sur les url de sponsor, si un des champs est vide, on pase au suivant.
    if ($url_sponsor1 != '') {
        mysqli_query($connect, "insert into sponsor(img_sponsor) values ('{$url_sponsor1}')");
        $sponsor = mysqli_fetch_assoc(mysqli_query($connect, "select max(idSponsor) as max from sponsor "));
        $sponsor = $sponsor['max'];
        mysqli_query($connect, "insert into sponsorise(Event_id, idSponsor) values ('{$idevent}', '{$sponsor}')");
        if ($url_sponsor2 != '') {
            mysqli_query($connect, "insert into sponsor(img_sponsor) values ('{$url_sponsor2}')");
            $sponsor = mysqli_fetch_assoc(mysqli_query($connect, "select max(idSponsor) as max from sponsor "));
            $sponsor = $sponsor['max'];
            mysqli_query($connect, "insert into sponsorise(Event_id, idSponsor) values ('{$idevent}', '{$sponsor}')");
            if ($url_sponsor3 != '') {
                mysqli_query($connect, "insert into sponsor(img_sponsor) values ('{$url_sponsor3}')");
                $sponsor = mysqli_fetch_assoc(mysqli_query($connect, "select max(idSponsor) as max from sponsor "));
                $sponsor = $sponsor['max'];
                mysqli_query($connect, "insert into sponsorise(Event_id, idSponsor) values ('{$idevent}', '{$sponsor}')");
                if ($url_sponsor4 != '') {
                    mysqli_query($connect, "insert into sponsor(img_sponsor) values ('{$url_sponsor4}')");
                    $sponsor = mysqli_fetch_assoc(mysqli_query($connect, "select max(idSponsor) as max from sponsor "));
                    $sponsor = $sponsor['max'];
                    mysqli_query($connect, "insert into sponsorise(Event_id, idSponsor) values ('{$idevent}', '{$sponsor}')");
                }
            }
        }
    }
    if ($urlsite != "") {
        //Si un lien vers un site est fourni, on l'insère dans la base
        mysqli_query($connect, "insert into multimedia(Event_id, urlsite_event, principale) values ('{$idevent}', '{$urlsite}', 0)");
    }
    /*sponsor/ adresse/ event/ multimedia / sponsorise/ typeevent*/
    // $i=0;
    // while ($i!=$compteur) {
    // $sponsor = mysqli_fetch_assoc(mysqli_query($connect, "select idSponsor from sponsor where idSponsor=(max(idSponsor)-$i)"));
    // $sponsor = $sponsor['idSponsor'];
    // mysqli_query($connect, "insert into sponsorise(Event_id, idSponsor) values ('$idevent', '$sponsor')");
    // $i++;
    // }
    require "../Modele/model.php";
    //On récupère les catégories cochées pour les insérer dans la table typeevent
    $result = affichage_categ_recherche_avancee();
    while ($categorie = mysqli_fetch_assoc($result)) {
        if (isset($_POST[$categorie['nomCat']])) {
            $nomcateg = $_POST[$categorie['nomCat']];
            mysqli_query($connect, "insert into typeevent(Event_id, id_categ) values ('{$idevent}', '{$nomcateg}')");
        }
    }
}
Exemple #2
0
function modification_categorie()
{
    $result = affichage_categ_recherche_avancee();
    $compteur = 1;
    if ($compteur == 1) {
        echo '<div class="nomcateg">';
        while ($categorie = mysqli_fetch_assoc($result)) {
            echo '<div class="nom_de_categ">' . $categorie['nomCat'] . '</div>';
        }
        echo '</div>';
        $result = affichage_categ_recherche_avancee();
        echo '<div class="zone_input_categ">';
        while ($categorie = mysqli_fetch_assoc($result)) {
            echo '<form action="gestion_categorie.php" method="post">';
            echo '<input type="text" class="zone_modification_categ" placeholder="modification" name=' . $categorie['nomCat'] . '> ';
            echo '<input type="submit" value="supprimer/modifier" class="bouton_suppression_categ" name=' . $categorie['id_categ'] . '>';
            echo '</form>';
        }
        $compteur = 0;
    }
}
Exemple #3
0
function affichage_centre_interet()
{
    //Fonction qui affiche les categorie possible de centre interet pour un utilisateur sur la page modif profil
    $result = affichage_categ_recherche_avancee();
    $compteur = 0;
    while ($categorie = mysqli_fetch_assoc($result)) {
        if ($compteur != 4) {
            echo '<div class="checkrecherche"><input type="checkbox" name = ' . $categorie['nomCat'] . ' value=' . $categorie['id_categ'] . '>' . $categorie['nomCat'] . '</div>&nbsp; &nbsp; &nbsp;';
            $compteur = $compteur + 1;
        } else {
            echo '<br> <br>';
            $compteur = 0;
        }
    }
}
Exemple #4
0
        
        <?php 
include "footer.php";
?>
    </body>
    
</htm>


<?php 
// le post revient sur lui même
//si on a rempli le formulaire :
if (isset($_POST['ajout_categ'])) {
    insert_categ($_POST['nom_add_categorie']);
    echo '<meta http-equiv="refresh" content="0; url="gestion_categorie.php" />';
}
$result = affichage_categ_recherche_avancee();
while ($categorie = mysqli_fetch_assoc($result)) {
    if (isset($_POST[$categorie['id_categ']]) && empty($_POST[$categorie['nomCat']])) {
        delete_categ($categorie['id_categ']);
        echo '<meta http-equiv="refresh" content="0; url="gestion_categorie.php" />';
    } else {
        if (isset($_POST[$categorie['nomCat']])) {
            update_categ($_POST[$categorie['nomCat']], $categorie['id_categ']);
            echo '<meta http-equiv="refresh" content="0; url="gestion_categorie.php" />';
        }
    }
}
?>
        <?php 
mysqli_free_result($result);