IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Code d'inscription


Sujet :

Langage PHP

  1. #1
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 1
    Points : 1
    Points
    1
    Par défaut Code d'inscription
    Bonjour a tous voilà j ai récemment fait appel a un codeur pour m aider ds la création de mon site.

    Et après essai je me suis rendu compte que la partie "inscription" ne marchait pas..
    Vu que c'est lui qui a codé cette partie, je demande votre aide juste pour me dire si vous voyez ou pas quelque chose qui vous choque sur le fichier "inscription" :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    <?php
     
    session_start();
    // on teste si le visiteur a soumis le formulaire
    if (isset($_POST['inscription']) && $_POST['inscription'] == 'Inscription') {
            // on teste l'existence de nos variables. On teste également si elles ne sont pas vides
            if (!empty($_POST['login']) && !empty($_POST['pass']) && !empty($_POST['pass_confirm']) && isset($_POST['age']) && isset($_POST['sexe']) && !empty($_POST['ville']) && !empty($_POST['pays']) && !empty($_POST['style']) && !empty($_POST['description'])) {
                    // on teste les deux mots de passe
                    if ($_POST['pass'] != $_POST['pass_confirm']) {
                            $erreur = 'Les 2 mots de passe sont différents.';
                    }
                    else {
                            require_once('Connections/mabase.php');
     
                            // on recherche si ce login est déjà utilisé par un autre membre
                            $sql = 'SELECT id
                                    FROM utilisateurs
                                    WHERE identifiant = \''.mysql_real_escape_string($_POST['login']).'\'
                                    LIMIT 1';
                            $res = mysql_query($sql);
     
                            if (!mysql_num_rows($res)) {
                                    $sql = 'INSERT INTO utilisateurs (
                                                    identifiant,
                                                    mot_de_passe,
                                                    age,
                                                    sexe,
                                                    ville,
                                                    pays,
                                                    style,
                                                    description
                                            )
                                            VALUES(
                                                    \''.mysql_real_escape_string($_POST['login']).'\',
                                                    \''.mysql_real_escape_string(md5($_POST['pass'])).'\',
                                                    '.intval($_POST['age']).',
                                                    '.min(1, intval($_POST['sexe'])).',
                                                    \''.mysql_real_escape_string($_POST['ville']).'\',
                                                    \''.mysql_real_escape_string($_POST['pays']).'\',
                                                    \''.mysql_real_escape_string($_POST['style']).'\',
                                                    \''.mysql_real_escape_string($_POST['description']).'\'
                                            )';
                                    mysql_query($sql);
                                    $_SESSION['id'] = mysql_insert_id();
                                    mail('lokkman93@gmail.com', 'Inscription', 'Un nouvel utilisateur s\'est inscrit : '.$_POST['login'], 'From: lokkman93@gmail.com');
                                    header('Location: membre.php');
                                    exit();
                            }
                            else {
                                    $erreur = 'Un membre possède déjà ce login.';
                            }
                    }
            }
            else {
                    $erreur = 'Au moins un des champs est vide.';
            }
    }
    ?>
    <html>
    <head>
    <title>Inscription</title>
    <meta name="description" content="Music website">
    <meta name="keywords" content="music, mp3">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="css/style.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td height="183" colspan="2" valign="top" background="images/bg_03.gif" class="bgx"><table width="100%" height="183" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td height="153" colspan="2" valign="top"><table width="100%" height="153" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="169" background="images/bg_h01.jpg" class="bgnr"><div class="dv"><img src="images/el_01.gif" alt="" width="146" height="183"></div></td>
    <td width="318" valign="top" background="images/bg_h02.jpg" class="bgnr"><table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="61"><img src="images/logo.gif" alt="" width="61" height="50"></td>
    <td width="268"><h1>Partage-Playlist</h1></td>
    </tr>
    </table></td>
    <td align="right" valign="bottom" background="images/bg_h03.jpg" class="bgnr"> </td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td width="199" height="30" bgcolor="#C47F39"> </td>
    <td bgcolor="#1D1511"><table height="30" border="0" cellpadding="0" cellspacing="0" class="menu">
    <tr>
    <td align="center"><a href="index.php">Acceuil</a><a href="#"></a></td>
    <td align="center"><a href="playlist.php">Playlist</a><a href="#"></a></td>
    <td align="center"><a href="playlist.php?top">Classement</a><a href="#"></a></td>
    <td align="center"><? if (empty($_SESSION['id'])) { ?><a href="inscription.php">s'enregistrer</a><? } else { ?><a href="membre.php">espace membre</a><? } ?><a href="#"></a></td>
    <td align="center"><? if (empty($_SESSION['id'])) { ?><a href="enreistrement.php">Connexion</a><? } else { ?><a href="deconnexion.php">Déconnexion</a><? } ?><a href="#"></a></td>
    <td align="center"><a href="liens.php">Liens</a><a href="#"></a></td>
    </tr>
    </table></td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td height="100%" colspan="2" valign="top"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="199" valign="top" background="images/bg_02.gif" bgcolor="#1D1511" class="bgx"><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td height="20" align="right" background="images/nitem.gif" class="nitem bgnr"><strong><a href="index.php">Acceuil</a><a href="#"></a></strong></td>
    </tr>
    <tr>
    <td height="20" align="right" background="images/nitem.gif" class="nitem bgnr"><strong><a href="playlist.php">Playlist</a><a href="#"></a></strong></td>
    </tr>
    <tr>
    <td height="20" align="right" background="images/nitem.gif" class="nitem bgnr"><strong><a href="playlist.php?top">Classement</a><a href="#"></a></strong></td>
    </tr>
    <tr>
    <td height="20" align="right" background="images/nitem.gif" class="nitem bgnr"><strong><? if (empty($_SESSION['id'])) { ?><a href="inscription.php">s'enregistrer</a><? } else { ?><a href="membre.php">espace membre</a><? } ?><a href="#"></a></strong></td>
    </tr>
    <tr>
    <td height="20" align="right" background="images/nitem.gif" class="nitem bgnr"><strong><? if (empty($_SESSION['id'])) { ?><a href="enreistrement.php">Connexion</a><? } else { ?><a href="deconnexion.php">Déconnexion</a><? } ?><a href="#"></a></strong></td>
    </tr>
    <tr>
    <td height="20" align="right" background="images/nitem.gif" class="nitem bgnr"><strong><a href="liens.php">Liens</a><a href="#"></a></strong></td>
    </tr>
    <tr>
    <td height="20" align="right" background="images/nitem.gif" class="nitem bgnr"><? require_once('nb_connectes.php') ?></td>
    </tr>
    </table></td>
    <td height="100%" valign="top"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td height="48" background="images/bg_04.gif"><table width="100%" height="48" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="23"><img src="images/bg_05.gif" alt="" width="23" height="48"></td>
    <td background="images/bg_06.gif" class="bgrr title"><h1>Inscription</h1></td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td valign="top" bgcolor="#1D1511" class="content"><p>
    <script type="text/javascript"><!--
    google_ad_client = "pub-3060654316043618";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "text";
    //2006-11-21: Web templates - LAYOUTS
    google_ad_channel = "0286771451";
    google_color_border = "1D1511";
    google_color_bg = "1D1511";
    google_color_link = "E14137";
    google_color_text = "000000";
    google_color_url = "B3B3B3";
    //--></script>
    Veuillez remplir le formulaire ci-dessous afin de vous inscrire
    </p><form action="inscription.php" method="post">
    <table width="505" height="391" border="0">
    <tr>
    <td width="172">Login :</td>
    <td width="317"><input type="text" name="login" value=" <?php if (isset($_POST['login'])) echo htmlentities(trim($_POST['login'])); ?> "></td>
    </tr>
    <tr>
    <td>Mot de passe : </td>
    <td><input type="password" name="pass" value=" <?php if (isset($_POST['pass'])) echo htmlentities(trim($_POST['pass'])); ?> "></td>
    </tr>
    <tr>
    <td><br />
    Confirmation du mot de passe : </td>
    <td><input type="password" name="pass_confirm" value=" <?php if (isset($_POST['pass_confirm'])) echo htmlentities(trim($_POST['pass_confirm'])); ?> "></td>
    </tr>
    <tr>
    <td>Age :</td>
    <td><input type="text" name="age" maxlength="3" value=" <?php if (isset($_POST['age'])) echo intval($_POST['pass_confirm']); ?> ">
    ans</td>
    </tr>
    <tr>
    <td>Sexe :</td>
    <td><input type="radio" name="sexe" value="0"<?=empty($_POST['sexe']) ? ' checked="checked"' : '' ?>>
    Homme
    <input type="radio" name="sexe" value="1"<?=!empty($_POST['sexe']) ? ' checked="checked"' : '' ?>>
    Femme</td>
    </tr>
    <tr>
    <td>Ville :</td>
    <td><input type="text" name="ville" value=" <?php if (isset($_POST['ville'])) echo htmlentities(trim($_POST['ville'])); ?> "></td>
    </tr>
    <tr>
    <td>Pays :</td>
    <td><input type="text" name="pays" value=" <?php if (isset($_POST['pays'])) echo htmlentities(trim($_POST['pays'])); ?> "></td>
    </tr>
    <tr>
    <td>Style musical : </td>
    <td><input type="text" name="style" value=" <?php if (isset($_POST['style'])) echo htmlentities(trim($_POST['style'])); ?> "></td>
    </tr>
    <tr>
    <td height="135">Présentation :</td>
    <td><textarea name="description2" cols="50" rows="8"> <?php if (isset($_POST['description'])) echo htmlentities(trim($_POST['description'])); ?>
    </textarea></td>
    </tr>
    </table><br />
    <input type="submit" name="inscription" value="Inscription">
    </form>
    <?php
    if (isset($erreur)) echo '<br />',$erreur;
    ?>
     
     
     
     
    <div style="text-align:center">
    </p></td>
    </tr>
    </table></td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td width="210" height="23" background="images/bg_01.gif" bgcolor="#E02D17"> </td>
    <td background="images/bg_01.gif" bgcolor="#E02D17" class="bmenu">Partage-Playlist || <a href="#">33150</a> || skysek@msn.com || 2010 ||<br />
    <br />
    Copyright dj sky© 2010. Provided By <a href="http://www.template4all.com">Free CSS Templates</a></td>
    </tr>
    </table>
    <div style="position:absolute;left:-30000px;top:-30000px"><a href="http://anvisionwebtemplates.com">Website templates</a><a href="http://www.template4all.com">Free Web Templates</a><a href="http://www.freethemes4all.com">Freethemes4all.com</a><a href="http://anvisionwebdesign.com">Website design company</a><a href="http://webdesignfinders.net">Web design directory</a><a href="http://australia.webdesignfinders.net">Web design directory Australia</a><a href="http://canada.webdesignfinders.net">Web design directory Canada</a><a href="http://anvisionwebtemplates.com/free-music-web-templates-layouts.html">Free music web templates</a></div>
    </body>
    </html>

    Merci d'avance !

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Tu as des espaces qui trainent dans tes champs :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <input type="text" name="login" value="espace_ici<?php

Discussions similaires

  1. Les codes d'inscription
    Par GreatDeveloperOnizuka dans le forum Débuter
    Réponses: 2
    Dernier message: 25/05/2010, 19h46
  2. [MySQL] Code page inscription
    Par baderahmed dans le forum PHP & Base de données
    Réponses: 3
    Dernier message: 07/06/2009, 15h26
  3. [MySQL] code inscription correct ?
    Par win22 dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 07/06/2008, 02h56
  4. Réponses: 2
    Dernier message: 03/07/2007, 23h48
  5. [MySQL] Question code auto inscription formulaire
    Par dekovince dans le forum PHP & Base de données
    Réponses: 3
    Dernier message: 26/02/2007, 14h45

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo