A voir également:
- Erreur PHP
- Erreur 0x80070643 - Accueil - Windows
- Erreur 0x80070643 Windows 10 : comment résoudre le problème de la mise à jour KB5001716 - Accueil - Windows
- Erreur 1001 outlook - Accueil - Bureautique
- Erreur 5000 france tv - Forum iPhone
- Erreur de lecture reconnecté en 3s - Forum TV & Vidéo
2 réponses
Exileur
Messages postés
1475
Date d'inscription
mercredi 31 août 2011
Statut
Membre
Dernière intervention
16 décembre 2022
150
Modifié par Exileur le 16/02/2015 à 19:41
Modifié par Exileur le 16/02/2015 à 19:41
Salut,
Je suppose que la ligne 18 est :
Le message d'erreur est donc "La variable localhost n'est pas défini"
Dailleur si on regarde plus haut, lors de la déclaration du tableau C il est défini vide :
Donc, soit le tout est charger dans la fonction load_config(); et la faudra que tu nous montres un peu plus de code.
Soit, il faut définir les différentes variable dans le tableau.
Cordialement
N'oubliez pas de marquez votre post comme résolut lorsque vous avez eu les réponses à vos questions...
Au royaume des aveugles, les borgnes sont rois.
Je suppose que la ligne 18 est :
$mysqli = mysqli_connect($C['localhost'], $C['root'], $C['azerty'], $C['lechat']);
Le message d'erreur est donc "La variable localhost n'est pas défini"
Dailleur si on regarde plus haut, lors de la déclaration du tableau C il est défini vide :
$C=array();// Configuration
Donc, soit le tout est charger dans la fonction load_config(); et la faudra que tu nous montres un peu plus de code.
Soit, il faut définir les différentes variable dans le tableau.
$C['addr'] = 'localhost'; $C['usr'] = 'root'; $C['passwd'] = 'azerty'; $C['data_base'] = 'lechat'; $mysqli = mysqli_connect($C['addr'], $C['user'], $C['passwd'], $C['data_base']);
Cordialement
N'oubliez pas de marquez votre post comme résolut lorsque vous avez eu les réponses à vos questions...
Au royaume des aveugles, les borgnes sont rois.
'Verdana small' =>" face='Verdana,Geneva,Arial,Helvetica,sans-serif' size=\"-1\""
);
$C['colbg'] ='000000'; // Background colour
$C['coltxt']='FFFFFF'; // Default text colour
$C['collnk']='0000FF'; // Link colour
$C['colvis']='B33CB4'; // Visited link colour
$C['colact']='FF0033'; // Clicked link colour
$C['sessionexpire'] =60; // Minutes until a member session expires
$C['guestsexpire'] =15; // Minutes until a guest session expires
$C['kickpenalty'] =10; // Minutes a nickname is blocked when it got kicked
$C['entrywait'] =120; // Seconds to wait in the waiting room after login
$C['cookiename'] ='chat_session'; // Cookie name storing the session information
$C['chatname'] ='Noel Chat'; // Chat Name
$C['messageexpire'] =14400; // Minutes until a message expires
$C['messagelimit'] =150; // Max messages displayed
$C['defaultrefresh']=30; // Seconds to refresh the messages
$C['maxmessage'] =2000; // Longest number of characters for a message
$C['maxname'] =20; // Longest number of chatacters for a name
$C['dbhost'] ='localhost'; // Database host
$C['dbuser'] ='root'; // Database user
$C['dbpass'] ='azerty'; // Database password
$C['dbname'] ='lechat'; // Database
$C['captchapass'] ='693latrik'; // Password used for captcha encryption
$C['enablecaptcha'] =false; // Enable captcha? ture/false
$C['dismemcaptcha'] =true; // Disable captcha for members? ture/false
$C['imgembedd'] =true; // Allow image embedding in chat using [img] tag? ture/false Warning: this might leak session data to the image hoster when cookies are disabled.
$C['vidembedd'] =true; // Allow video embedding in chat using [vid] tag? ture/false Warning: this might leak session data to the video hoster when cookies are disabled.
$C['suguests'] =false; // Adds option to add superguests. They will have a reserved nick protected with a password, but don't count as member true/false
$C['timestamps'] =true; // Display a timestamp in front of the messages true/false
$C['forceredirect'] =false; // Force redirect script or only use when no cookies available? ture/false
$C['redirect'] ="$_SERVER[SCRIPT_NAME]?action=redirect&url="; // Redirect script default: $_SERVER[SCRIPT_NAME]?action=redirect&url=
$C['lang'] ='en'; // Default language
$C['rulestxt'] ='1. Pas de KiKoOoooO D4rK Caution!<br>2. No BrU7aL KiKoOoooO.<br>3. S'il vous plaît mettez [img] devant l'URL directe d'une image pour intégrer l'image dans le chat et [vid] pour une video.'; // Rules
if(isSet($_REQUEST['lang'])){
$C['lang'] = $_REQUEST['lang'];
setcookie('language', $C['lang']);
} elseif(isSet($_COOKIE['language'])) {
$C['lang'] = $_COOKIE['language'];
}
include('lang_en.php'); //always include English
if($C['lang'] == 'de') include('lang_de.php'); //include translated German
$H=array(// default HTML
'begin_body' =>"\n<body bgcolor=\"#$C[colbg]\" text=\"#$C[coltxt]\" link=\"#$C[collnk]\" alink=\"#$C[colact]\" vlink=\"#$C[colvis]\">\n",
'form' =>"form action=\"$_SERVER[SCRIPT_NAME]\" method=\"post\" style=\"margin:0;padding:0;\"",
'meta_html' =>"<title>$C[chatname]</title><meta name=\"robots\" content=\"noindex,nofollow\">\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\n<meta http-equiv=\"expires\" content=\"0\">",
'versiontag' =>"<small>LE CHAT - v1.14-PHP</small>",
);@$H=$H+array(
'backtologin' =>"<$H[form] target=\"_parent\">".submit($I['backtologin']," style=\"background-color:#004400;color:#FFFFFF;\"").'</form>',
'backtochat' =>"<$H[form]>".hidden('action','view').hidden('session',$_REQUEST['session']).submit($I['backtochat']," style=\"background-color:#004400;color:#FFFFFF;\"").'</form>',
);
}
?>
La suite...
);
$C['colbg'] ='000000'; // Background colour
$C['coltxt']='FFFFFF'; // Default text colour
$C['collnk']='0000FF'; // Link colour
$C['colvis']='B33CB4'; // Visited link colour
$C['colact']='FF0033'; // Clicked link colour
$C['sessionexpire'] =60; // Minutes until a member session expires
$C['guestsexpire'] =15; // Minutes until a guest session expires
$C['kickpenalty'] =10; // Minutes a nickname is blocked when it got kicked
$C['entrywait'] =120; // Seconds to wait in the waiting room after login
$C['cookiename'] ='chat_session'; // Cookie name storing the session information
$C['chatname'] ='Noel Chat'; // Chat Name
$C['messageexpire'] =14400; // Minutes until a message expires
$C['messagelimit'] =150; // Max messages displayed
$C['defaultrefresh']=30; // Seconds to refresh the messages
$C['maxmessage'] =2000; // Longest number of characters for a message
$C['maxname'] =20; // Longest number of chatacters for a name
$C['dbhost'] ='localhost'; // Database host
$C['dbuser'] ='root'; // Database user
$C['dbpass'] ='azerty'; // Database password
$C['dbname'] ='lechat'; // Database
$C['captchapass'] ='693latrik'; // Password used for captcha encryption
$C['enablecaptcha'] =false; // Enable captcha? ture/false
$C['dismemcaptcha'] =true; // Disable captcha for members? ture/false
$C['imgembedd'] =true; // Allow image embedding in chat using [img] tag? ture/false Warning: this might leak session data to the image hoster when cookies are disabled.
$C['vidembedd'] =true; // Allow video embedding in chat using [vid] tag? ture/false Warning: this might leak session data to the video hoster when cookies are disabled.
$C['suguests'] =false; // Adds option to add superguests. They will have a reserved nick protected with a password, but don't count as member true/false
$C['timestamps'] =true; // Display a timestamp in front of the messages true/false
$C['forceredirect'] =false; // Force redirect script or only use when no cookies available? ture/false
$C['redirect'] ="$_SERVER[SCRIPT_NAME]?action=redirect&url="; // Redirect script default: $_SERVER[SCRIPT_NAME]?action=redirect&url=
$C['lang'] ='en'; // Default language
$C['rulestxt'] ='1. Pas de KiKoOoooO D4rK Caution!<br>2. No BrU7aL KiKoOoooO.<br>3. S'il vous plaît mettez [img] devant l'URL directe d'une image pour intégrer l'image dans le chat et [vid] pour une video.'; // Rules
if(isSet($_REQUEST['lang'])){
$C['lang'] = $_REQUEST['lang'];
setcookie('language', $C['lang']);
} elseif(isSet($_COOKIE['language'])) {
$C['lang'] = $_COOKIE['language'];
}
include('lang_en.php'); //always include English
if($C['lang'] == 'de') include('lang_de.php'); //include translated German
$H=array(// default HTML
'begin_body' =>"\n<body bgcolor=\"#$C[colbg]\" text=\"#$C[coltxt]\" link=\"#$C[collnk]\" alink=\"#$C[colact]\" vlink=\"#$C[colvis]\">\n",
'form' =>"form action=\"$_SERVER[SCRIPT_NAME]\" method=\"post\" style=\"margin:0;padding:0;\"",
'meta_html' =>"<title>$C[chatname]</title><meta name=\"robots\" content=\"noindex,nofollow\">\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\n<meta http-equiv=\"expires\" content=\"0\">",
'versiontag' =>"<small>LE CHAT - v1.14-PHP</small>",
);@$H=$H+array(
'backtologin' =>"<$H[form] target=\"_parent\">".submit($I['backtologin']," style=\"background-color:#004400;color:#FFFFFF;\"").'</form>',
'backtochat' =>"<$H[form]>".hidden('action','view').hidden('session',$_REQUEST['session']).submit($I['backtochat']," style=\"background-color:#004400;color:#FFFFFF;\"").'</form>',
);
}
?>
La suite...
Exileur
Messages postés
1475
Date d'inscription
mercredi 31 août 2011
Statut
Membre
Dernière intervention
16 décembre 2022
150
Modifié par Exileur le 16/02/2015 à 20:14
Modifié par Exileur le 16/02/2015 à 20:14
Fichier de config :
Page qui bug :
Cordialement
$C['dbhost'] ='localhost'; // Database host $C['dbuser'] ='root'; // Database user $C['dbpass'] ='azerty'; // Database password $C['dbname'] ='lechat'; // Database
Page qui bug :
$mysqli = mysqli_connect($C['dbhost'], $C['dbuser'], $C['dbpass'], $C['dbname']);
Cordialement
Tu pourrais m'aider pour ça :
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1015
Warning: mysqli_stmt_get_result() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1016
Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1017
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\xx - Copie\chat.php on line 1018
( ! ) Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1036
( ! ) Warning: mysqli_stmt_get_result() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1037
( ! ) Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1038
( ! ) Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\xx - Copie\chat.php on line 1039
function parse_sessions(){
global $U, $P, $M, $G, $C, $mysqli, $countmods;
$stmt=mysqli_prepare($mysqli, 'SELECT nickname FROM `sessions` WHERE (`lastpost`<\''.(time()-60*$C['guestsexpire']).'\' AND `status`<=\'2\') OR (`lastpost`<\''.(time()-60*$C['sessionexpire']).'\' AND `status`>\'2\')');
mysqli_stmt_execute($stmt);
$result=mysqli_stmt_get_result($stmt);
mysqli_stmt_close($stmt);
if(mysqli_num_rows($result) > 0) {
$lines = mysqli_fetch_all($result,MYSQLI_ASSOC);
$stmt=mysqli_prepare($mysqli, 'DELETE FROM `sessions` WHERE `nickname`=?');
$stmt1=mysqli_prepare($mysqli, 'UPDATE `messages` SET `poster`=\'\' WHERE `poster`=? AND `poststatus`=\'9\'');
$stmt2=mysqli_prepare($mysqli, 'UPDATE `messages` SET `recipient`=\'\' WHERE `recipient`=? AND `poststatus`=\'9\'');
foreach($lines as $temp){
mysqli_stmt_bind_param($stmt, 's', $temp['nickname']);
mysqli_stmt_bind_param($stmt1, 's', $temp['nickname']);
mysqli_stmt_bind_param($stmt2, 's', $temp['nickname']);
mysqli_stmt_execute($stmt);
mysqli_stmt_execute($stmt1);
mysqli_stmt_execute($stmt2);
}
mysqli_stmt_close($stmt);
mysqli_stmt_close($stmt1);
mysqli_stmt_close($stmt2);
}
$stmt=mysqli_prepare($mysqli, 'SELECT * FROM `sessions` WHERE `entry`=\'0\' ORDER BY `status` DESC, `lastpost` DESC');
mysqli_stmt_execute($stmt);
$result=mysqli_stmt_get_result($stmt);
mysqli_stmt_close($stmt);
if(mysqli_num_rows($result) > 0) {
$lines = mysqli_fetch_all($result,MYSQLI_ASSOC);
if(isSet($_REQUEST['session'])) foreach($lines as $temp){
if($temp['session']==$_REQUEST['session']){
$U=$temp;
add_user_defaults();
}
}
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1015
Warning: mysqli_stmt_get_result() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1016
Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1017
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\xx - Copie\chat.php on line 1018
( ! ) Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1036
( ! ) Warning: mysqli_stmt_get_result() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1037
( ! ) Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in C:\wamp\www\xx - Copie\chat.php on line 1038
( ! ) Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\xx - Copie\chat.php on line 1039
function parse_sessions(){
global $U, $P, $M, $G, $C, $mysqli, $countmods;
$stmt=mysqli_prepare($mysqli, 'SELECT nickname FROM `sessions` WHERE (`lastpost`<\''.(time()-60*$C['guestsexpire']).'\' AND `status`<=\'2\') OR (`lastpost`<\''.(time()-60*$C['sessionexpire']).'\' AND `status`>\'2\')');
mysqli_stmt_execute($stmt);
$result=mysqli_stmt_get_result($stmt);
mysqli_stmt_close($stmt);
if(mysqli_num_rows($result) > 0) {
$lines = mysqli_fetch_all($result,MYSQLI_ASSOC);
$stmt=mysqli_prepare($mysqli, 'DELETE FROM `sessions` WHERE `nickname`=?');
$stmt1=mysqli_prepare($mysqli, 'UPDATE `messages` SET `poster`=\'\' WHERE `poster`=? AND `poststatus`=\'9\'');
$stmt2=mysqli_prepare($mysqli, 'UPDATE `messages` SET `recipient`=\'\' WHERE `recipient`=? AND `poststatus`=\'9\'');
foreach($lines as $temp){
mysqli_stmt_bind_param($stmt, 's', $temp['nickname']);
mysqli_stmt_bind_param($stmt1, 's', $temp['nickname']);
mysqli_stmt_bind_param($stmt2, 's', $temp['nickname']);
mysqli_stmt_execute($stmt);
mysqli_stmt_execute($stmt1);
mysqli_stmt_execute($stmt2);
}
mysqli_stmt_close($stmt);
mysqli_stmt_close($stmt1);
mysqli_stmt_close($stmt2);
}
$stmt=mysqli_prepare($mysqli, 'SELECT * FROM `sessions` WHERE `entry`=\'0\' ORDER BY `status` DESC, `lastpost` DESC');
mysqli_stmt_execute($stmt);
$result=mysqli_stmt_get_result($stmt);
mysqli_stmt_close($stmt);
if(mysqli_num_rows($result) > 0) {
$lines = mysqli_fetch_all($result,MYSQLI_ASSOC);
if(isSet($_REQUEST['session'])) foreach($lines as $temp){
if($temp['session']==$_REQUEST['session']){
$U=$temp;
add_user_defaults();
}
}
Exileur
Messages postés
1475
Date d'inscription
mercredi 31 août 2011
Statut
Membre
Dernière intervention
16 décembre 2022
150
16 févr. 2015 à 20:25
16 févr. 2015 à 20:25
oui puisque tu configures la DataBase dans ton fichier / ta fonction de config sous ces "index"s
sinon il faut mettre :
Mais bon. Si tu changes ou migres de DB, ça sera galère si ton site contient plusieurs pages.
C'est plus simple un fichier de config ^^
sinon il faut mettre :
$mysqli = mysqli_connect('localhost', 'root', 'azerty', 'lechat');
Mais bon. Si tu changes ou migres de DB, ça sera galère si ton site contient plusieurs pages.
C'est plus simple un fichier de config ^^