1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
| <?php
session_start();
$basededonnees = mysqli_connect('127.0.0.1', 'root', '', 'application');
if(isset($_POST['sourcelogicielformulaire']))
{
$liste_id_editeur=($_POST['liste_id_editeur']);
$nom_logiciel=htmlspecialchars($_POST['nom_logiciel']);
$fonction_logiciel=htmlspecialchars($_POST['fonction_logiciel']);
$rep_question=($_POST['rep_question']);
if (!empty($_POST['liste_id_editeur']) AND !empty($_POST['nom_logiciel']) AND !empty($_POST['fonction_logiciel']) AND !empty($_POST['rep_question']))
{
$nom_logiciellenght=strlen($nom_logiciel);
$fonction_logiciellenght=strlen($fonction_logiciel);
if ($nom_logiciellenght <= 50 AND $fonction_logiciellenght <= 50)
{
$nom_logicielMin=strtolower($nom_logiciel);
$nom_logicielMaj=ucwords($nom_logicielMin);
$fonction_logicielMin=strtolower($fonction_logiciel);
$fonction_logicielMaj=ucwords($fonction_logicielMin);
$requete_liste_applicationsexistant = ("SELECT COUNT(*) FROM r04_logiciel_source WHERE r04_nom_logiciel ='$nom_logiciel' AND r04_fonction_logiciel ='$fonction_logiciel'");
$resultat=mysqli_query($basededonnees,$requete_liste_applicationsexistant) or die(mysqli_error($basededonnees));
if('$resultat' == 0)
{
$requete_inserer_logiciel_source = ("INSERT INTO r04_logiciel_source (r04_id, r04_id_editeur, r04_nom_logiciel, r04_fonction_logiciel, r04_flag_bi_software) VALUES ('0', '$liste_id_editeur', '$nom_logicielMaj', '$fonction_logicielMaj', '$rep_question')");
mysqli_query($basededonnees,$requete_inserer_logiciel_source) or die(mysqli_error($basededonnees));
$message = "Le nouveau Logiciel a bien été créé";
}
else
{
$erreur = "Le Logiciel existe déjà";
}
}
else
{
$erreur = "Le nombre de caractères maximum est 50 caractères";
}
}
else
{
$erreur = "Tous les champs doivent être complétés";
}
}
else
{
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="http://127.0.0.1:8000/edsa-eds-www/TEST%20V1/Style/style.css">
<link rel="shortcut icon" href="..\Images\ajouter.png">
<title>Ajouter Logiciel Source</title>
</head>
<body>
<div class="titre2">
<h3>Ajout d'un Logiciel Source</h3>
</div>
<div class="forminscription">
<form method="POST" action="">
<table>
<tr>
<td><label for="liste_id_editeur">Editeur :</label></td>
<td>
<select name="liste_id_editeur" id="liste_id_editeur">
<?php
$requete_liste_deroulante='SELECT * FROM r05_editeur';
$resultatliste = mysqli_query($basededonnees,$requete_liste_deroulante);
while ($LD = mysqli_fetch_array($resultatliste))
{
?><option value="<?php echo $LD['r05_id'] ?>"> <?php echo $LD['r05_nom_editeur'] ?> </option><?php
}
?>
</select>
</td>
</tr>
<tr>
<td><label for="nom_logiciel">Nom du Logiciel :</label></td>
<td><input type="text" name="nom_logiciel" id="nom_logiciel" placeholder="Nom du Logiciel"></td>
</tr>
<tr>
<td><label for="fonction_logiciel">Fonction du Logiciel :</label></td>
<td><input type="text" name="fonction_logiciel" id="fonction_logiciel" placeholder="Fonction du Logiciel"></td>
</tr>
<tr>
<td><label>Est-ce un Logiciel Décisionnel?</label></td>
<td>
<input type="radio" name="rep_question" value="Oui" id="Oui"/>
<label for="Oui">Oui</label>
<input type="radio" name="rep_question" value="Non" id="Non"/>
<label for="Non">Non</label>
</td>
</tr>
<tr>
<td></td>
<td align="center"><input type="submit" name="sourcelogicielformulaire" value="Créer la Nouvelle Source"></td>
</tr>
</table>
</form>
</div>
<div class="instructionsform">
<?php
if (isset($erreur))
{
echo '<font color="red">'.$erreur.'</font>';
}
if (isset($message))
{
echo '<font color="green">'.$message.'</font><br />';
}
?>
</div>
<ul class="menupage">
<li><a href="AjouterSourcesLogiciels.php">RAFFRAICHIR LA PAGE</a></li>
<li><a href="AjouterSourcesLogiciels.php">AJOUTER UN NOUVEAU LOGICIEL SOURCE</a></li>
<li><a href="ParametresSourcesLogiciels.php">AFFICHER LES AUTRES LOGICIELS SOURCES</a></li>
<li><a href="MenuParametres.php">Retour Menu Paramètres</a></li>
<li><a href="Parametres.php">Retour Paramètres</a></li>
<li><a href="..\MenuPrincipal\MenuPrincipal.php">Retour Menu Principal</a></li>
</ul>
<?php
/* Fermeture de la connexion */
mysqli_close($basededonnees);
?>
</b
</html> |
Partager