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

Dreamweaver Discussion :

Création interface pour compte client.


Sujet :

Dreamweaver

Mode arborescent

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Invité
    Invité(e)
    Par défaut Création interface pour compte client.
    Bonjour, mon problème est que j'ai fait une base de données de client donc dans la table clients il y a notamment les attributs : nom et motdepasse.

    Je souhaiterai donc faire une interface, quand un client rentre son nom et son mot de passe, il peut voir un tableau propre a lui-même (information prise dans la table clients).

    j'arrive à faire une interface, avec vérification du nom et du mot de passe, si identifier sa bascule sur la page : suivi.php et s'il y a un problème la redirection est faite vers : index_erreur.php.

    Maintenant que la mise en situation est fini je vais décrire mon problème :

    Dans la page suivi.php j'arrive pas tous simplement a récupéré le nom mis par le client. Je souhaiterais donc que le nom rentré dans le champ doit être servi pour faire l'appel du tableau dans la page suivi.php.

    ma page index.php.
    Code php : 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
     <?php require_once('../Connections/local.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
     
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
     
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    }
     
    mysql_select_db($database_local, $local);
    $query_client = "SELECT * FROM clients";
    $client = mysql_query($query_client, $local) or die(mysql_error());
    $row_client = mysql_fetch_assoc($client);
    $totalRows_client = mysql_num_rows($client);
    ?>
    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
      session_start();
    }
     
    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
      $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    }
     
    if (isset($_POST['nom'])) {
      $loginUsername=$_POST['nom'];
      $password=$_POST['motdepasse'];
      $MM_fldUserAuthorization = "";
      $MM_redirectLoginSuccess = "suivi.php";
      $MM_redirectLoginFailed = "index_erreur.php";
      $MM_redirecttoReferrer = false;
      mysql_select_db($database_local, $local);
     
      $LoginRS__query=sprintf("SELECT nom, motdepasse FROM clients WHERE nom=%s AND motdepasse=%s",
        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
     
      $LoginRS = mysql_query($LoginRS__query, $local) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
     
    	if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
        //declare two session variables and assign them
        $_SESSION['MM_Username'] = $loginUsername;
        $_SESSION['MM_UserGroup'] = $loginStrGroup;	      
     
        if (isset($_SESSION['PrevUrl']) && false) {
          $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
        }
        header("Location: " . $MM_redirectLoginSuccess );
      }
      else {
        header("Location: ". $MM_redirectLoginFailed );
      }
    }
    ?>
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Suivi</title>
    <link href="../style/reset.css" rel="stylesheet" type="text/css">
    <link href="../style/css page.css" rel="stylesheet" type="text/css">
    <link href="style/style suivi.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <div class="header">
    	<img src="../images/batideal.jpg" width="156" height="155" alt="batideal">
    </div>
    <div class="centre">
    <p>Poussez la porte de la concrétisation de vos projets du bâtiment.</p>
    <br><br>
    <form ACTION="<?php echo $loginFormAction; ?>" name="login" METHOD="POST">
    <table width="400px" border="0">
      <tr>
        <td>Utilisateur :</td>
        <td><input name="nom" type="text"></td>
      </tr>
      <tr>
        <td>Mot de passe : </td>
        <td><input name="motdepasse" type="texte"></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td></td>
      </tr>
     
    </table>
    <input type="submit" value="envoyer">
    </form>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($client);
    ?>

    la page suivi.php :
    Code php : 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
    <?php require_once('../Connections/local.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
     
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
     
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    }
     
    $colname_clients = "-1";
    if (isset($_GET['nom'])) {
      $colname_clients = $_GET['nom'];
    }
    mysql_select_db($database_local, $local);
    $query_clients = sprintf("SELECT * FROM clients WHERE nom = %s", GetSQLValueString($colname_clients, "text"));
    $clients = mysql_query($query_clients, $local) or die(mysql_error());
    $row_clients = mysql_fetch_assoc($clients);
    $totalRows_clients = mysql_num_rows($clients);
     
    $colname_suivi = "-1";
    if (isset($_GET['motdepasse'])) {
      $colname_suivi = $_GET['motdepasse'];
    }
    mysql_select_db($database_local, $local);
    $query_suivi = sprintf("SELECT * FROM clients WHERE motdepasse = %s", GetSQLValueString($colname_suivi, "text"));
    $suivi = mysql_query($query_suivi, $local) or die(mysql_error());
    $row_suivi = mysql_fetch_assoc($suivi);
     
    $colname_suivi = "-1";
    if (isset($_GET['motdepasse'])) {
      $colname_suivi = $_GET['motdepasse'];
    }
    mysql_select_db($database_local, $local);
    $query_suivi = sprintf("SELECT * FROM clients WHERE motdepasse = %s", GetSQLValueString($colname_suivi, "text"));
    $suivi = mysql_query($query_suivi, $local) or die(mysql_error());
    $row_suivi = mysql_fetch_assoc($suivi);
     
    $query_suivi = "SELECT * FROM clients WHERE nom = 'nom'";
    $suivi = mysql_query($query_suivi, $local) or die(mysql_error());
    $row_suivi = mysql_fetch_assoc($suivi);
    $totalRows_suivi = mysql_num_rows($suivi);
     
    $colname_suivi = "-1";
    if (isset($_SESSION['nom'])) {
      $colname_suivi = $_SESSION['nom'];
    }
    mysql_select_db($database_local, $local);
    $query_suivi = sprintf("SELECT * FROM clients WHERE nom = %s", GetSQLValueString($colname_suivi, "text"));
    $suivi = mysql_query($query_suivi, $local) or die(mysql_error());
    $row_suivi = mysql_fetch_assoc($suivi);
     
    $colname_suivi = "-1";
    if (isset($_GET['nom'])) {
      $colname_suivi = $_GET['nom'];
    }
    mysql_select_db($database_local, $local);
    $query_suivi = sprintf("SELECT * FROM clients WHERE nom = %s", GetSQLValueString($colname_suivi, "text"));
    $suivi = mysql_query($query_suivi, $local) or die(mysql_error());
    $row_suivi = mysql_fetch_assoc($suivi);
    ?>
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Suivi</title>
    <link href="../style/reset.css" rel="stylesheet" type="text/css">
    <link href="../style/css page.css" rel="stylesheet" type="text/css">
    <link href="style/style suivi.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <div class="header">
    	<img src="../images/batideal.jpg" width="156" height="155" alt="batideal">
    </div>
    <div class="centre">
    <p>Poussez la porte de la concrétisation de vos projets du bâtiment.</p>
    <br>
    <p><?php echo $row_suivi['nom']; ?></p>
    <br><br><br><br>
    <form action="" method="POST">
        <table width="400px" border="0">
      <tr>
        <td>Nom :</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>Mot de passe :</td>
        <td><?php echo $row_suivi['motdepasse']; ?></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
     
    </form>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($clients);
    ?>

    Merci pour l'aide
    Dernière modification par Bovino ; 24/01/2013 à 15h30. Motif: Merci d'indiquer le langage utilisé ([code=xxx]) !

Discussions similaires

  1. [MySQL] Interface d'administration pour un client
    Par diden138 dans le forum PHP & Base de données
    Réponses: 8
    Dernier message: 23/05/2007, 00h18
  2. Code VBA pour calcul compte client > ou < à 100- Urgent
    Par mabeatrice@yahoo.fr dans le forum Requêtes et SQL.
    Réponses: 1
    Dernier message: 13/03/2007, 16h39
  3. Erreur 403 pour un compte client
    Par Fabster dans le forum Langage
    Réponses: 1
    Dernier message: 17/08/2006, 12h49
  4. [musique] création d'une interface pour se simplifier la vie
    Par Christophe93250 dans le forum Access
    Réponses: 8
    Dernier message: 08/01/2006, 12h21
  5. [FPDF] création d'un interface pour accés à des fichiers PDF
    Par StyleXP dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 19/12/2005, 10h18

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