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 ;)
Version imprimable
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 ;)
C'est pour ça que j'obtiens ce message quand je veux voir mon site sur internet:
Citation:
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
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:
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:
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(); ?>
C'est fort possible que je me sois compliquée la vie.
essaye et redis moi ca;)
Je suis ok pour afficher ça:
Code:
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:
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 curs 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"> </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>
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:
Citation:
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
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
pour mysql_close();Code: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
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 ;)
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?
le underscore n'est pas pour ta bdd mais pour ta requete
ecritCode:...mysql-select-db...
Code:...mysql_select_db...
montre moi le code que tu as ecrit
Code:
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)
Bon ça commence à être beaucoup mieux.
Citation:
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
est ce que c'est voulus qu'il essaye de se connecter a deux bdd differentes ?
la premiere, la tienne
la deuxiemeCode: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
Code: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
Non c'est pas voulu.
En fait la base "infortech" est ma base en local. "Resultats-rugby" est ma base chez mon hébergeur.
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.
Oui sans aucun problème.
Les lignes 5 et 6:
La ligne 11:Code:
1
2 mysql_connect($hostname_infortech,$username_infortech,$password_infortech); mysql_select_db($database_infortech);
Code:session_start()
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
Test deja ca et remet moi les messages d'erreur ;)Code:
1
2
3
4
5
6
7
8 <?php session_start(); // Le reste de ton code ... ?>
Citation:
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
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