A force de voir des membres poster des messages du genre :
Comment utiliser les sessions de phpBB sur son site ?
Et de voir qu'ils ne comprennaient pas quand ils obtenaient la réponse :
:arrow: viewtopic_39797.html
J'ai décidé de donner des codes qui pourront être adaptés !!
Avant toute chose, je vous demanderais de suivre les instructions suivantes comme si vous installiez un MOD.
- Code: Tout sélectionner
#
#-----[ OUVRIR ]----------------------------------------------
#
common.php
#
#-----[ TROUVER ]----------------------------------------------
#
//
// Define some basic configuration arrays this also prevents
// malicious rewriting of language and otherarray values via
// URI params
//
#
#-----[ AVANT, AJOUTER ]----------------------------------------------
# Remplacer la valeur de $adresse_ste par l'adresse de votre site (Sans blagues :p)
// Chemin d'accès au site
$adresse_site = "http://www.phpBB.com";
#
#-----[ OUVRIR ]----------------------------------------------
#
viewonline.php
#
#-----[ TROUVER ]----------------------------------------------
#
case PAGE_FAQ:
$location = $lang['Viewing_FAQ'];
$location_url = "faq.$phpEx";
break;
#
#-----[ APRES, AJOUTER ]----------------------------------------------
#
case PAGE_SITE:
$location = $lang['On_the_site'];
$location_url = $adresse_site;
break;
#
#-----[ OUVRIR ]----------------------------------------------
#
includes/constants.php
#
#-----[ TROUVER ]----------------------------------------------
#
define('PAGE_GROUPCP', -11);
#
#-----[ APRES, AJOUTER ]----------------------------------------------
#
define('PAGE_SITE', -12);
#
#-----[ OUVRIR ]----------------------------------------------
#
language/lang_frencg/lang_main.php
#
#-----[ TROUVER ]----------------------------------------------
#
$lang['Viewing_FAQ'] = 'Regarde la FAQ';
#
#-----[ APRES, AJOUTER ]----------------------------------------------
#
$lang['On_the_site'] = 'Est sur le site';
#
#-----[ SAUVEGARDER/FERMER TOUS LES FICHIERS ]------------------------------------------
#
Ces manipulations serviront à afficher sur la page viewonline.php si vos membres sont sur votre site.
- Page de connexion/déconnexion (login.php)
Il vous faut modifier :- Code: Tout sélectionner
$phpbb_root_path = './phpBB2/';
$redirect_login = "login.$phpEx";
$redirect_logout = "login.$phpEx";
$redirect_login doit avoir pour valeur la page vers laquelle sera redirigé le membre quand il se sera connecté.
$redirect_logout doit avoir pour valeur la page vers laquelle sera redirigé le membre quand il se sera déconnecté.
$phpbb_root_path doit avoir pour valeur le chemin d'accès à votre forum (le répertoire).
Note : Remplacez l'extension php par $phpEx.- Code: Tout sélectionner
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './phpBB2/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$redirect_login = "login.$phpEx";
$redirect_logout = "login.$phpEx";
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_SITE);
init_userprefs($userdata);
//
// End session management
//
$logout = htmlspecialchars($HTTP_GET_VARS['logout']);
if ( $logout )
{
session_end($userdata['session_id'], $userdata['user_id']);
redirect(append_sid($redirect_logout));
}
$logue = '<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="center"><a href="?logout=true">' . $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]</a></td>
</tr>
<tr>
<td align="center"><a href="' . append_sid("profil.$phpEx") . '">' . $lang['Profile'] . '</a></td>
</tr>
</table>';
$non_logue = '<form action="' . $phpbb_root_path . 'login.php" method="post">
<table border="0" cellpadding="4" cellspacing="1" align="center">
<tr>
<td>' .$lang['Username'] . ' </td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>' . $lang['Password'] . ' </td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="hidden" name="redirect" value="' . $adresse_site . append_sid($redirect_login) . '"><input type="submit" value="' . $lang['Login'] . '" name="login"></td>
</tr>
</table>
</form>';
if ( $userdata['session_logged_in'] )
{
echo $logue;
}
else
{
echo $non_logue;
}
?>
- Page d'édition du profil (profil.php)
Il vous faut modifier :- Code: Tout sélectionner
$phpbb_root_path = './phpBB2/';
$phpbb_root_path doit avoir pour valeur le chemin d'accès à votre forum (le répertoire).- Code: Tout sélectionner
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './phpBB2/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_SITE);
init_userprefs($userdata);
//
// End session management
//
// Niveau d'erreur par défaut
$erreur = false;
// Varaibles $_POST
$username = htmlspecialchars($_POST['username']);
$email = htmlspecialchars($_POST['email']);
$cur_password = htmlspecialchars($_POST['cur_password']);
$new_password = htmlspecialchars($_POST['new_password']);
$password_confirm = htmlspecialchars($_POST['password_confirm']);
$icq = htmlspecialchars($_POST['icq']);
$aim = htmlspecialchars($_POST['aim']);
$msn = htmlspecialchars($_POST['msn']);
$yim = htmlspecialchars($_POST['yim']);
$website = htmlspecialchars($_POST['website']);
$location = htmlspecialchars($_POST['location']);
$occupation = htmlspecialchars($_POST['occupation']);
$interests = htmlspecialchars($_POST['interests']);
$signature = htmlspecialchars($_POST['signature']);
// On crypte les mots de passe
$crypt_cur_password = md5($cur_password); // Le mot de passe actuel du membre
$crypt_password_confirm = md5($password_confirm); // Le nouveau mot de passe
// Requêtes
$sql = array();
// On sélectionne les infos du membre
$sql[1] = mysql_query("SELECT user_password, user_email FROM `" . $table_prefix . "users` WHERE `username`='" . $userdata['username'] . "'");
// On update les infos du membre SI le membre veut changer son mot de passe
$sql[2] = "UPDATE `" . $table_prefix . "users` SET `user_password`='$crypt_password_confirm' WHERE `username`='" . $userdata['username'] . "'";
// On update les infos du membre SI le membre veut changer son adresse e-mail
$sql[3] = "UPDATE `" . $table_prefix . "users` SET `user_email`='$email' WHERE `username`='" . $userdata['username'] . "'";
// On update le reste
$sql[4] = "UPDATE `" . $table_prefix . "users` SET `username`='$username', `user_icq`='$icq', `user_aim`='$aim', `user_msnm`='$msn', `user_yim`='$yim', `user_website`='$website', `user_from`='$location', `user_occ`='$occupation', `user_interests`='$interests', `user_sig`='$signature' WHERE `username`='" . $userdata['username'] . "'";
$allow_sig = $board_config['allow_sig'];
$allow_namechange = $board_config['allow_namechange'];
$max_sig_chars = $board_config['max_sig_chars'];
$allow_html = $board_config['allow_html'];
$allow_bbcode = $board_config['allow_bbcode'];
$allow_smilies = $board_config['allow_smilies'];
// Signature
$signature_explain = sprintf($lang['Signature_explain'], $max_sig_chars);
if ( $allow_html == 1 )
{
$html_statut = sprintf($lang['HTML_is_ON'], $allow_html);
}
else
{
$html_statut = sprintf($lang['HTML_is_OFF'], $allow_html);
}
if ( $allow_bbcode == 1 )
{
$bbcode_statut = sprintf($lang['BBCode_is_ON'], '<a href="' . $phpbb_root_path . 'faq.' . $phpEx . '?mode=bbcode" target="_blank">', '</a>');
}
else
{
$bbcode_statut = sprintf($lang['BBCode_is_OFF'], '<a href="' . $phpbb_root_path . 'faq.' . $phpEx . '?mode=bbcode" target="_blank">', '</a>');
}
if ( $allow_smilies == 1 )
{
$smilies_statut = sprintf($lang['Smilies_are_ON'], $allow_smilies);
}
else
{
$smilies_statut = sprintf($lang['Smilies_are_OFF'], $allow_smilies);
}
// L'utilisateur est connecté
if ( $userdata['session_logged_in'] )
{
if ( isset($_POST['submit']) ) // Si on valide le formulaire
{
while ( $bdd = mysql_fetch_array($sql[1]) )
{
//------------------------------------ Changement de mot de passe ------------------------------------
if ( !empty($new_password) || !empty($password_confirm) )
{
if ( $new_password != $password_confirm )
{
$erreur = true;
echo $lang['Password_mismatch'];
}
elseif ( empty($cur_password) || $crypt_cur_password != $bdd['user_password'] )
{
$erreur = true;
echo $lang['Current_password_mismatch'];
}
else
{
mysql_query($sql[2]);
}
}
//------------------------------------ Changement d'adresse e-mail ------------------------------------
if ( $email != $userdata['user_email'] ) // Si le champ email est différent de l'adresse actuelle du membre
{
if ( !empty($cur_password) && $crypt_cur_password == $bdd['user_password'] )
{
mysql_query($sql[3]);
}
else
{
$erreur = true;
echo $lang['Current_password_mismatch'];
}
}
} // Fin de la boucle
//------------------------------------ On update le reste ------------------------------------
mysql_query($sql[4]);
if ( !$erreur )
{
echo $lang['Profile_updated'];
}
}
else // Si le formulaire n'est pas validé
{
?>
<form method="post" action="profil.php">
<table border="0" cellpadding="3" cellspacing="1" width="80%" align="center">
<tr>
<th colspan="2" height="25" valign="middle"><?php echo $lang['Registration_info']; ?></th>
</tr>
<?php
if ( $allow_namechange == 0 )
{
?>
<tr>
<td width="38%"><?php echo $lang['Username']; ?>:</td>
<td><input type="hidden" name="username" value="<?php echo $userdata['username']; ?>" /><b><?php echo $userdata['username']; ?></b></td>
</tr>
<?php
}
else
{
?>
<tr>
<td width="38%"><?php echo $lang['Username']; ?>:</td>
<td><input type="text" class="post" style="width:200px" name="username" size="25" maxlength="25" value="<?php echo $userdata['username']; ?>" /></td>
</tr>
<?php
}
?>
<tr>
<td><?php echo $lang['Email_address']; ?>:</td>
<td><input type="text" class="post" style="width:200px" name="email" size="25" maxlength="255" value="<?php echo $userdata['user_email']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['Current_password']; ?>:<br /><font size="2"><?php echo $lang['Confirm_password_explain']; ?></font></td>
<td><input type="password" style="width: 200px" name="cur_password" size="25" maxlength="32" value="" /></td>
</tr>
<tr>
<td><?php echo $lang['New_password']; ?>:<br /><font size="2"><?php echo $lang['password_if_changed']; ?></font></td>
<td><input type="password" style="width: 200px" name="new_password" size="25" maxlength="32" value="" /></td>
</tr>
<tr>
<td><?php echo $lang['Confirm_password']; ?>:<br /><font size="2"><?php echo $lang['password_confirm_if_changed']; ?></font></td>
<td><input type="password" style="width: 200px" name="password_confirm" size="25" maxlength="32" value="" /></td>
</tr>
<tr>
<th colspan="2" height="25" valign="middle"><?php echo $lang['Profile_info']; ?></th>
</tr>
<tr>
<td colspan="2"><font size="2"><?php echo $lang['Profile_info_warn']; ?></font></td>
</tr>
<tr>
<td><?php echo $lang['ICQ']; ?>:</td>
<td><input type="text" name="icq" class="post"style="width: 100px" size="10" maxlength="15" value="<?php echo $userdata['user_icq']; ?>" /></td>
</tr>
<tr>
<td><span class="gen"><?php echo $lang['AIM']; ?>:</td>
<td><input type="text" class="post"style="width: 150px" name="aim" size="20" maxlength="255" value="<?php echo $userdata['user_aim']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['MSNM']; ?>:</td>
<td><input type="text" class="post"style="width: 150px" name="msn" size="20" maxlength="255" value="<?php echo $userdata['user_msnm']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['YIM']; ?>:</td>
<td><input type="text" class="post"style="width: 150px" name="yim" size="20" maxlength="255" value="<?php echo $userdata['user_yim']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['Website']; ?>:</td>
<td><input type="text" class="post"style="width: 200px" name="website" size="25" maxlength="255" value="<?php echo $userdata['user_website']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['Location']; ?>:</td>
<td><input type="text" class="post"style="width: 200px" name="location" size="25" maxlength="100" value="<?php echo $userdata['user_from']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['Occupation']; ?>:</td>
<td><input type="text" class="post"style="width: 200px" name="occupation" size="25" maxlength="100" value="<?php echo $userdata['user_occ']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['Interests']; ?>:</td>
<td><input type="text" class="post"style="width: 200px" name="interests" size="35" maxlength="150" value="<?php echo $userdata['user_interests']; ?>" /></td>
</tr>
<?php
if ( $allow_sig == 1 )
{
?>
<tr>
<td><?php echo $lang['Signature']; ?>:</span><br /><font size="2"><?php echo $signature_explain; ?><br /><br /><?php echo $html_statut; ?><br /><?php echo $bbcode_statut; ?><br /><?php echo $smilies_statut; ?></font></td>
<td><textarea name="signature" style="width: 300px" rows="6" cols="30" class="post"><?php echo $userdata['user_sig']; ?></textarea></td>
</tr>
<?php
}
?>
<tr>
<td colspan="2" align="center" height="28"><input type="submit" name="submit" value="<?php echo $lang['Submit']; ?>" /> <input type="reset" value="<?php echo $lang['Reset']; ?>" name="reset" /></td>
</tr>
</table>
</form>
<?php
}
// L'utilisateur n'est pas connecté
}
else
{
echo 'Désolé, mais il faut être connecté pour accéder à cette page.';
}
?>
- Page de gestion des utilisateurs (admin_users.php)
Il vous faut modifier :- Code: Tout sélectionner
$phpbb_root_path = './phpBB2/';
$niveau_requis = ADMIN;
$pas_niveau = "index.$phpEx";
$phpbb_root_path doit avoir pour valeur le chemin d'accès à votre forum (le répertoire).
$niveau_requis doit avoir pour valeur le niveau que doit avoir un membre pour accéder à cette page.
$pas_niveau doit avoir pour valeur la page vers laquelle sera redirigé le membre s'il n'a pas le niveau requis.
Administrateur : ADMIN
Modérateur : MOD
Pour autoriser plusieurs niveaux, il suffit de modifier la ligne 67 de ce script.- Code: Tout sélectionner
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './phpBB2/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_SITE);
init_userprefs($userdata);
//
// End session management
//
// Niveau requis pour accéder à cette page
$niveau_requis = ADMIN;
// Page vers laquelle sera redirigé un membre qui n'a pas le bon niveau
$pas_niveau = "index.$phpEx";
// Niveau d'erreur par défaut
$erreur = false;
// Varaibles $_POST
$search_username = htmlspecialchars($_POST['search_username']);
$username = htmlspecialchars($_POST['username']);
$email = htmlspecialchars($_POST['email']);
$new_password = htmlspecialchars($_POST['new_password']);
$password_confirm = htmlspecialchars($_POST['password_confirm']);
$icq = htmlspecialchars($_POST['icq']);
$aim = htmlspecialchars($_POST['aim']);
$msn = htmlspecialchars($_POST['msn']);
$yim = htmlspecialchars($_POST['yim']);
$website = htmlspecialchars($_POST['website']);
$location = htmlspecialchars($_POST['location']);
$occupation = htmlspecialchars($_POST['occupation']);
$interests = htmlspecialchars($_POST['interests']);
$signature = htmlspecialchars($_POST['signature']);
// On crypte le nouveau mot de passe
$crypt_password_confirm = md5($password_confirm);
$sql = array();
$sql[1] = mysql_query("SELECT * FROM `" . $table_prefix . "users` WHERE `username`='" . $search_username . "'");
$sql[2] = "UPDATE `" . $table_prefix . "users` SET `username`='$username', `user_email`='$email', `user_icq`='$icq', `user_aim`='$aim', `user_msnm`='$msn', `user_yim`='$yim', `user_website`='$website', `user_from`='$location', `user_occ`='$occupation', `user_interests`='$interests', `user_sig`='$signature' WHERE `username`='$search_username'";
$sql[3] = "UPDATE `" . $table_prefix . "users` SET `user_password`='$crypt_password_confirm' WHERE `username`='$search_username'";
$resultat = mysql_num_rows($sql[1]);
$selection_membre = '<form method="post" action="admin_users.' . $phpEx . '">
<table cellspacing="1" cellpadding="4" border="0" align="center">
<tr>
<th align="center">' . $lang['Select_a_User'] . '</th>
</tr>
<tr>
<td align="center">
<input type="text" class="post" name="search_username" maxlength="50" size="20" />
<input type="submit" name="submituser" value="' . $lang['Look_up_user'] . '" />
</td>
</tr>
</table>
</form>';
if ( $userdata['user_level'] != $niveau_requis )
{
redirect($pas_niveau);
}
else
{
if ( !isset($_POST['submituser']) )
{
echo $selection_membre;
}
else
{
if ( $resultat != 1 )
{
echo $lang['No_such_user'];
}
else
{
if ( !isset($_POST['submit']) )
{
while ( $membre = mysql_fetch_array($sql[1]) )
{
?>
<form method="post" action="admin_users.php">
<table border="0" cellpadding="3" cellspacing="1" width="80%" align="center">
<tr>
<th colspan="2" height="25" valign="middle"><?php echo $lang['Registration_info']; ?></th>
</tr>
<tr>
<td width="38%"><?php echo $lang['Username']; ?>:</td>
<td><input type="text" class="post" style="width:200px" name="username" size="25" maxlength="25" value="<?php echo $membre['username']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['Email_address']; ?>:</td>
<td><input type="text" class="post" style="width:200px" name="email" size="25" maxlength="255" value="<?php echo $membre['user_email']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['New_password']; ?>:<br /><font size="2"><?php echo $lang['password_if_changed']; ?></font></td>
<td><input type="password" style="width: 200px" name="new_password" size="25" maxlength="32" value="" /></td>
</tr>
<tr>
<td><?php echo $lang['Confirm_password']; ?>:<br /><font size="2"><?php echo $lang['password_confirm_if_changed']; ?></font></td>
<td><input type="password" style="width: 200px" name="password_confirm" size="25" maxlength="32" value="" /></td>
</tr>
<tr>
<th colspan="2" height="25" valign="middle"><?php echo $lang['Profile_info']; ?></th>
</tr>
<tr>
<td colspan="2"><font size="2"><?php echo $lang['Profile_info_warn']; ?></font></td>
</tr>
<tr>
<td><?php echo $lang['ICQ']; ?>:</td>
<td><input type="text" name="icq" class="post"style="width: 100px" size="10" maxlength="15" value="<?php echo $membre['user_icq']; ?>" /></td>
</tr>
<tr>
<td><span class="gen"><?php echo $lang['AIM']; ?>:</td>
<td><input type="text" class="post"style="width: 150px" name="aim" size="20" maxlength="255" value="<?php echo $membre['user_aim']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['MSNM']; ?>:</td>
<td><input type="text" class="post"style="width: 150px" name="msn" size="20" maxlength="255" value="<?php echo $membre['user_msnm']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['YIM']; ?>:</td>
<td><input type="text" class="post"style="width: 150px" name="yim" size="20" maxlength="255" value="<?php echo $membre['user_yim']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['Website']; ?>:</td>
<td><input type="text" class="post"style="width: 200px" name="website" size="25" maxlength="255" value="<?php echo $membre['user_website']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['Location']; ?>:</td>
<td><input type="text" class="post"style="width: 200px" name="location" size="25" maxlength="100" value="<?php echo $membre['user_from']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['Occupation']; ?>:</td>
<td><input type="text" class="post"style="width: 200px" name="occupation" size="25" maxlength="100" value="<?php echo $membre['user_occ']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['Interests']; ?>:</td>
<td><input type="text" class="post"style="width: 200px" name="interests" size="35" maxlength="150" value="<?php echo $membre['user_interests']; ?>" /></td>
</tr>
<tr>
<td><?php echo $lang['Signature']; ?>:</span><br /><font size="2"><?php echo $signature_explain; ?><br /><br /><?php echo $html_statut; ?><br /><?php echo $bbcode_statut; ?><br /><?php echo $smilies_statut; ?></font></td>
<td><textarea name="signature" style="width: 300px" rows="6" cols="30" class="post"><?php echo $membre['user_sig']; ?></textarea></td>
</tr>
<tr>
<td colspan="2" align="center" height="28"><input type="hidden" name="submituser" value="" /><input type="hidden" name="search_username" value="<?php echo $search_username; ?>" maxlength="50" size="20" /><input type="submit" name="submit" value="<?php echo $lang['Submit']; ?>" /> <input type="reset" value="<?php echo $lang['Reset']; ?>" name="reset" /></td>
</tr>
</table>
</form>
<?php
} // Fin de la boucle
} // Le bouton de soumission 'submit' n'a pas été actionné
else
{
// Changement de mot de passe
if ( ( !empty($new_password) || !empty($password_confirm) ) && ( $new_password != $password_confirm ) )
{
$erreur = true;
echo $lang['Password_mismatch'];
}
else
{
mysql_query($sql[3]);
}
// On update le reste
if ( !mysql_query($sql[2]) )
{
$erreur = true;
echo $lang['Admin_user_fail'];
}
// Message d'information
if ( !$erreur )
{
echo $lang['Admin_user_updated'];
}
}
} // Il n'y a eu qu'un seul résultat à sql[1]
} // Le bouton de soumission 'submituser' a été actionné
} // Le niveau de l'utilisateur est supérieur à 1
?>
- Conserver la session sur vos autres pages
Pour utliser les sessions de votre forum sur une autre page que celles ci-dessus, il vous faut avoir ce code au début de toutes les pages où vous voulez concerver la session :- Code: Tout sélectionner
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './phpBB2/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_SITE);
init_userprefs($userdata);
//
// End session management
//
?>
Ou vous pouvez, tout simplement, inclure le script de login ci-dessus (login.php) à toutes vos pages ! - Bugs rencontrés
Ci-dessous se dressera la liste des bugs rencontrés lors de l'utilisation de ces scripts et les moyens de les corriger, s'il s'avère que ce qui provoque le bug a été découvert.- Code: Tout sélectionner
Warning: Cannot modify header information - headers already sent by (output started at ***) in /antoine/forum/includes/sessions.php on line 188
Warning: Cannot modify header information - headers already sent by (output started at ***) in /antoine/forum/includes/sessions.php on line 189
Cette erreur vient du fait qu'un des scripts ci-dessus a été inclus.
Pour corriger ce bug, il vous suffit de couper ce code des scripts inclus :- Code: Tout sélectionner
define('IN_PHPBB', true);
$phpbb_root_path = './phpBB2/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_SITE);
init_userprefs($userdata);
//
// End session management
//
Et de le coller tout en haut du fichier dans lequel est inclus le script.
/!\ La code à couper spécifié ci-dessus doit se trouve vraiment au tout début de vos fichiers juste après <?php et surtout avan tout envoie d'en-tête HTTP (avant tout code HTML) !- Code: Tout sélectionner
Warning: mysql_***(): Unable to jump to row 0 on MySQL result index 21
Supprimer l'utilisation des fonctions mysql_connect() et mysql_select_db() car la connexion à la Base De Données est déjà établie grâce à ces lignes qui sont destinées à aller chercher les informations du membre dans la table des membres du forum :- Code: Tout sélectionner
$userdata = session_pagestart($user_ip, PAGE_SITE);
init_userprefs($userdata);
Voilà, au fur et à mesure du temps, je rendrais ces fichiers plus performants
Je suis disposé à répondre à vos questions à la suite de ce topic



