예제 #1
0
function valid_route()
{
    //Récupération du formulaire.
    $nom = $_POST['nom'];
    $prenom = $_POST['prenom'];
    $adresse = $_POST['adresse'];
    $codePostal = $_POST['codePostal'];
    $ville = $_POST['ville'];
    $mail = $_POST['mail'];
    $numTel = $_POST['numTel'];
    if ($_SESSION['utilisateur']['utilisateurtype_id'] == 1) {
        $organisation = $_POST['organisation'];
        $organisationRecupId = Connexion::queryFirst("SELECT id FROM organisation WHERE libelle='" . $organisation . "'");
        $organisationId = $organisationRecupId['id'];
    } else {
        $organisationId = $_SESSION['utilisateur']['entreprise_id'];
    }
    $organisation = $_POST['organisation'];
    $organisationId = Connexion::queryFirst("SELECT id FROM organisation where libelle='" . $organisation . "'");
    //vérification si aucune zone de texte est restée vide pour envoi à la BDD.
    if ($nom != "" and $prenom != "" and $adresse != "" and $codePostal != "" and $ville != "" and $mail != "" and $numTel != "") {
        $query = 'INSERT INTO client (nom, prenom, adresse, codePostal, ville, entreprise_id, mail, numTelephone)' . "VALUES ('" . $nom . "', '" . $prenom . "', '" . $adresse . "', '" . $codePostal . "', '" . $ville . "','.{$organisationId['id']}.', '" . $mail . "', '" . $numTel . "')";
        Connexion::exec($query);
        include ROOT . 'AdminLTE/alerte.php';
    } else {
        $tableAjout = [$nom, $prenom, $adresse, $codePostal, $ville, $mail, $numTel, $organisation];
        formulaire($tableAjout, true);
    }
}
예제 #2
0
                <section class="content-header">
                    <h1>
                        Tableau de bord
                    </h1>
                    <div class="alert alert-success">
                       <strong>Success!</strong> 
                       <?php 
//$devisId=$_POST['id'];
$init = 0;
$produits = array();
while (isset($_POST['produit_id' . $init])) {
    $produits[] = $_POST['produit_id' . $init];
    $init++;
}
$requete = 'SELECT MAX(id) AS "id" from devis';
$devisId = Connexion::queryFirst($requete);
$quantite = $_POST['quantite'];
foreach ($produits as $line) {
    $query2 = 'INSERT INTO ligneDevis (id,produit_id, quantite, devis_id) VALUES (NULL,"' . $line . '", "' . $quantite . '","' . $devisId['id'] . '")';
    Connexion::exec($query2);
}
?>
                    </div>
                </section>

                <!-- Main content -->
                <section class="content">
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
예제 #3
0
            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        Tableau de bord
                    </h1>
                    <div class="alert alert-success">
                       <strong>Success!</strong> <?php 
$libelleProduit = $_POST['libelleProduit'];
$quantite = $_POST['quantite'];
$nomEntreprise = $_POST['organisation'];
$produit_id = "SELECT id FROM produit WHERE libelleProduit='" . $libelleProduit . "'";
$entreprise_id = "SELECT id FROM organisation WHERE libelle='" . $nomEntreprise . "'";
$entreprise_id = Connexion::queryFirst($entreprise_id);
$produit_id = Connexion::queryFirst($produit_id);
$query = 'INSERT INTO stock (produit_id, quantite, organisation_id)' . "VALUES ('" . $produit_id['id'] . "', '" . $quantite . "', '" . $entreprise_id['id'] . "')";
Connexion::exec($query);
?>
                    </div>
                </section>

                <!-- Main content -->
                <section class="content">
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->

        <!-- add new calendar event modal -->

예제 #4
0
            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        Tableau de bord
                    </h1>
                    <div class="alert alert-success">
                       <strong>Success!</strong> <?php 
$libelleProduit = $_POST['libelleProduit'];
$reference = $_POST['reference'];
$nomFournisseur = $_POST['nom'];
$fournisseur_id = "SELECT id FROM fournisseur WHERE nom='" . $nomFournisseur . "'";
$poids = $_POST['poids'];
$montant = $_POST['montant'];
$fournisseur_id = Connexion::queryFirst($fournisseur_id);
$query = 'INSERT INTO produit (libelleProduit, reference, fournisseur_id, poids, montant)' . "VALUES ('" . $libelleProduit . "', '" . $reference . "', '" . $fournisseur_id['id'] . "','" . $poids . "','" . $montant . "')";
Connexion::exec($query);
?>
                    </div>
                </section>

                <!-- Main content -->
                <section class="content">
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->

        <!-- add new calendar event modal -->

예제 #5
0
function loginExiste($login)
{
    $result = Connexion::queryFirst('select count(*) as nb from utilisateur where login="******"');
    return $result['nb'] > 0;
}