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
| <?php
include "BDD/identifiant.php";
if(isset($_POST['submit']))
{
//Connexion au serveur
$connexion=mysqli_connect($SERVER,$USER,$PASSWORD);
//Vérification de la connexion
if(mysqli_connect_errno())
{
printf("Echec de la connexion", mysqli_connect_error());
exit();
}else echo '<center><p>Inscription réussi.</center></p>';
$pseudo = htmlentities($_POST['pseudo']);
$mdp = htmlentities($_POST['mdp']);
$email = htmlentities($_POST['email']);
$nom = htmlentities($_POST['nom']);
$prenom = htmlentities($_POST['prenom']);
$adresse = htmlentities($_POST['adresse']);
$cp = htmlentities($_POST['cp']);
$ville = htmlentities($_POST['ville']);
$telephone = htmlentities($_POST['telephone']);
$categorie = htmlentities($_POST['categorie']);
$club = htmlentities($_POST['club']);
$licence = htmlentities($_POST['licence']);
$sql = "INSERT INTO `bdd`.`inscription` (`id`, `pseudo`, `mdp`, `email`, `nom`, `prenom`, `adresse`, `cp`, `ville`, `telephone`, `categorie`, `club`, `licence`) VALUES ('', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = mysqli_prepare($connexion, $sql);
//Paramètres : chaines de caractères dans l'ordre
mysqli_stmt_bind_param($stmt, 'ssssssssssss', $pseudo , $mdp, $email, $nom, $prenom, $adresse, $cp, $ville, $telephone, $categorie, $club, $licence); //Permet de renseigner les paramètres repéré par les "?" dans l'ordre.
//Exécution
mysqli_stmt_execute($stmt); //Execute la requête.
} |
Partager