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

PHP & Base de données Discussion :

problème pour mettre en ligne mon site


Sujet :

PHP & Base de données

  1. #41
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 92
    Points : 70
    Points
    70
    Par défaut
    c'est grace a cette page que tu peux te connecter a ta bdd, donc il faut l'envoyer aussi sur le serveur, sans elle pas de connexion vu que c'est elle qui contient les renseignements de connexions

  2. #42
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    C'est pour ça que j'obtiens ce message quand je veux voir mon site sur internet:

    Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'root'@'randall.pw' (using password: NO) in /home/resultats-rugby/www/Connections/infortech.php on line 9

    Fatal error: Access denied for user 'root'@'randall.pw' (using password: NO) in /home/resultats-rugby/www/Connections/infortech.php on line 9

  3. #43
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 92
    Points : 70
    Points
    70
    Par défaut
    je suis loin d'etre un expert en php/mysql, mais tu ne te serais pas compliqué pour faire ta connexion ?

    dans ta page infortech.php, ecrit simplement ca

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    <?php
    $hostname_infortech = "localhost";
    $database_infortech = "ta base de donnees";
    $username_infortech = "root";
    $password_infortech = "ton mot de passe"; 
    ?>

    et dans ta page a afficher

    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
     
    <?php
     
    include'chemin vers infortech.php';
     
    mysql_connect($hostname_infortech,$username_infortech,$password_infortech);
    mysql_select_db($database_infortech);
     
    ton code php
     
    .....
     
     
    mysql_close();
    ?>

  4. #44
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    C'est fort possible que je me sois compliquée la vie.

  5. #45
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 92
    Points : 70
    Points
    70
    Par défaut
    essaye et redis moi ca

  6. #46
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Je suis ok pour afficher ça:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    <?php
     
    include'chemin vers infortech.php';
     
    mysql_connect($hostname_infortech,$username_infortech,$password_infortech);
    mysql_select_db($database_infortech);
     
    ton code php
     
    .....
     
     
    mysql_close();
    ?>



    En revanche sa va me faire du boulot car ma page web contient tout ceci:
    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
    <?php require_once('Connections/infortech.php'); ?>
     
    <?php
    //initialize the session
    if (!isset($_SESSION)) {
      session_start();
    }
     
    // ** Logout the current user. **
    $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
    if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
      $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
    }
     
    if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
      //to fully log out a visitor we need to clear the session varialbles
      $_SESSION['MM_Username'] = NULL;
      $_SESSION['MM_UserGroup'] = NULL;
      $_SESSION['PrevUrl'] = NULL;
      unset($_SESSION['MM_Username']);
      unset($_SESSION['MM_UserGroup']);
      unset($_SESSION['PrevUrl']);
     
      $logoutGoTo = "logout.php";
      if ($logoutGoTo) {
        header("Location: $logoutGoTo");
        exit;
      }
    }
    ?>
    <?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['mail'])) {
      $loginUsername=$_POST['mail'];
      $password=$_POST['Mdp'];
      $MM_fldUserAuthorization = "";
      $MM_redirectLoginSuccess = "account/index.php";
      $MM_redirectLoginFailed = "login_failed.php";
      $MM_redirecttoReferrer = false;
      mysql_select_db($database_infortech, $infortech);
     
      $LoginRS__query=sprintf("SELECT email, mdp FROM shop_client WHERE email='%s' AND mdp='%s'",
        get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); 
     
      $LoginRS = mysql_query($LoginRS__query, $infortech) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
     
        //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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>index</title>
    <meta NAME="description" content="Informatique JHV assistance informatique de proximité. Assistance informatique pour les entreprises et les particuliers, formation et solutions web : découvrez nos cœurs de métier !"><meta NAME="keywords" content="Assistance informatique, Formation informatique, Création site web, Dépannage informatique, Vente de matériels"><meta NAME="ROBOTS" CONTENT="all | follow | index">
    <META content="7 days" name=revisit-after>
     
    <style type="text/css">
    <!--
    body {
    	background-color: #FFFFFF;
    }
    .Style1 {color: #FFFFFF}
    .Style2 {
    	font-size: 18px;
    	font-weight: bold;
    }
    .Style5 {
    	font-size: 14px;
    	color: #CCCCCC;
    }
    .Style8 {font-size: 85%}
    .Style10 {font-size: 14px}
    .Style11 {font-size: 14px; color: #CCCCCC; font-weight: bold; }
    .Style13 {
    	color: #CCCCCC;
    	font-size: 16px;
    	font-weight: bold;
    }
    .Style14 {color: #000000}
    .Style16 {color: #FFFFFF; font-weight: bold; }
    .Style17 {color: #000000; font-weight: bold; }
    .Style18 {font-size: 12px; font-weight: bold; color: #000000; }
    .Style25 {font-size: 12px}
    -->
    </style></head>
     
    <body>
    <table width="1500" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="90" colspan="5"><img src="images/titre1.jpg" width="1500" height="90" /></td>
      </tr>
      <tr>
        <td height="20" colspan="5" bgcolor="#FFFFFF">&nbsp;</td>
      </tr>
      <tr>
        <td width="300" bgcolor="#FFFFFF"><span class="Style25"><span class="Style15">
            </span>
          <li class="Style25">
            <?php
    echo 'Nous sommes le: ' . date('d/m/Y'); ?>
            </li>
          <li class="Style25">
            <?php
    echo 'à: '. date ('H:i:s');
    ?>
        </li></td>
        </html>

  7. #47
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Bon j'ai tout de même testé ta méthode.

    La page s'affiche presque correctement. Mais il y a tout de même des messages d'erreur:

    Warning: include(chemin vers infortech.php) [function.include]: failed to open stream: No such file or directory in /home/resultats-rugby/www/index.php on line 3

    Warning: include() [function.include]: Failed opening 'chemin vers infortech.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/resultats-rugby/www/index.php on line 3

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'www-data'@'merlin.pw' (using password: NO) in /home/resultats-rugby/www/index.php on line 5

    Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'www-data'@'merlin.pw' (using password: NO) in /home/resultats-rugby/www/index.php on line 6

    Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/resultats-rugby/www/index.php on line 6

    Warning: mysql_close(): no MySQL-Link resource supplied in /home/resultats-rugby/www/index.php on line 7

    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/resultats-rugby/www/index.php:3) in /home/resultats-rugby/www/index.php on line 14

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/resultats-rugby/www/index.php:3) in /home/resultats-rugby/www/index.php on line 14

  8. #48
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 92
    Points : 70
    Points
    70
    Par défaut
    pour les deux premiere erreur, c'est juste le chemin vers infortech.php qui n'est pas bon, en gros php ne l'a pas trouvé, donc il te le dis sous forme d'erreur.

    apres c'est toujours le mot de passe qui derange, suivant si tu es en local ou en ligne, vérifie bien le mot de passe et le nom de ta base de données.

    et aussi, fait attention ce ne sont pas les tirets (-), mais les underscore(_) qu'il faut mettre

    par exemple

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    arning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'www-data'@'merlin.pw' (using password: NO) in /home/resultats-rugby/www/index.php on line 6
    pour mysql_close();

    tu as mis ":", c'est ";" que tu dois mettre a la fin, fait bien attention, ca change tout le reste du code c'est petites erreur la, et ca te retourne un message d'erreur

  9. #49
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Pourtant je suis certaine du mot de passe que j'ai mis chez mon hébergeur.

    Ensuite chez mon hébergeur ma base se nomme "resultats-rugby" donc je peux pas avoir d'underscore?

  10. #50
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 92
    Points : 70
    Points
    70
    Par défaut
    le underscore n'est pas pour ta bdd mais pour ta requete

    ecrit


    montre moi le code que tu as ecrit

  11. #51
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    <?php
     
    include'chemin vers infortech.php';
     
    mysql_connect($hostname_infortech,$username_infortech,$password_infortech);
    mysql_select_db($database_infortech);
     
    mysql_close();
    ?>

    Le code est bon me semble-t-il.

  12. #52
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 92
    Points : 70
    Points
    70
    Par défaut
    Citation Envoyé par juju1558 Voir le message
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    <?php
     
    include'chemin vers infortech.php';
     
    mysql_connect($hostname_infortech,$username_infortech,$password_infortech);
    mysql_select_db($database_infortech);
     
    mysql_close();
    ?>

    Le code est bon me semble-t-il.
    pour la requete oui, par contre c'est normal qu'il ne trouve pas ton fichier infortech.php, tu as laisser la phrase que j'ai mis ^^, rentre le vrai chemin vers le fichier, deja tu auras deux erreurs en moins normalement

    tu remplace "chemin vers infortech.php" par le chemin (dossier + fichier)

  13. #53
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Bon ça commence à être beaucoup mieux.

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'resultats_rugby'@'flint.pw' (using password: YES) in /home/resultats-rugby/www/index.php on line 5

    Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'www-data'@'flint.pw' (using password: NO) in /home/resultats-rugby/www/index.php on line 6

    Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/resultats-rugby/www/index.php on line 6

    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/resultats-rugby/www/index.php:5) in /home/resultats-rugby/www/index.php on line 11

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/resultats-rugby/www/index.php:5) in /home/resultats-rugby/www/index.php on line 11

    C'est ce qui reste

  14. #54
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 92
    Points : 70
    Points
    70
    Par défaut
    est ce que c'est voulus qu'il essaye de se connecter a deux bdd differentes ?

    la premiere, la tienne

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'resultats_rugby'@'flint.pw' (using password: YES) in /home/resultats-rugby/www/index.php on line 5
    la deuxieme

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'www-data'@'flint.pw' (using password: NO) in /home/resultats-rugby/www/index.php on line 6

    la premiere a besoin d'un mot de passe, la seconde non

  15. #55
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Non c'est pas voulu.

    En fait la base "infortech" est ma base en local. "Resultats-rugby" est ma base chez mon hébergeur.

  16. #56
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 92
    Points : 70
    Points
    70
    Par défaut
    tu peux me montrer les lignes correspondantes aux deux messages d'erreur stp

    Ensuite, renomme ta base local du meme nom que celle qui est en ligne, ca t'evitera de te trompé ou d'oublier. Idem pour le mot de passe, met le en local.

  17. #57
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Oui sans aucun problème.

    Les lignes 5 et 6:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    mysql_connect($hostname_infortech,$username_infortech,$password_infortech);
    mysql_select_db($database_infortech);
    La ligne 11:

  18. #58
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 92
    Points : 70
    Points
    70
    Par défaut
    Ok, alors pour commencer, quand tu fais un session_start();, tu dois le mettre en premier, au tout debut du code.

    en clair tu dois avoir

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    <?php
     
    session_start();
     
    // Le reste de ton code ...
     
    ?>
    Test deja ca et remet moi les messages d'erreur

  19. #59
    Membre à l'essai
    Profil pro
    Inscrit en
    Août 2006
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 106
    Points : 19
    Points
    19
    Par défaut
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'resultats_rugby'@'randall.pw' (using password: YES) in /home/resultats-rugby/www/index.php on line 5

    Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'www-data'@'randall.pw' (using password: NO) in /home/resultats-rugby/www/index.php on line 6

    Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/resultats-rugby/www/index.php on line 6

    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/resultats-rugby/www/index.php:5) in /home/resultats-rugby/www/index.php on line 7

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/resultats-rugby/www/index.php:5) in /home/resultats-rugby/www/index.php on line 7

  20. #60
    Membre régulier
    Profil pro
    Inscrit en
    Août 2009
    Messages
    92
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France

    Informations forums :
    Inscription : Août 2009
    Messages : 92
    Points : 70
    Points
    70
    Par défaut
    pour ce qui est du session_start, quand je dis au debut du code, c'est vraiment au tout debut, a la premiere ligne, avant tout autres code.

    Par contre je comprend pas pourquoi il cherche a se connecter a une autre base de données que celle voulut.

    Remet ta page "infortech.php" stp, le probleme vient de la je pense.

    et aussi le code de connection (ligne 5 et 6) avec tout le code qui vient avant

Discussions similaires

  1. Réponses: 5
    Dernier message: 04/07/2012, 16h01
  2. configurer et utiliser dns gandi pour mettre en ligne un site
    Par lodilodi dans le forum Serveurs (Apache, IIS,...)
    Réponses: 4
    Dernier message: 12/10/2009, 21h51
  3. [DW MX] Problème pour mettre en ligne le site
    Par monadali dans le forum Dreamweaver
    Réponses: 9
    Dernier message: 07/11/2007, 08h40
  4. Site pour mettre en ligne des document à télécharger
    Par snoopy69 dans le forum Autres Logiciels
    Réponses: 4
    Dernier message: 24/01/2006, 19h59
  5. mettre en ligne mon site avec dreamweaver...
    Par arti2004 dans le forum Dreamweaver
    Réponses: 6
    Dernier message: 22/12/2005, 08h42

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