Bonjour
j'ai unSouci pour afficher mon script correctement, J’ai pu corriger certaines choses du script, mais j’ai toujours des messages d’erreur tout en haut du style :
Ces erreurs correspondent aux lignes suivantes:
Je vous remercie d’avance pour votre aide, car j’ai énormément besoin de ce script
Modifié par Nathan971 (24 Mar 2009 - 04:17)
j'ai unSouci pour afficher mon script correctement, J’ai pu corriger certaines choses du script, mais j’ai toujours des messages d’erreur tout en haut du style :
Notice: Undefined index: LSG in C:\wamp\www\bible_php\bible.php on line 26
Notice: Undefined index: darby in C:\wamp\www\bible_php\bible.php on line 27
Notice: Undefined index: martin in C:\wamp\www\bible_php\bible.php on line 28
Notice: Undefined index: ostervald in C:\wamp\www\bible_php\bible.php on line 29
Notice: Undefined index: change_vst in C:\wamp\www\bible_php\bible.php on line 30
Notice: Undefined index: cookie_ok in C:\wamp\www\bible_php\bible.php on line 31
Notice: Undefined index: change_vst in C:\wamp\www\bible_php\bible.php on line 32
Notice: Undefined index: promesse in C:\wamp\www\bible_php\bible.php on line 33
Notice: Undefined index: livre in C:\wamp\www\bible_php\bible.php on line 34
Notice: Undefined index: chapitre in C:\wamp\www\bible_php\bible.php on line 35
Notice: Undefined index: verset in C:\wamp\www\bible_php\bible.php on line 36
Notice: Undefined index: q in C:\wamp\www\bible_php\bible.php on line 37
Notice: Undefined index: start in C:\wamp\www\bible_php\bible.php on line 38
Notice: Undefined index: action in C:\wamp\www\bible_php\bible.php on line 41
Notice: Undefined index: promesse in C:\wamp\www\bible_php\bible.php on line 43
Notice: Undefined variable: larequete in C:\wamp\www\bible_php\bible.php on line 52
Notice: Undefined variable: larequete in C:\wamp\www\bible_php\bible.php on line 54
Notice: Trying to get property of non-object in C:\wamp\www\bible_php\bible.php on line 68
Ces erreurs correspondent aux lignes suivantes:
<?php
// variables technique
$racine = "./";
// includes
include ("config.inc.php");
include ("includes/tradfrancais.inc.php");
include ("includes/barre_navig.inc.php");
include ("includes/gen_listechap.inc.php");
include ("includes/gen_listeverses.inc.php");
include ("includes/gen_listelivres.inc.php");
/* I. LES VARIABLES ******************************************/
$nb_paagesaff = 3;
$nb_versets = 30;
$nb_resultpp = 20;
$file_accueil = "livres.php"; // page d'accueil
$LSG = $_REQUEST["LSG"];
$darby = $_REQUEST["darby"];
$martin = $_REQUEST["martin"];
$ostervald = $_REQUEST["ostervald"];
$change_vst = $_REQUEST["change_vst"];
$cookie_ok = $_REQUEST["cookie_ok"];
$change_vst = $_REQUEST["change_vst"];
$promesse = $_REQUEST["promesse"];
$livre = $_REQUEST["livre"];
$chapitre = $_REQUEST["chapitre"];
$verset = $_REQUEST["verset"];
$q = $_REQUEST["q"];
$start = $_REQUEST["start"];
// attribution de valeurs par défaut
if (empty($action) || ($action == "recherche" && $q < 2)) $action = $_REQUEST["action"];
if (empty($action)) $action = "accueil";
if (empty($promesse) && $change_vst != 1) $promesse = $_REQUEST["promesse"];
if (empty($LSG) && empty($darby) && empty($martin) && empty($ostervald)) $LSG = 1;
// construction de la requete
if (!empty($promesse)) $larequete = "&promesse=" . $promesse;
if (!empty($livre)) $larequete .= "&livre=" . $livre;
if (!empty($chapitre)) $larequete .= "&chapitre=" . $chapitre;
if (!empty($q)) $larequete .= "&q=" . urlencode($q);
$larequete2 = $larequete . "&action=" . $action; ;
if (!empty($LSG)) $larequete .= "&LSG=" . $LSG;
if (!empty($darby)) $larequete .= "&darby=" . $darby;
if (!empty($martin)) $larequete .= "&martin=" . $martin;
if (!empty($ostervald)) $larequete .= "&ostervald=" . $ostervald;
// titre de la version
if ($LSG == 1) $title = " Louis Segond";
elseif ($darby == 1) $title = " Darby";
elseif ($martin == 1) $title = " Martin";
elseif ($ostervald == 1) $title = " Ostervald";
// nom du livre
$sql_titrelivre = mysql_db_query ($dbname2, "SELECT livre FROM ref_bible WHERE id='" . $livre . "'", $connex_bible);
$titre_livre = mysql_fetch_object ($sql_titrelivre);
$nom_livre = $titre_livre->livre;
// mise en norme des variables
if (empty($chapitre) && $action == "texte") $chapitre = 1;
$q = str_replace('+', ' ', trim(stripslashes($q)));
$q = str_replace(',', ' ', $q);
$q = str_replace(':', ' ', $q);
$q = str_replace('-', ' ', $q);
$q = str_replace('\'', '`', $q);
$tab_mc = explode(' ' , $q);
/* III. AFFICHAGE DE L'ACCUEIL *******************************/
if ($action == "accueil" || empty($action)) include ($file_accueil);
/* IV. RECHERCHE PAR MOT-CLE *********************************/
elseif ($action == "recherche" && strlen($q) > 2 ) {
if ($LSG == 1) $traduction = "LSG";
elseif ($darby == 1) $traduction = "darby";
elseif ($martin == 1) $traduction = "martin";
elseif ($ostervald == 1) $traduction = "ostervald";
// requete principale de recherche
$req_search = "SELECT id, ch, vst, $traduction FROM versets WHERE ";
// recherche dans tous les mots clés
$nb_mc = count ($tab_mc);
if ($nb_mc != 0) {
$req_search .= " (";
for ($i = 0; $i != $nb_mc; $i++) {
if (strlen($tab_mc[$i]) > 2) {
if ($promesse == 1) $LIAISON = " OR ";
else $LIAISON = " AND ";
$req_search .= " (" . $traduction . " LIKE '%" . trim(addslashes($tab_mc[$i])) . "%' OR
" . $traduction . " LIKE '%" . trim(addslashes(francais3($tab_mc[$i]))) . "%')";
$req_search .= $LIAISON;
}
}
$req_search = substr ($req_search, 0, -4);
$req_search .= ") ";
}
// si on cherche dans un livre
if (!empty($livre) && $livre != "O" && $livre != "N") $req_search .= " AND id='" . $livre . "'";
// si on cherche dans un chapitre
if (!empty($chapitre) && !empty($livre)) $req_search .= " AND ch='" . $chapitre . "'";
// si on cherche dans un verset
if (!empty($verset) && !empty($livre) && !empty($chapitre)) $req_search .= " AND vst='" . $verset . "'";
// si on cherche dans le Nouveau Testament
if ($livre == "O") $req_search .= " AND id like '%O'";
// si on cherche dans l'Ancien Testament
if ($livre == "N") $req_search .= " AND id like '%N'";
// si on recherche uniquement dans les promesse
if ($promesse == 1) $req_search .= " AND is_promesse='1'";
$sql_search2 = mysql_db_query ($dbname2, str_replace ("id, ch, vst, $traduction", "id", $req_search), $connex_bible);
$nb_results = mysql_num_rows ($sql_search2);
$lapage = $start * $nb_resultpp;
$req_search .= " LIMIT ". $lapage . ", " . $nb_resultpp;
$sql_search = mysql_db_query ($dbname2, $req_search, $connex_bible);
/* Résumé de la recherche **************************************/
echo "<h2>Recherche dans la bible $title</h2>\n";
echo "<div class=\"menu_versets\"><strong>$nb_results</strong> résultats trouvés";
if (!empty($q)) echo " pour <h4>$q</h4> ";
if ($livre == "N") echo " dans le <h4>Nouveau Testament</h4>";
elseif ($livre == "O") echo "dans l'<h4>Ancien Testament</h4>";
elseif (!empty($livre)) {
echo " dans <h4>$nom_livre";
if (!empty($chapitre)) echo " $chapitre";
echo "</h4>\n";
}
else echo " dans <h4>Toute la Bible</h4><br />\n";
echo "</div>";
if ($nb_results != 0 ) {
// barre de navigation
$barre_nav = barrenavig();
$leverset .= $barre_nav;
while ($line = mysql_fetch_object ($sql_search)) {
// selection du titre du livre
$sql_titrelivre = mysql_db_query ($dbname2, "SELECT livre FROM ref_bible WHERE id='" . $line->id . "'", $connex_bible);
$titre_livre = mysql_fetch_object ($sql_titrelivre);
$nom_livre = $titre_livre->livre;
// lignes de résultat
echo "<div id=\"verset\"><div class=\"reference\"><a href=\"?action=texte&livre=" . $line->id . "&chapitre=" . $line->ch . "#" . $line->vst . "\"
class=\"reference\">" . $nom_livre . " " . $line->ch . " : " . $line->vst . "</a></div>\n";
if ($LSG == 1) $verset_enforme = $line->LSG;
elseif ($darby == 1) $verset_enforme = $line->darby;
elseif ($martin == 1) $verset_enforme = $line->martin;
elseif ($ostervald == 1) $verset_enforme = $line->ostervald;
foreach ($tab_mc as $mot) {
if (strlen($mot) > 2) {
$verset_enforme = eregi_replace ($mot, "<span class=\"mc\">$mot</span>", $verset_enforme);
$verset_enforme = eregi_replace (francais2($mot), "<span class=\"mc\">" . francais2($mot) . "</span>", $verset_enforme);
}
}
$verset_enforme = eregi_replace ($q, "<span class=\"mc\">$q</span>", $verset_enforme);
echo str_replace('`', '\'', $verset_enforme) . "</div>\n";
}
echo $barre_nav ;
} // END IF
else { // si pas de résultat à la recherche
echo "<div id=\"message\">Aucun verset ne correspond à votre requète : </div>";
if (!empty($livre)) echo "<a href=\"?action=recherche&livre=&mc=" . urlencode($q) . "\" >Effectuer une recherche dans toute la Bible</a>";
}
} // END ELSEIF Recherche
elseif ($action == "recherche" && strlen($q) < 2 && empty($livre)) echo "<div id=\"message\">Erreur : Le mots clé doit comporter au moins 2 caractères</div>";
else $action = "texte";
if ($action == "texte" && !empty($livre) && $livre != "N" && $livre != "O") {
if (empty($chapitre) || $chapitre < 1) $chapitre = 1;
if ($LSG == 1) $col = "LSG";
elseif ($darby == 1) $col = "darby";
elseif ($martin == 1) $col = "martin";
elseif ($ostervald == 1) $col = "ostervald";
// requete générale
$req_afficher = "SELECT $col, ch, vst FROM versets WHERE id='" . $livre . "' AND ch='" . $chapitre . "'";
$sql_afficher2 = mysql_db_query ($dbname2, $req_afficher, $connex_bible);
$nb_versets = mysql_num_rows ($sql_afficher2);
if (!empty($verset)) $req_afficher .= " AND vst='" . $verset . "'";
$sql_afficher = mysql_db_query ($dbname2, $req_afficher, $connex_bible);
// lecteur flash
if (substr($livre, -1) == "N") $dossier = "NT";
elseif (substr($livre, -1) == "O") $dossier = "AT";
if ($chapitre < 10) $lechapitre = "0" . $chapitre;
else $lechapitre = $chapitre;
$mp3 = "http://www.monsite.net/audio/bible/$dossier/" . $livre . "_" . $lechapitre . ".mp3";
$bouton_ecouter = '<p><table border="0" cellpadding="2" cellspacing="0">
<tr>
<td><strong>ECOUTER (LSG)</strong></td>
<td>
<object type="application/x-shockwave-flash" data="' .$racine . 'dewplayer.swf?son=' . $mp3 .'" width="200" height="20">
<param name="movie" value="' .$racine . 'dewplayer.swf?son=' . $mp3 .'" />
</object>
</td>
<td><a href="'. $mp3 .'" rel=enclosure title="Flux du fichier"><img src="' .$racine . 'images/podcast.png" border="0"/></a></td>
</tr>
</table></p>';
// fin bouton
echo "<h2>" . $nom_livre . " " . $chapitre . " (" . trim($title) . ") </h2>\n";
/* Barre de navigation **************************************/
$barre_nav = "<div class=\"menu_versets\">\n";
$barre_nav .= "<strong>versets</strong> :\n";
for ($i = 1; $i != $nb_versets + 1; $i++) {
if ($action != "recherche") $barre_nav .= " <a class=\"black\" href=\"#$i\">$i</a>";
else $barre_nav .= " <a class=\"black\" href=\"?action=texte&livre=$livre&chapitre=5#$i\">$i</a>";
}
echo $barre_nav .= "</div>\n";
/* Fin barre *************************************************/
// ecouter
echo "<p>" . $bouton_ecouter . "</p>";
while ($line = mysql_fetch_object ($sql_afficher)) {
echo "<div id=\"verset\">\n";
echo "<a name=\"" . $line->vst . "\"></a>\n\n<div class=\"reference\">" . $line->ch . " : " . $line->vst . "</div>";
if ($LSG == 1) {
$verset_enforme = $line->LSG;
if (!empty($q)) $verset_enforme = ereg_replace ($q, "<div class=\"mc\">$q</div>", $verset_enforme);
}
elseif ($darby == 1) {
$verset_enforme = $line->darby;
if (!empty($q)) $verset_enforme = ereg_replace ($q, "<div class=\"mc\">$q</div>", $verset_enforme);
}
elseif ($martin == 1) {
$verset_enforme = $line->martin;
if (!empty($q)) $verset_enforme = ereg_replace ($q, "<div class=\"mc\">$q</div>", $verset_enforme);
}
elseif ($ostervald == 1) {
$verset_enforme = $line->ostervald;
if (!empty($q)) $verset_enforme = ereg_replace ($q, "<div class=\"mc\">$q</div>", $verset_enforme);
}
echo str_replace('`', '\'', $verset_enforme);
echo "</div>";
}
if (empty($verset) && $i >= 10) echo $barre_nav;
}
mysql_close ($connex_bible);
?>
Je vous remercie d’avance pour votre aide, car j’ai énormément besoin de ce script
Modifié par Nathan971 (24 Mar 2009 - 04:17)