[Need Help] *transfert de formulaire PHP vers BDD MySQL

    Publicités

Users Who Are Viewing This Thread (Total: 0, Members: 0, Guests: 0)

Status
Not open for further replies.

ichiwow

Membre
Oct 20, 2010
29
0
421
[Need Help] Transfert de formulaire PHP vers BDD MySQL

Bonjour à tous, je viens vers vous aujourd'hui parce que j'ai un problème sur lequel je n'avance pas depuis plusieurs jours sr mon site en création;

Je suis en train de m'occuper du formulaire d'inscription; mais les données du formulaires ne sont pas traitées, ni envoyés vers ma BDD

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="fr-FR" xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
	<title>Gurdilcraft</title>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
	<link rel="shortcut icon" href="css/images/favicon.ico" />
	<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
	<link rel="stylesheet" href="css/flexslider.css" type="text/css" media="all" />
	<!--[if IE 6]>
		<link rel="stylesheet" href="css/ie6.css" type="text/css" media="all" />		
	<![endif]-->
	<link href='http://fonts.googleapis.com/css?family=Play:400,700&amp;subset=latin,cyrillic-ext,greek,greek-ext,latin-ext,cyrillic' rel='stylesheet' type='text/css' />
	<script src="js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/jquery.jcarousel.js" type="text/javascript"></script>
	<script src="js/jquery.flexslider.js" type="text/javascript"></script>
	<script src="js/DD_belatedPNG-min.js" type="text/javascript"></script>
	<script src="js/functions.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<!-- Wrapper -->
	<div id="wrapper">
		<!-- Shell -->
		<div class="shell">
			<div class="socials">
				<a title="Facebook" class="facebook" href="https://www.facebook.com/gurdilcraft">facebook</a>
				<a title="Twitter" class="twitter" href="#">twitter</a>
				<a title="RSS" class="rss" href="#">rss</a>				
			</div>
			<p id="top-navigation"><a title="Sitemap" href="#">sitemap</a><span>|</span><a title="Search" href="#">Recherche</a><span>|</span><a title="User area" href="#">Zone Membre</a></p>
			<div class="cl"></div>
			<!-- Header -->
			<div id="header">
				<!-- Logo -->
				<div id="">
					<h1><a href="inscription2.php" title="inscription2.php">GurdilCraft</a></h1>
					<p class="slogan">Multi-Gaming</p>
				</div>
				<!-- END Logo -->
				<!-- Search -->
				<div id="search">
					<form action="" method="post">
						<input type="text" class="field" value="Search here ..." title="Rechercher ... />
						<input type="submit" value="" class="submit-button" />
					</form>
				</div>
				<!-- END Search -->
				<div class="cl"></div>
			</div>
			<!-- END Header -->
			<!-- Navigation -->
			<div id="navigation">
				<ul>
					<li class="first"><a title="home.html" href="home.html">Accueil</a></li>
					<li><a title="About" href="galerie.html">Galerie </a></li>
					<li><a title="Services" href="services.html">Services</a></li>
					<li><a title="Projects" href="projets.html">Projets</a></li>
					<li><a title="Solutions" href="jeux.html">Nos jeux</a></li>
					<li><a title="Jobs" href="tutoriels.html">Tutoriels</a></li>
					<li><a title="Blog" href="news.html">News</a></li>
					<li><a title="Solutions" href="don.html">Donations</a></li>
					<li><a title="Contacts" href="http://gurdilcraft.forumactif.org/">Forum</a></li>
				</ul>
				<div class="cl"></div>
			</div>
			<!-- END Navigation -->
			<!-- Main -->
			<div id="main">
				<div id="main-top"></div>
				<div id="main-middle">
					<!-- Content -->
		</html>
<html>
<link href="../css/complet.css" rel="stylesheet" type="text/css">
<body>
<form name="form1" method="post" action="inscription2.php">
  <table width="450" border="2" align="center" cellpadding="3" cellspacing="2" bordercolor="#FFFFFF">
    <tr>
      <td colspan="2"><div align="center" class="titre">Inscription</div></td>
    </tr>
    <tr>
      <td width="250" class="nom"><div align="center"><strong>Pseudo</strong></div></td>
      <td width="200"><div align="center">
        <input name="pseudo" type="text" id="pseudo">
      </div></td>
    </tr>
    <tr>
      <td width="250" class="nom"><div align="center"><strong>Mot de passe </strong></div></td>
      <td width="200"><div align="center">
        <input name="pwd" type="password" id="pwd">
      </div></td>
    </tr>
	 <tr>
      <td width="250" class="nom"><div align="center"><strong>Retapez votre mot de passe </strong></div></td>
      <td width="200"><div align="center">
        <input name="verif_pwd" type="password" id="verif_pwd">
      </div></td>
    </tr>
    <tr>
      <td width="250" class="nom"><div align="center"><strong>Votre E-Mail </strong></div></td>
      <td width="200"><div align="center">
        <input name="mail" type="text" id="mail">
      </div></td>
    </tr>
    <tr>
      <td width="250" class="nom"><div align="center"><strong>Pr&eacute;nom</strong></div></td>
      <td width="200"><div align="center">
        <input name="prenom" type="text" id="prenom">
      </div></td>
    </tr>
    <tr>
      <td width="250" class="nom"><div align="center"><strong>Site Web </strong></div></td>
      <td width="200"><div align="center">
        <input name="website" type="text" id="website" value="http://">
      </div></td>
    </tr>
	  <tr>
      <td width="250" class="nom"><div align="center"><strong>Ville</strong></div></td>
      <td width="200"><div align="center">
        <input name="ville" type="text" id="ville">
      </div></td>
    </tr>
    <tr>
      <td width="250" class="nom"><div align="center"><strong>D&eacute;partement</strong></div></td>
      <td width="200"><div align="center">
        <input name="dprt" type="text" id="dprt">
      </div></td>
    </tr>
    <tr>
      <td width="250" class="nom"><div align="center"><strong>Pays</strong></div></td>
      <td width="200"><div align="center">
        <select name="pays">
          <option value="France">France </option>
          <option value="Canada">Canada </option>
          <option value="Belgique" >Belgique </option>
          <option value="Suisse">Suisse </option>
          <option value="Luxembourg">Luxembourg </option>
          <option value="Autre">Autre </option>
          <option value="Choisir" selected="selected">Choisir</option>
        </select>
      </div></td>
    </tr>
    <tr>
      <td width="250" class="nom"><div align="center"><strong>Age</strong></div></td>
      <td width="200"><div align="center">
        <input name="age" type="text" id="age">
      </div></td>
    </tr>
    <tr>
      <td colspan="2"><div align="center">
          <p align="center"><span class="titre">Choisissez v&ocirc;tre avatar </span></p>
        <table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="60" height="45"><div align="center"><img src="avatars/000.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/001.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/002.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/003.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/004.gif" width="45" height="45" /></div></td>
        </tr>
        <tr>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="000.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="001.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="002.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="003.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="004.gif">
          </div></td>
        </tr>
        <tr>
          <td width="60" height="45"><div align="center"><img src="avatars/005.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/006.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/007.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/008.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/009.gif" width="45" height="45" /></div></td>
        </tr>
        <tr>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="000.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="000.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="000.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="000.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="000.gif">
          </div></td>
        </tr>
        <tr>
          <td width="60" height="45"><div align="center"><img src="avatars/010.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/011.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/012.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/013.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/014.gif" width="45" height="45" /></div></td>
        </tr>
        <tr>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="010.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="011.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="012.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="013.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="014.gif">
          </div></td>
        </tr>
        <tr>
          <td width="60" height="45"><div align="center"><img src="avatars/015.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/016.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/017.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/018.gif" width="45" height="45" /></div></td>
          <td width="60" height="45"><div align="center"><img src="avatars/019.gif" width="45" height="45" /></div></td>
        </tr>
        <tr>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="015.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="016.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="017.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="018.gif">
          </div></td>
          <td width="60"><div align="center">
              <input type="radio" name="avatar" value="019.gif">
          </div></td>
        </tr>
        <tr>
          <td colspan="2" rowspan="2"><div align="center"></div></td>
          <td width="60"><div align="center"><img src="avatars/default.gif" width="45" height="45"></div></td>
          <td colspan="2" rowspan="2"><div align="center"></div></td>
        </tr>
        <tr>
          <td width="60"><div align="center">
              <input name="avatar" type="radio" value="default.gif" checked>
          </div></td>
        </tr>
      </table>
          <p>
            <input type="submit" name="Submit" value="Inscription">
              </p>
      </div></td>
    </tr>
    <tr>
      <td colspan="2"><div align="center">
        <p class="aff2">Si vous consentez &agrave; vous inscrire &agrave; notre site vous pourrez  acc&eacute;dez &agrave; des cat&eacute;gories sp&eacute;cifique r&eacute;serv&eacute;e &agrave; nos membres.</p>
        <p class="aff2">Le mail n'est qu'un rappel de vos informations. </p>
      </div></td>
    </tr>
  </table>
</form>

					<div class="cl"></div>
				</div>
				<div id="main-bottom"></div>
			</div>
			<!-- END Main -->
			<!-- Footer -->
			<div id="footer">
				<p class="copy">Copyright 2011<span>|</span> Design by [GD] Ichiwøw M</p>
				<p id="bottom-nav"><a title="home.html" href="home.html">Accueil</a><span>|</span><a title="About" href="galerie.html">Galerie</a><span>|</span><a title="Services" href="services.html">Services</a><span>|</span><a title="Projects" href="projets.html">Projets</a><span>|</span><a title="Solutions" href="jeux.html">Jeux</a><span>|</span><a title="tutoriels" href="tutoriels.html">Tutoriels</a><span>|</span><a title="Contacts" href="http://gurdilcraft.forumactif.org/">Forum</a></p>
				<div class="cl"></div>
			</div>
			<!-- END Footer -->
		</div>
		<!-- END Shell -->
	</div>
	<!-- END Wrapper -->
</body>
</html>

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="fr-FR" xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
	<title>Gurdilcraft</title>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
	<link rel="shortcut icon" href="css/images/favicon.ico" />
	<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
	<link rel="stylesheet" href="css/flexslider.css" type="text/css" media="all" />
	<!--[if IE 6]>
		<link rel="stylesheet" href="css/ie6.css" type="text/css" media="all" />		
	<![endif]-->
	<link href='http://fonts.googleapis.com/css?family=Play:400,700&amp;subset=latin,cyrillic-ext,greek,greek-ext,latin-ext,cyrillic' rel='stylesheet' type='text/css' />
	<script src="js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/jquery.jcarousel.js" type="text/javascript"></script>
	<script src="js/jquery.flexslider.js" type="text/javascript"></script>
	<script src="js/DD_belatedPNG-min.js" type="text/javascript"></script>
	<script src="js/functions.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<!-- Wrapper -->
	<div id="wrapper">
		<!-- Shell -->
		<div class="shell">
			<div class="socials">
				<a title="Facebook" class="facebook" href="https://www.facebook.com/gurdilcraft">facebook</a>
				<a title="Twitter" class="twitter" href="#">twitter</a>
				<a title="RSS" class="rss" href="#">rss</a>				
			</div>
			<p id="top-navigation"><a title="Inscription" href="inscription.php">S'inscrire</a><span>|</span><a title="Search" href="#">Recherche</a><span>|</span><a title="Connection" href="#">Se connecter</a></p>
			<div class="cl"></div>
			<!-- Header -->
			<div id="header">
				<!-- Logo -->
				<div id="">
					<h1><a href="home.html" title="home">GurdilCraft</a></h1>
					<p class="slogan">Multi-Gaming</p>
				</div>
				<!-- END Logo -->
				<!-- Search -->
				<div id="search">
					<form action="" method="post">
						<input type="text" class="field" value="Search here ..." title="Rechercher ..." />
						<input type="submit" value="" class="submit-button" />
					</form>
				</div>
				<!-- END Search -->
				<div class="cl"></div>
			</div>
			<!-- END Header -->
			<!-- Navigation -->
			<div id="navigation">
				<ul>
					<li class="first"><a title="Home" href="home.html">Accueil</a></li>
					<li><a title="About" href="galerie.html">Galerie </a></li>
					<li><a title="Services" href="services.html">Services</a></li>
					<li><a title="Projects" href="projets.html">Projets</a></li>
					<li><a title="Solutions" href="jeux.html">Nos jeux</a></li>
					<li><a title="Jobs" href="tutoriels.html">Tutoriels</a></li>
					<li><a title="Blog" href="news.html">News</a></li>
					<li><a title="Solutions" href="don.html">Donations</a></li>
					<li><a title="Contacts" href="http://gurdilcraft.forumactif.org/">Forum</a></li>
				</ul>
				<div class="cl"></div>
			</div>
			<!-- END Navigation -->
			<!-- Slider -->
			<div id="slider" class="flexslider">
				<ul class="slides">
					<li>
						<img src="css/images/slide.png" alt="Character from the The Crysis 2 shooting a machine gun" />
						<div class="caption">
							<p>Nos FPS sur PC<span>Sauerbraten - CoD 4 - Battlefield 3 - PlanetSide 2</span><a class="watch-now" title="Watch Now!" href="Fps.html">Watch Now!</a></p>			
						</div>
					</li>
					<li>
						<img src="css/images/slide2.png" alt="Character from the The Crysis 2 shooting a machine gun" />
						<div class="caption">
							<p>Minecraft<span>Adresse IP : Gurdilcraft.fr</span><a class="watch-now" title="Watch Now!" href="#">Watch Now!</a></p>
						</div>
					</li>
					<li>
						<img src="css/images/slide3.png" alt="Character from the The Crysis 2 shooting a machine gun" />
						<div class="caption">
							<p>League of Legends<span> Et la Gurdil team</span><a class="watch-now" title="Watch Now!" href="#">Watch Now!</a></p>							
						</div>
					</li>
				</ul>				
			</div>
			<!-- END Slider -->
			<!-- Main -->
			<div id="main">
				<div id="main-top"></div>
				<div id="main-middle">
					<!-- Content -->
<?php	
include('if.php')
		$pwd = $_POST['pwd'];//On recupère les infos
		$verif_pwd = $_POST['verif_pwd'];
		$pseudo = $_POST['pseudo'];
		$ville = $_POST['ville'];
		$mail = $_POST['mail'];
		$prenom = $_POST['prenom'];
		$dprt = $_POST['dprt'];
		$pays = $_POST['pays'];
		$website = $_POST['website'];
		$age = $_POST['age'];
		$avatar = $_POST['avatar'];
		$inscritle = date("d/m/y");
		/*On Fait la variable contenant le mail de confirmation*/
	
		$message1 = '<html><body>Bonjour ' . $pseudo . ' et bienvenue sur notre site</br>'; 
		$message1 .= '</br>';
		$message1 .= 'Vous venez de vous inscrire et nous sommes heureux<br>de pouvoir vous compter aujourd\'hui parmi nos membres.<br>'; 
		$message1 .= 'Voici un rappel de vos identifiants, notez les précieusement : <br>';
		$message1 .= 'Votre Mot de passe: ' . $pwd .'<br><br>';
		$message1 .= 'Votre Mail: ' . $mail .'<br><br>';
		$message1 .= 'Votre Pseudo: ' . $pseudo .'<br><br>';
		$message1 .= 'Votre Prenom: ' . $prenom .'<br><br>';
		$message1 .= 'Votre Département: ' . $dprt .'<br><br>';
		$message1 .= 'Votre Ville: ' . $ville .'<br><br>';
		$message1 .= 'Votre Pays: ' . $pays .'<br><br>';
		$message1 .= 'Votre Site Web: ' . $website .'<br><br>';
		$message1 .= 'Votre âge: ' . $age .'<br><br>';										
		$message1 .= 'Si vous souhaitez changer vos informations, rendez-vous dans votre compte pour les mettre à jour.<br>';
		$message1 .= 'A très bientôt sur le site!'; 
		?>

<?
				include ('config.php'); //On se connecte à MySQL
		
		$verification = mysqli_query("SELECT COUNT(*) FROM gx_user WHERE pseudo='$pseudo' OR mail='$mail'") or die (mysql_error());
		$donnees = mysql_fetch_array($verification)or die (mysql_error());

		if($donnees['COUNT(*)'] >= 1) //On verifie que le pseudo n'existe pas déjà
		{ 
			$reponse = '<div align="center" class="aff">Le pseudo ou l\'email est déjà utilisé, merci d\'en choisir un(e) autre.<br>
			<a href="index.html=inscription">Retour au formulaire</a></div>';
		}
		else
		{	
			if( empty($pseudo) || empty($pwd) || empty($mail)) //On verifie que les variables précédentes ne soient pas vide
			{
				$reponse = '<div align="center" class="aff">Un ou plusieurs champs ne sont pas remplis<br><a href="index.html=inscription">Retour au formulaire</a></div>';
			}
			elseif( $pwd != $verif_pwd) //On verifie que les 2 pass sont identiques
			{
				$reponse = '<div align="center" class="aff">Les mots de passe ne sont pas identiques<br>
				<a href="index.html=inscription">Retour au formulaire</a></div>';
			}
			else //Si tout est bon on entre les données dans la BDD et on envoye le mail
			{
			//Selection de la table
$SQL = "insert into gx_user(id,pwd,pseudo,ville,mail,prenom,dprt,pays,age,website,avatar,inscritle) values ('', '$pwd', '$pseudo', '$ville', '$mail', '$prenom', '$dprt', '$pays', '$age', '$website', '$avatar', '$inscritle')";
//Si erreur 
mysqli_query($SQL) or die ('Erreur SQL !!'.$SQL.'<br>'.mysql_error());

				$reponse = '<div align="center" class="nom">Bravo, vous êtes maintenant inscrit.<br>Vous allez recevoir un e-mail résumant vos infos. <br><a href="index.php">Retour à l\'Accueil</a></div>';
				$entete = "MIME-Version: 1.0\r\n";
				$entete .= "Content-type: text/html; charset=iso-8859-1\r\n";
				$entete .= "From: <$email_admin>\r\n";
				$entete .= "Reply-To: $email_admin\r\n";
				mail($mail,'Bienvenue ' . $login .'.' , $message1, $entete);
			}
		}
		echo "$reponse";
		mysql_close(); //On se deconnecte
?>
						<div class="post games">
							<h2>Autres jeux</h2>
							<p>Les autres jeux officiels ou joués par quelques joueurs</p>
							<div class="games-slider">
								<ul>
									<li>
										<a title="" href="#"><img src="css/images/g1.jpg" alt="Character from a video game" /></a>
										<p class="small-caption">PC</p>
										<p class="title">World of Warcraft</p>
									</li>
									<li>
										<a title="" href="#"><img src="css/images/g2.jpg" alt="Character from a video game" /></a>
										<p class="small-caption">PC</p>
										<p class="title">Cube World et Terraria</p>
									</li>
									<li>
										<a title="" href="#"><img src="css/images/g3.jpg" alt="Character from a video game" /></a>
										<p class="small-caption">PC, Navigateur</p>
										<p class="title">Ogame</p>
									</li>
									<li>
										<a title="" href="#"><img src="css/images/g4.jpg" alt="Character from a video game" /></a>
										<p class="small-caption">PC, FPS</p>
										<p class="title">Team Fortress 2</p>
									</li>
										<li>
										<a title="" href="#"><img src="css/images/g5.jpg" alt="Character from a video game" /></a>
										<p class="small-caption">PC</p>
										<p class="title">Dofus</p>
									</li>
										<li>
										<a title="" href="#"><img src="css/images/g6.jpg" alt="Character from a video game" /></a>
										<p class="small-caption">PC, steam</p>
										<p class="title">Realm of the Mad God</p>
									</li>
								</ul>
								<div class="games-nav">
									<a title="Previous slide" class="prev-arrow" href="#">Prev.</a>
									<a title="Next slide" class="next-arrow" href="#">Suiv.</a>									
								</div>
							</div>
						</div>
					</div>
					<!-- END Content -->
					<!-- Sidebar -->
					<div id="sidebar">
						<div class="widget services">
							<h2>Nos services</h2>
							<ul>
								<li><a title="" href="#">Un serveur Temspeak 3 'Gurdilcraft.fr"</a></li>
								<li><a title="" href="http://gurdilcraft.forumactif.org/">Un forum ici</a></li>	
								<li><a title="" href="http://www.youtube.com/user/allenshamal?feature=watch">Et une chaîne youtube là</a></li>								
								<li><a title="" href="http://gurdilcraft.forumactif.org/f4-magasin-et-vip">Un système de don Paypal et Audiotel</a></li>
							</ul>
						</div>
						<div class="widget contact">
							<h2>Nous contacter</h2>
							<p><strong>Email:&nbsp;</strong><a title="Contact us" href="contact.html">[email protected]</a></p>
							<p><strong>Phone:&nbsp;</strong>+1 755-606-605</p>
							<p><strong>Address:&nbsp;</strong>East Pixel Bld. 99, Creative City, USA</p>
							<div class="img-frame">
								<img src="css/images/map.jpg" alt="Map" />
							</div>							
						</div>
					</div>
					<!-- END Sidebar -->
					<div class="cl"></div>
				</div>
				<div id="main-bottom"></div>
			</div>
			<!-- END Main -->
			<!-- Footer -->
			<div id="footer">
				<p class="copy">Copyright 2011<span>|</span> Design by Ichiwøw M</p>
				<p id="bottom-nav"><a title="Home" href="home.html">Accueil</a><span>|</span><a title="About" href="galerie.html">Galerie</a><span>|</span><a title="Services" href="services.html">Services</a><span>|</span><a title="Projects" href="projets.html">Projets</a><span>|</span><a title="Solutions" href="jeux.html">Jeux</a><span>|</span><a title="tutoriels" href="tutoriels.html">Tutoriels</a><span>|</span><a title="Contacts" href="http://gurdilcraft.forumactif.org/">Forum</a></p>
				<div class="cl"></div>
			</div>
			<!-- END Footer -->
		</div>
		<!-- END Shell -->
	</div>
	<!-- END Wrapper -->
    <?php
     
    if (isset($_POST['ajouter'])){ //si input ajouter est defini si on appui sur le bouton//
    $mail=$_POST['mail'];
    $prenom=$_POST['prenom'];
    $adresse=$_POST['adresse'];
    $localite=$_POST['ville']; // introduction de la valeur $_POST[''] dans $//
    $codpost=$_POST['dprt'];
    $numtel=$_POST['pays'];
    $password=$_POST['password'];
    $pseudo=$_POST['pseudo'];
    $candidanim=$_POST['age'];
	?>
     
    <?php
    $login= mysql_connect("localhost","root","allenshamal" ); //Connection a la base de donnees//
    mysql_select_db('mysql');
    if (!$login){
    die('Erreur de connexion: ' . mysql_error());
    }
     
    mysql_select_db('avon');
    $req= "Insert INTO ambassadrice (nom_ambassadrice, prenom_ambassadrice, adresse_ambassadrice, localite_ambassadrice, codpost_ambassadrice, numtel_ambassadrice, numdossier_ambassadrice, rensup_ambassadrice, candidanim_ambassadrice) VALUES ( $nom, $prenom, $adresse, $localite, $codpost, $numtel, $numdossier, $rensup, $candidanim)";
    mysql_query($req);,
     
    mysql_close();
?>

PHP:
<?
//Connexion à la base de donnée
$bdd = new PDO('mysql:host=localhost;dbname=membres', 'root', 'mdp');	//connxeion locale
$bdd = new PDO('mysql:host=adresse;dbname=membres', 'root', 'mdp');	//connxeion hébergeur
$connect = mysql_connect($host, $user, $mdp) ;
if ($connect > 0 )
echo " connexion réussie" ;
else
echo "Echec de connexion – Veuillez contacter l’adminstrateur" ;
mysql_select_db($bdd) or die("Erreur de connexion à la base de donnée" );
?>[/SPOILER]

[SPOILER="structure de ma table "users.sql""]CREATE TABLE `users` (
  `id` bigint(20) NOT NULL,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `avatar` text NOT NULL,
  `signup_date` int(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Je cherche le script permettant de réparer l'erreur, et surtout, de la comprendre !

Je vous remercie d'avance; Ichiwøw
 
Last edited:

Evaelis

La Voix de la Sagesse
V
Ancien staff
Apr 28, 2010
22,949
468
1,699
Valhalla
Déjà sur inscription 2, tu ne ferme pas tes accolades ni tes ouvertures de code php...
 

Mhaw

Roi des Chats
V
Oct 23, 2013
2,665
7
944
29
Alsace
C'est ton fichier config.php qui est un problème.
PHP:
CREATE TABLE `users` ( 
  `id` bigint(20) NOT NULL, 
  `username` varchar(255) NOT NULL, 
  `password` varchar(255) NOT NULL, 
  `email` varchar(255) NOT NULL, 
  `avatar` text NOT NULL, 
  `signup_date` int(10) NOT NULL 
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Ceci est non pas un code de connexion a une bdd, mais un code de création d'une Table (User), et ce n'est même pas du php, mais une requête sql.

Pour te connecté a une bdd il faut utilisé :
PHP:
$hote = ""; //Adresse du serveur MYSQL
$user = ""; //Nom d'utilisateur de la base MYSQL
$pass = ""; //Mot de passe de la base MYSQL
$dbname = ""; //Nom de la Base de donnée 
mysql_connect($hote, $user, $pass);
mysql_select_db($dbname);
mysql_query('SET NAMES \'utf8\'');

Après cela tu peux executé les requetes SQL de ton choix.

Et dans ton inscription2.php, je vois que tu ne traite pas bien les informations.
C'est bien de mettre les variable _POST dans d'autre variable, mais c'est très dangereux de le faire comme ça.
Utilise la fonction mysql_real_escape_string(), qui te permettra de retiré tout les caractère nuisible a mysql.

Pour plus de sécurité, tu peux aussi, (Et c'est fortement recommandé) d'enregister les mots de passe dans la base de donnée crypté en md5 avec la simple fonction MD5().
Pour la connexion il suffira de voir sir le mot de passe utilisé par l'utilisateur que tu cryptera a nouveau en md5 est égale au mdp enregistré dans la base de donné.
Cela permet de protégé tes comptes utilisateur si quelqu'un venait a s'introduire dans ta base de donné.

PHP:
$entete .= "From: <$email_admin>\r\n";
echo "$reponse";
Dans tout ta page, il est plus juste, pour utilisé une variable de faire :
PHP:
$entete .= "From: <" . $email_admin . ">\r\n"; 
echo $reponse;

Il y a aussi un code bizarre a la fin de ta page.
Tu te connecte a une base de donnée,tu choisis la bdd "mysql".
Tu ne fais rien avec, car plus tard tu choisis une autre bdd "avon" :
PHP:
$login= mysql_connect("localhost","root","allenshamal" ); //Connection a la base de donnees// 
    mysql_select_db('mysql'); 
    if (!$login){ 
    die('Erreur de connexion: ' . mysql_error()); 
    } 
      
    mysql_select_db('avon');
Il faut choisir qu'une seul bdd, car cela peut posé des problèmes.

Tu ouvre et ferme les balises "<?php ?>" trop souvent, c'est inutile x)

De plus dans ton Inscription1.php, il est inutile de mettre des "id=" au input.

Tes codes sont très brouillons !
Je te conseille de faire les code php pour ton inscription, et ensuite les rangé dans ta page html, au moins tu te perdra pas :p

EDIT: Merde je viens de voir que ça fait 1 mois xD Excusez moi pur le up !
 
Last edited:
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
D Espace d'aide 0
Similar threads
actionaz help