Appel de variable defaillant

Résolu/Fermé
thiryn Messages postés 15 Date d'inscription lundi 30 janvier 2012 Statut Membre Dernière intervention 7 février 2012 - 30 janv. 2012 à 00:45
thiryn Messages postés 15 Date d'inscription lundi 30 janvier 2012 Statut Membre Dernière intervention 7 février 2012 - 7 févr. 2012 à 14:27
Bonsoir,
je créé un site en php sous une base en opensource (Nuked Klan)
et je me confronte à un problème... tout bête, j'ai la valeur d'une variable que je n'arrives pas à afficher...
Je voudrais afficher le contenus de la variable auteur en fonction de autor_id

Voici le moment où ça pêche, ligne 157:
[spoiler]
 function classe($sid, $nb_subcat)
    {
        global $nuked, $theme, $bgcolor1, $bgcolor2, $bgcolor3;
		$sql12 = mysql_query("SELECT autor, autor_id FROM " . SECTIONS_TABLE . "  WHERE artid = '" . $artid . "'");
		list($autor, $autor_id) = mysql_fetch_row($sql);
        if ($_REQUEST['op'] == "classe")
        {

            echo "<br /><div style=\"text-align: center;\"><big><b>" . _SECTIONS . "</b></big></div>\n"
            . "<div style=\"text-align: center;\"><br />\n"
            . "[ <a href=\"index.php?file=Sections\" style=\"text-decoration: underline\">" . _INDEXSECTIONS . "</a> | ";

            if ($_REQUEST['orderby'] == "news")
            {
                echo _NEWSART . " | ";
            } 
            else
            {
                echo "<a href=\"index.php?file=Sections&amp;op=classe&amp;orderby=news\" style=\"text-decoration: underline\">" . _NEWSART . "</a> | ";
            } 

            if ($_REQUEST['orderby'] == "count")
            {
                echo _TOPART . " | ";
            } 
            else
            {
                echo "<a href=\"index.php?file=Sections&amp;op=classe&amp;orderby=count\" style=\"text-decoration: underline\">" . _TOPART . "</a> | ";
            } 

            echo "<a href=\"index.php?file=Suggest&amp;module=Sections\" style=\"text-decoration: underline\">" . _SUGGESTART . "</a> ]</div><br />\n";
        } 

        $nb_max = $nuked['max_sections'];
        if (!$_REQUEST['p']) $_REQUEST['p'] = 1;
        $start = $_REQUEST['p'] * $nb_max - $nb_max;

        if ($sid != "") $where = "WHERE S.secid = '" . $sid . "'";
	else $where = "";

        if ($_REQUEST['orderby'] == "name")
        {
            $order = "ORDER BY S.title";
        } 

        else if ($_REQUEST['orderby'] == "count")
        {
            $order = "ORDER BY S.counter DESC";
        } 

        else if ($_REQUEST['orderby'] == "note")
        {
            $order = "ORDER BY note DESC";
        } 

        else
        {
            $_REQUEST['orderby'] = "news";
            $order = "ORDER BY S.artid DESC";
        } 

        $sql = mysql_query("SELECT S.artid, S.title, S.date, S.counter, S.content, AVG(V.vote) AS note  FROM " . SECTIONS_TABLE . " AS S LEFT JOIN " . VOTE_TABLE . " AS V ON S.artid = V.vid AND V.module = 'Sections' " . $where . " GROUP BY S.artid " . $order);
        
		$nb_art = mysql_num_rows($sql);

        if ($nb_art > 1 && $sid != "")
        {
            echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\">\n"
            . "<tr><td align=\"right\"><small>" . _ORDERBY . " : ";

            if ($_REQUEST['orderby'] == "news") echo "<b>" . _DATE . "</b> | ";
            else echo "<a href=\"index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;orderby=news&amp;secid=" . $sid . "\">" . _DATE . "</a> | ";

            if ($_REQUEST['orderby'] == "count") echo "<b>" . _TOPFILE . "</b> | ";
            else echo "<a href=\"index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;orderby=count&amp;secid=" . $sid . "\">" . _TOPFILE . "</a> | ";

            if ($_REQUEST['orderby'] == "name") echo "<b>" . _NAME . "</b> | ";
            else echo"	<a href=\"index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;orderby=name&amp;secid=" . $sid . "\">" . _NAME . "</a> | ";

           if ($_REQUEST['orderby'] == "note") echo"<b>" . _NOTE . "</b>";
            else echo"	<a href=\"index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;orderby=note&amp;secid=" . $sid . "\">" . _NOTE . "</a>";

            echo "</small></td></tr></table>\n";
        } 

        if ($nb_art > 0)
        {
            if ($nb_art > $nb_max)
            {
                echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\"><tr><td>";
                $url = "index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;secid=" . $sid . "&amp;orderby=" . $_REQUEST['orderby'];
                number($nb_art, $nb_max, $url);
                echo "</td></tr></table>\n";
            } 

            echo "<br />";

            $sqlhot = mysql_query("SELECT artid FROM " . SECTIONS_TABLE . " ORDER BY counter DESC LIMIT 0, 10");

            $seek = mysql_data_seek($sql, $start);
            for($i = 0;$i < $nb_max;$i++)
            {
                if (list($artid, $title, $date, $counter, $content) = mysql_fetch_row($sql))
                {
                  /* 	?><h3 class="title"><?php echo $title = htmlentities($title); ?></h3> <?php*/
                    $newsdate = time() - 604800;
                    $att = "";

                    if ($date != "" && $date > $newsdate) $att = "&nbsp;&nbsp;" . _NEW;

                    if ($content != "")
                    {
                        $content = str_replace("\r", "", $content);
                        $content = str_replace("\n", " ", $content);
                        $texte = strip_tags($content);
                        $texte = str_replace("(--pagebreak--)", "", $texte);

                        if (strlen($texte) > 150)
                        {
                            $texte = substr($texte, 0, 150) . "...";
							$texte = htmlentities($texte);
                        } 
                    } 
                    else
                    {
                        $texte = "";
                    } 

                    mysql_data_seek($sqlhot, 0);
                    while (list($id_hot) = mysql_fetch_array($sqlhot))
                    {
                        if ($artid == $id_hot && $nb_art > 1 && $counter > 9) $att .= "&nbsp;&nbsp;" . _HOT;
                    } 

                    if ($date != "") $alt = "title=\"" . _ADDTHE . "&nbsp;" . strftime("%x %H:%M", $date) . "\"";
                    else $alt = "";

                    if (is_file("themes/" . $theme . "/images/articles.gif"))
                    {
                        $img = "<img src=\"themes/" . $theme . "/images/articles.gif\" alt=\"\" " . $alt . "/>";
                    } 
                    else
                    {
                        $img = "<img src=\"modules/Sections/images/articles.gif\" alt=\"\" " . $alt . "/>";
                    } 
			$sql5 = mysql_query("SELECT pseudo FROM " . USER_TABLE . " WHERE id = '" . $autor_id . "'");
            $test = mysql_num_rows($sql5);
            list($auteur) = mysql_fetch_array($sql5);
            $auteur = "<a href=\"index.php?file=Members&amp;op=detail&amp;autor=" . urlencode($auteur) . "\">" . $auteur . "</a>";
            $auteur = $autor;
			
                    echo "<table style=\"background: " . $bgcolor3 . ";margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\" cellspacing=\"1\" cellpadding=\"0\">\n"
                    . "<tr><td><table style=\"background: " . $bgcolor2 . ";\" width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">\n"
                    . "<tr><td style=\"width: 100%;\">" .  $img . " <a href=\"index.php?file=Sections&amp;op=article&amp;artid=" . $artid . "\" <h4 class=\"title1\">" . $title . "</h4></a>" . $att . "</td>\n"
					. "<td><a href=\"#\" onclick=\"javascript:window.open('index.php?file=Sections&amp;nuked_nude=index&amp;op=pdf&amp;artid=" . $artid . "','projet','toolbar=yes,location=no,directories=no,scrollbars=yes,resizable=yes')\">"
					. "<img style=\"border: 0;\"  alt=\"\" title=\"" . _PDF . "\" /></a></td></tr>\n"
					. "<h4 class=\"title1\"><b>" . _AUTHOR . " :</b> " . $auteur . "</h4>\n";

                    if ($texte != "")
                    {
                        echo "<tr><td colspan=\"2\">" . $texte . "</td></tr>\n";
                    } 
					
					echo"<tr><td><div class=\"suite\"> <a href=\"index.php?file=Sections&amp;op=article&amp;artid=" . $artid . "\" <div class=\"title3\">" . _SUITE . "</div></a></div>";
                    //echo "<tr style=\"background: " . $bgcolor1 . ";\"><td colspan=\"2\">&nbsp;<b>" . _READSART . " :</b> " . $counter . "&nbsp;";

                    //vote_index("Sections", $artid);

                    echo "</td></tr></table></td></tr></table><br /><br \>\n";
                } 
            } 

            if ($nb_art > $nb_max)
            {
                echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\"><tr><td>";
                $url = "index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;secid=" . $sid . "&amp;orderby=" . $_REQUEST['orderby'];
                number($nb_art, $nb_max, $url);
                echo "</td></tr></table>\n";
            } 

        } 
        else
        {
            if ($nb_subcat == 0 && $sid > 0) echo "<div style=\"text-align: center;\"><br />" . _NOARTS . "</div><br /><br />\n";
            if ($_REQUEST['op'] == "classe") echo "<div style=\"text-align: center;\"><br />" . _NOARTINDB . "</div><br /><br />\n";
        } 
    } 


Voilà mon code en entier, aux environs des lignes 550
<?php 
// -------------------------------------------------------------------------//
// Nuked-KlaN - PHP Portal                                                  //
// https://nuked-klan.org/                                                //
// -------------------------------------------------------------------------//
// This program is free software. you can redistribute it and/or modify     //
// it under the terms of the GNU General Public License as published by     //
// the Free Software Foundation; either version 2 of the License.           //
// -------------------------------------------------------------------------//
if (!defined("INDEX_CHECK"))
{
    die ("<div style=\"text-align: center;\">You cannot open this page directly</div>");
} 

global $user, $nuked, $language;
translate("modules/Sections/lang/" . $language . ".lang.php");
?>

<!DOCTYPE html>

<html lang="fr">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=9" />
    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
    <meta name="author" content="Design and code by LoveForEver" />

    <title><?php echo $nuked['name'] . ' - ' . $nuked['slogan']; ?></title>

    <meta name="description" content="<?php echo $nuked['description']; ?>" />
    <meta name="keywords" content="<?php echo $nuked['keyword']; ?>" />
    <meta name="robots" content="index, follow" />

	<link rel="stylesheet" media="screen" type="text/css" title="style" href="style.css" />

</head>
<?php
if (!$user)
{
    $visiteur = 0;
} 
else
{
    $visiteur = $user[1];
} 
$ModName = basename(dirname(__FILE__));
$level_access = nivo_mod($ModName);
if ($visiteur >= $level_access && $level_access > -1)
{
 //   include ("modules/Vote/index.php");
   compteur("Sections");

    function index()
    {
        global $nuked;

        opentable();

        echo "<br /><div style=\"text-align: center;\"><big><b>" . _SECTIONS . "</b></big></div>\n"
	. "<div style=\"text-align: center;\"><br />\n"
	. "[ " . _INDEXSECTIONS . " | "
	. "<a href=\"index.php?file=Sections&amp;op=classe&amp;orderby=news\" style=\"text-decoration: underline\">" . _NEWSART . "</a> | "
	. "<a href=\"index.php?file=Sections&amp;op=classe&amp;orderby=count\" style=\"text-decoration: underline\">" . _TOPART . "</a> | "
	. "<a href=\"index.php?file=Suggest&amp;module=Sections\" style=\"text-decoration: underline\">" . _SUGGESTART . "</a> ]</div>\n";

        $sql = mysql_query("SELECT artid FROM " . SECTIONS_TABLE);
        $nb_arts = mysql_num_rows($sql);

        $sql_nbcat = mysql_query("SELECT secid FROM " . SECTIONS_CAT_TABLE);
        $nb_cat = mysql_num_rows($sql_nbcat);

        if ($nb_cat > 0)
        {
            echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" cellspacing=\"15\" cellpadding=\"5\">\n";

            $sql_cat = mysql_query("SELECT secid, secname, description FROM " . SECTIONS_CAT_TABLE . "  WHERE parentid = 0 ORDER BY position, secname");
            $test = 0;
            while (list($secid, $secname, $description) = mysql_fetch_array($sql_cat))
            {
                $secname = htmlentities($secname);

                if ($secid != $last_cid)
                {
                    $test++;
                    if ($test == 1)
                    {
                        echo "<tr>";
                    } 

                    echo "<td valign=\"top\"><img src=\"modules/Sections/images/fleche.gif\" alt=\"\" /><a href=\"index.php?file=Sections&amp;op=categorie&amp;secid=" . $secid . "\"><b>" . $secname . "</b></a>";

                    $sql2 = mysql_query("SELECT secid FROM " . SECTIONS_TABLE . "  WHERE secid = '" . $secid . "'");
                    $nb_art = mysql_num_rows($sql2);

                    if ($nb_art > 0)
                    {
                        echo "<small>&nbsp;(" . $nb_art . ")</small>\n";
                    } 

                    if ($description != "")
                    {
                        echo "<div style=\"width: 225px;\">" . $description . "</div>\n";
                    } 
                    else
                    {
                        echo "<br />";
                    }
			
                    $sql_subcat = mysql_query("SELECT secid, secname FROM " . SECTIONS_CAT_TABLE . "  WHERE parentid = '" . $secid . "' ORDER BY position, secname LIMIT 0, 4");
                    $nb_subcat = mysql_num_rows($sql_subcat);

                    if ($nb_subcat > 0)
                    {
                        $t = 0;
                        while (list($sub_cat_id, $sub_cat_titre) = mysql_fetch_array($sql_subcat))
                        {
                            $sub_cat_titre = htmlentities($sub_cat_titre);
                            $t++;
                            if ($t <= 3) echo "<small><a href=\"index.php?file=Sections&amp;op=categorie&amp;secid=" . $sub_cat_id . "\">" . $sub_cat_titre . "</a></small>&nbsp;&nbsp;";
                            else echo "<small><a href=\"index.php?file=Sections&amp;op=categorie&amp;secid=" . $secid . "\">...</a></small>";
                        } 
                    } 

                    echo "</td>\n";

                    if ($test == 2)
                    {
                        $test = 0;
                        echo "</tr>\n";
                    } 
                    $last_secid = $secid;
                } 
            } 

            if ($test == 1) echo "</tr>\n";
            echo "</table>\n";
        } 
        else
	{
            echo "<br />\n";
	}

        classe("0", "0");

        if ($nb_cat > 0 || $nb_arts > 0) echo "<div style=\"text-align: center;\"><br /><small><i>( " . _THEREIS . "&nbsp;" . $nb_arts . "&nbsp;" . _ARTDB . " &amp; " . $nb_cat . "&nbsp;" . _SECDB . "&nbsp;" . _INDATABASE . " )</i></small></div><br />\n";
        else echo "<div style=\"text-align: center;\"><br />" . _NOARTINDB . "</div><br /><br />\n";

        closetable();
    } 

    function categorie($secid)
    {
        global $nuked;

        opentable();

        $sql = mysql_query("SELECT secname, description, parentid FROM " . SECTIONS_CAT_TABLE . " WHERE secid = '" . $secid . "'");
		if(mysql_num_rows($sql) <= 0)
		{
			redirect("index.php?file=404", 0);
			exit();
		}
        list($secname, $description, $parentid) = mysql_fetch_row($sql);

        $secname = htmlentities($secname);

        $sql2 = mysql_query("SELECT * FROM " . SECTIONS_TABLE . " WHERE secid = '" . $secid . "'");
        $nb_art = mysql_num_rows($sql2);

        if ($parentid > 0)
        {
            $sql_parent = mysql_query("SELECT secname FROM " . SECTIONS_CAT_TABLE . " WHERE secid = '" . $parentid . "'");
            list($parent_titre) = mysql_fetch_array($sql_parent);
            $parent_titre = htmlentities($parent_titre);

            echo "<br /><div style=\"text-align: center;\"><a href=\"index.php?file=Sections\" style=\"text-decoration:none\"><big><b>" . _SECTIONS . "</b></big></b></a> > <a href=\"index.php?file=Sections&amp;op=categorie&amp;secid=" . $parentid . "\" style=\"text-decoration:none\"><big><b>" . $parent_titre . "</b></big></a> > <big><b>" . $secname . "</b></big></div><br />\n";
        } 
        else
        {
            echo "<br /><div style=\"text-align: center;\"><a href=\"index.php?file=Sections\" style=\"text-decoration:none\"><big><b>" . _SECTIONS . "</b></big></a> > <big><b>" . $secname . "</b></big></div><br />\n";
        } 

        $sql_subcat = mysql_query("SELECT secid, secname, description FROM " . SECTIONS_CAT_TABLE . "  WHERE parentid = '" . $secid . "' ORDER BY position, secname");
        $nb_subcat = mysql_num_rows($sql_subcat);
        $count = 0;

    if ($nb_subcat > 0)
    {
        echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" cellspacing=\"15\" cellpadding=\"5\">\n";

        while (list($catid, $parentcat, $parentdesc) = mysql_fetch_array($sql_subcat))
        {

            $parentcat = htmlentities($parentcat);

            $sql_nbcat = mysql_query("SELECT secid FROM " . SECTIONS_TABLE . " WHERE secid = '" . $catid . "'");
            $nb_artcat = mysql_num_rows($sql_nbcat);

            if ($catid != $last_catid)
            {
                $count++;
                if ($count == 1)
                {
                    echo "<tr>";
                } 

                echo "<td style=\"width: 225px;\" valign=\"top\"><img src=\"modules/Sections/images/fleche.gif\" alt=\"\" /><a href=\"index.php?file=Sections&amp;op=categorie&amp;secid=" . $catid . "\"><b>" . $parentcat . "</b></a> <small>(" . $nb_artcat . ")</small><br />" . $parentdesc . "</td>";

                if ($count == 2)
                {
                    $count = 0;
                    echo "</tr>\n";
                } 
                $last_catid = $catid;
            } 
        } 

        if ($count == 1) echo "</tr>\n";
        echo "</table>\n";

    }
    else
    {
	echo "<div style=\"text-align: center;\">" . $description . "</div><br />\n";
    } 

        classe($secid, $nb_subcat);

	echo "<br />\n";

        closetable();
    } 

    function article($artid)
    {
        global $nuked, $user, $visiteur, $bgcolor3, $bgcolor2, $bgcolor1;

        opentable();

        if (($_REQUEST['p'] == 1) OR ($_REQUEST['p'] == ""))
        {
            $upd = mysql_query("UPDATE " . SECTIONS_TABLE . "  SET counter = counter + 1 WHERE artid = '" . $artid . "'");
        } 

        $sql = mysql_query("SELECT artid, secid, title, content, autor, autor_id, counter, date FROM " . SECTIONS_TABLE . "  WHERE artid = '" . $artid . "'");
        if(mysql_num_rows($sql) <= 0)
		{
			redirect("index.php?file=404", 0);
			exit();
		}
		list($artid, $secid, $title, $content, $autor, $autor_id, $counter, $date) = mysql_fetch_row($sql);

        $sql2 = mysql_query("SELECT secname, parentid FROM " . SECTIONS_CAT_TABLE . "  WHERE secid = '" . $secid . "'");
        list($secname, $parentid) = mysql_fetch_row($sql2);
        $secname = htmlentities($secname);

        if ($secid == 0)
        {
            $category = _NONE;
        } 
        else if ($parentid > 0)
        {
            $sql3 = mysql_query("SELECT secname FROM " . SECTIONS_CAT_TABLE . " WHERE secid = '" . $parentid . "'");
            list($parent_name) = mysql_fetch_array($sql3);
            $parent_name = htmlentities($parent_name);

            $category = "<a href=\"index.php?file=Sections&amp;op=categorie&amp;secid=" . $parentid . "\">" . $parent_name . "</a> -> <a href=\"index.php?file=Sections&amp;op=categorie&amp;secid=" . $secid . "\">" . $secname . "</a>";
        } 
        else
        {
            $category = "<a href=\"index.php?file=Sections&amp;op=categorie&amp;secid=" . $secid . "\">" . $secname . "</a>";
        } 

        $title = htmlentities($title);
        $autor = htmlentities($autor);

        $words = sizeof(explode(" ", $content));

        

        if ($autor_id != "")
        {
            $sql4 = mysql_query("SELECT pseudo FROM " . USER_TABLE . " WHERE id = '" . $autor_id . "'");
            $test = mysql_num_rows($sql4);
        }

        if ($autor_id != "" && $test > 0)
        {
            list($auteur) = mysql_fetch_array($sql4);
            $auteur = "<a href=\"index.php?file=Members&amp;op=detail&amp;autor=" . urlencode($auteur) . "\">" . $auteur . "</a>";
        } 
        else
        {
            $auteur = $autor;
        }

        $contentpages = explode("(--pagebreak--)", $content);
        $pageno = count($contentpages);
        if ($_REQUEST['p'] == "" || $_REQUEST['p'] < 1) $_REQUEST['p'] = 1;
        if ($_REQUEST['p'] > $pageno) $_REQUEST['p'] = $pageno;
        $arrayelement = (int)$_REQUEST['p'];
        $arrayelement --;

        if ($date != "") $date = strftime("%x %H:%M", $date);

        if ($visiteur >= admin_mod("Sections"))
        {
            echo"<script type=\"text/javascript\">\n"
            ."<!--\n"
            ."\n"
            . "function delart(titre, id)\n"
            . "{\n"
            . "if (confirm('" . _DELETEART . " '+titre+' ! " . _CONFIRM . "'))\n"
            . "{document.location.href = 'index.php?file=Sections&page=admin&op=del&art_id='+id;}\n"
            . "}\n"
            . "\n"
            . "// -->\n"
            . "</script>\n";

            echo "<div style=\"text-align: right;\"><a href=\"index.php?file=Sections&amp;page=admin&amp;op=edit&amp;art_id=" . $artid . "\"><img style=\"border: 0;\" src=\"images/edition.gif\" alt=\"\" title=\"" . _EDIT . "\" /></a>"
            . "&nbsp;<a href=\"javascript:delart('" . mysql_real_escape_string(stripslashes($title)) . "','" . $artid . "');\"><img style=\"border: 0;\" src=\"images/delete.gif\" alt=\"\" title=\"" . _DEL . "\" /></a></div>\n";
        } 


        echo "<br /><div style=\"text-align: center;\"><a href=\"index.php?file=Sections\" style=\"text-decoration:none\"><big><b>" . _SECTIONX . "</b></big></a></div><br />\n"
	. "<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"
	. "<tr><td style=\"background: " . $bgcolor2 . ";border: hidden " . $bgcolor3 . ";\" align=\"center\">\n"
	. "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"
	. "<tr><td style=\"width: 5%;\">&nbsp;</td>\n"
	. "<h3 class=\"title2\">" . $title . "\n"
	. "<td style=\"width: 5%;\" align=\"center\"><a href=\"#\" onclick=\"javascript:window.open('index.php?file=Sections&amp;nuked_nude=index&amp;op=pdf&amp;artid=" . $artid . "','projet','toolbar=yes,location=no,directories=no,scrollbars=yes,resizable=yes')\"><img style=\"border: 0;\"  alt=\"\" title=\"" . _PDF . "\" /></a></td></tr></table></td></tr>\n";
	//. "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: hidden " . $bgcolor3 . ";\"><b>". _CATE . " </b> ".  $category . "</td></tr>\n"
	//. "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: hidden " . $bgcolor3 . ";\"><b>" . _ADDTHE . " :</b> " . $date . "</td></tr>\n";
       
 	if ($auteur != "")
        {
           echo"<h4 class=\"title1\"><b>" . _AUTHOR . " :</b> " . $auteur . "</h4>\n";
	}

	//echo "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: hidden " . $bgcolor3 . ";\"><b>" . _READSART . " :</b> " . $counter . "</td></tr>\n"
	//. "<tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: hidden " . $bgcolor3 . ";\">";

        //vote_index("Sections", $artid);

        echo "</td></tr><tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: hidden " . $bgcolor3 . ";\">";

        if ($pageno > 1)
        {
            echo _PAGE . " : " . $_REQUEST['p'] . "/" . $pageno . "<br /><br />";
        } 
        else
        {
            echo "<br />";
        } 

        echo $contentpages[$arrayelement];

        if ($_REQUEST['p'] >= $pageno)
        {
            $next_page = "";
        } 
        else
        {
            $next_pagenumber = $_REQUEST['p'] + 1;

            if ($_REQUEST['p'] != 1)
            {
                $next_page .= "";
            } 

            $next_page .= "<a href=\"index.php?file=Sections&amp;op=article&amp;artid=" . $artid . "&amp;p=" . $next_pagenumber . "\">" . _NEXTPAGE . " (" . $next_pagenumber . "/" . $pageno . ")</a>&nbsp;" 
            . "<a href=\"index.php?file=Sections&amp;op=article&amp;artid=" . $artid . "&amp;p=" . $next_pagenumber . "\"><img style=\"border: 0;\" src=\"modules/Sections/images/right.gif\" alt=\"\" title=\"" . _NEXTPAGE . "\" align=\"top\"></a>";
        } 

        if ($_REQUEST['p'] <= 1)
        {
            $previous_page = "";
        } 
        else
        {
            $previous_pagenumber = $_REQUEST['p'] - 1;
            $previous_page = "<a href=\"index.php?file=Sections&amp;op=article&amp;artid=" . $artid . "&amp;p=" . $previous_pagenumber . "\"><img style=\"border: 0;\" src=\"modules/Sections/images/left.gif\" alt=\"\" title=\"" . _PREVIOUSPAGE . "\"></a>"
            . "&nbsp;<a href=\"index.php?file=Sections&amp;op=article&amp;artid=" . $artid . "&amp;p=" . $previous_pagenumber . "\">" . _PREVIOUSPAGE . " (" . $previous_pagenumber . "/" . $pageno . ")</a>";
        } 

        echo "<br /><div style=\"text-align: center;\">" . $previous_page. "&nbsp;&nbsp;" . $next_page . "</div></td></tr></table><br />\n";
		
		$sql = mysql_query("SELECT active FROM " . $nuked['prefix'] . "_comment_mod WHERE module = 'sections'");
		list($active) = mysql_fetch_array($sql);
			
		if($active ==1)
		{
		echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"80%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\"><tr style=\"background: " . $bgcolor1 . ";\"><td style=\"border: hidden " . $bgcolor3 . ";\">";

            include ("modules/Comment/index.php");
            com_index("Sections", $artid);

            echo "</td></tr></table>\n";
		}
        closetable();
    } 
	

    function classe($sid, $nb_subcat)
    {
        global $nuked, $theme, $bgcolor1, $bgcolor2, $bgcolor3;
		$sql12 = mysql_query("SELECT autor, autor_id FROM " . SECTIONS_TABLE . "  WHERE artid = '" . $artid . "'");
		list($autor, $autor_id) = mysql_fetch_row($sql);
        if ($_REQUEST['op'] == "classe")
        {

            echo "<br /><div style=\"text-align: center;\"><big><b>" . _SECTIONS . "</b></big></div>\n"
            . "<div style=\"text-align: center;\"><br />\n"
            . "[ <a href=\"index.php?file=Sections\" style=\"text-decoration: underline\">" . _INDEXSECTIONS . "</a> | ";

            if ($_REQUEST['orderby'] == "news")
            {
                echo _NEWSART . " | ";
            } 
            else
            {
                echo "<a href=\"index.php?file=Sections&amp;op=classe&amp;orderby=news\" style=\"text-decoration: underline\">" . _NEWSART . "</a> | ";
            } 

            if ($_REQUEST['orderby'] == "count")
            {
                echo _TOPART . " | ";
            } 
            else
            {
                echo "<a href=\"index.php?file=Sections&amp;op=classe&amp;orderby=count\" style=\"text-decoration: underline\">" . _TOPART . "</a> | ";
            } 

            echo "<a href=\"index.php?file=Suggest&amp;module=Sections\" style=\"text-decoration: underline\">" . _SUGGESTART . "</a> ]</div><br />\n";
        } 

        $nb_max = $nuked['max_sections'];
        if (!$_REQUEST['p']) $_REQUEST['p'] = 1;
        $start = $_REQUEST['p'] * $nb_max - $nb_max;

        if ($sid != "") $where = "WHERE S.secid = '" . $sid . "'";
	else $where = "";

        if ($_REQUEST['orderby'] == "name")
        {
            $order = "ORDER BY S.title";
        } 

        else if ($_REQUEST['orderby'] == "count")
        {
            $order = "ORDER BY S.counter DESC";
        } 

        else if ($_REQUEST['orderby'] == "note")
        {
            $order = "ORDER BY note DESC";
        } 

        else
        {
            $_REQUEST['orderby'] = "news";
            $order = "ORDER BY S.artid DESC";
        } 

        $sql = mysql_query("SELECT S.artid, S.title, S.date, S.counter, S.content, AVG(V.vote) AS note  FROM " . SECTIONS_TABLE . " AS S LEFT JOIN " . VOTE_TABLE . " AS V ON S.artid = V.vid AND V.module = 'Sections' " . $where . " GROUP BY S.artid " . $order);
        
		$nb_art = mysql_num_rows($sql);

        if ($nb_art > 1 && $sid != "")
        {
            echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\">\n"
            . "<tr><td align=\"right\"><small>" . _ORDERBY . " : ";

            if ($_REQUEST['orderby'] == "news") echo "<b>" . _DATE . "</b> | ";
            else echo "<a href=\"index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;orderby=news&amp;secid=" . $sid . "\">" . _DATE . "</a> | ";

            if ($_REQUEST['orderby'] == "count") echo "<b>" . _TOPFILE . "</b> | ";
            else echo "<a href=\"index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;orderby=count&amp;secid=" . $sid . "\">" . _TOPFILE . "</a> | ";

            if ($_REQUEST['orderby'] == "name") echo "<b>" . _NAME . "</b> | ";
            else echo"	<a href=\"index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;orderby=name&amp;secid=" . $sid . "\">" . _NAME . "</a> | ";

           if ($_REQUEST['orderby'] == "note") echo"<b>" . _NOTE . "</b>";
            else echo"	<a href=\"index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;orderby=note&amp;secid=" . $sid . "\">" . _NOTE . "</a>";

            echo "</small></td></tr></table>\n";
        } 

        if ($nb_art > 0)
        {
            if ($nb_art > $nb_max)
            {
                echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\"><tr><td>";
                $url = "index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;secid=" . $sid . "&amp;orderby=" . $_REQUEST['orderby'];
                number($nb_art, $nb_max, $url);
                echo "</td></tr></table>\n";
            } 

            echo "<br />";

            $sqlhot = mysql_query("SELECT artid FROM " . SECTIONS_TABLE . " ORDER BY counter DESC LIMIT 0, 10");

            $seek = mysql_data_seek($sql, $start);
            for($i = 0;$i < $nb_max;$i++)
            {
                if (list($artid, $title, $date, $counter, $content) = mysql_fetch_row($sql))
                {
                  /* 	?><h3 class="title"><?php echo $title = htmlentities($title); ?></h3> <?php*/
                    $newsdate = time() - 604800;
                    $att = "";

                    if ($date != "" && $date > $newsdate) $att = "&nbsp;&nbsp;" . _NEW;

                    if ($content != "")
                    {
                        $content = str_replace("\r", "", $content);
                        $content = str_replace("\n", " ", $content);
                        $texte = strip_tags($content);
                        $texte = str_replace("(--pagebreak--)", "", $texte);

                        if (strlen($texte) > 150)
                        {
                            $texte = substr($texte, 0, 150) . "...";
							$texte = htmlentities($texte);
                        } 
                    } 
                    else
                    {
                        $texte = "";
                    } 

                    mysql_data_seek($sqlhot, 0);
                    while (list($id_hot) = mysql_fetch_array($sqlhot))
                    {
                        if ($artid == $id_hot && $nb_art > 1 && $counter > 9) $att .= "&nbsp;&nbsp;" . _HOT;
                    } 

                    if ($date != "") $alt = "title=\"" . _ADDTHE . "&nbsp;" . strftime("%x %H:%M", $date) . "\"";
                    else $alt = "";

                    if (is_file("themes/" . $theme . "/images/articles.gif"))
                    {
                        $img = "<img src=\"themes/" . $theme . "/images/articles.gif\" alt=\"\" " . $alt . "/>";
                    } 
                    else
                    {
                        $img = "<img src=\"modules/Sections/images/articles.gif\" alt=\"\" " . $alt . "/>";
                    } 
			$sql5 = mysql_query("SELECT pseudo FROM " . USER_TABLE . " WHERE id = '" . $autor_id . "'");
            $test = mysql_num_rows($sql5);
            list($auteur) = mysql_fetch_array($sql5);
            $auteur = "<a href=\"index.php?file=Members&amp;op=detail&amp;autor=" . urlencode($auteur) . "\">" . $auteur . "</a>";
            $auteur = $autor;
			
                    echo "<table style=\"background: " . $bgcolor3 . ";margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\" cellspacing=\"1\" cellpadding=\"0\">\n"
                    . "<tr><td><table style=\"background: " . $bgcolor2 . ";\" width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">\n"
                    . "<tr><td style=\"width: 100%;\">" .  $img . " <a href=\"index.php?file=Sections&amp;op=article&amp;artid=" . $artid . "\" <h4 class=\"title1\">" . $title . "</h4></a>" . $att . "</td>\n"
					. "<td><a href=\"#\" onclick=\"javascript:window.open('index.php?file=Sections&amp;nuked_nude=index&amp;op=pdf&amp;artid=" . $artid . "','projet','toolbar=yes,location=no,directories=no,scrollbars=yes,resizable=yes')\">"
					. "<img style=\"border: 0;\"  alt=\"\" title=\"" . _PDF . "\" /></a></td></tr>\n"
					. "<h4 class=\"title1\"><b>" . _AUTHOR . " :</b> " . $auteur . "</h4>\n";

                    if ($texte != "")
                    {
                        echo "<tr><td colspan=\"2\">" . $texte . "</td></tr>\n";
                    } 
					
					echo"<tr><td><div class=\"suite\"> <a href=\"index.php?file=Sections&amp;op=article&amp;artid=" . $artid . "\" <div class=\"title3\">" . _SUITE . "</div></a></div>";
                    //echo "<tr style=\"background: " . $bgcolor1 . ";\"><td colspan=\"2\">&nbsp;<b>" . _READSART . " :</b> " . $counter . "&nbsp;";

                    //vote_index("Sections", $artid);

                    echo "</td></tr></table></td></tr></table><br /><br \>\n";
                } 
            } 

            if ($nb_art > $nb_max)
            {
                echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\"><tr><td>";
                $url = "index.php?file=Sections&amp;op=" . $_REQUEST['op'] . "&amp;secid=" . $sid . "&amp;orderby=" . $_REQUEST['orderby'];
                number($nb_art, $nb_max, $url);
                echo "</td></tr></table>\n";
            } 

        } 
        else
        {
            if ($nb_subcat == 0 && $sid > 0) echo "<div style=\"text-align: center;\"><br />" . _NOARTS . "</div><br /><br />\n";
            if ($_REQUEST['op'] == "classe") echo "<div style=\"text-align: center;\"><br />" . _NOARTINDB . "</div><br /><br />\n";
        } 
    } 



    function pdf($artid)
    {
        global $nuked;

        $sql = mysql_query("SELECT title, content FROM " . SECTIONS_TABLE . "  WHERE artid = '" . $artid . "'");
        list($title, $text) = mysql_fetch_row($sql);

        $text = "<br>" . $text;

	$text = str_replace("&quot;", "\"", $text);
	$text = str_replace("&#039;", "\'", $text);
	$text = str_replace("à", "à", $text);
	$text = str_replace("â", "â", $text);
	$text = str_replace("é", "é", $text);
	$text = str_replace("è", "è", $text);
	$text = str_replace("ê", "ê", $text);
	$text = str_replace("û", "û", $text);

        $text = str_replace("(--pagebreak--)", _PAGEB, $text);
        $articleurl = $nuked['url'] . "/index.php?file=Sections&op=article&artid=" . $artid;

        include ('Includes/html2pdf/html2pdf.class.php');
        $sitename = $nuked['name'] . " - " . $nuked['slogan'];
        $sitename  = @html_entity_decode($sitename);

		$texte = "<h1>".$title."</h1><hr />".$text."<hr />".$sitename."<br />".$articleurl;
		$_REQUEST['file'] = $sitename."_".$title;
		$_REQUEST['file'] = str_replace(' ','_',$_REQUEST['file']);
		$_REQUEST['file'] .= ".pdf";
		
        $pdf = new HTML2PDF('P','A4','fr');
		$pdf->WriteHTML($texte);
		$pdf->Output($_REQUEST['file']);
    } 

    switch ($_REQUEST['op'])
    {
        case "article":
            article($_REQUEST['artid']);
            break;

        case "classe":
            opentable();
            classe($_REQUEST['sid'], $_REQUEST['nb_subcat']);
            closetable();
            break;

        case "categorie":
            categorie($_REQUEST['secid']);
            break;

        case "pdf":
            pdf($_REQUEST['artid']);
            break;

        default:
            index();
            break;
    } 

} 
else if ($level_access == -1)
{
    opentable();
    echo "<br /><br /><div style=\"text-align: center;\">" . _MODULEOFF . "<br /><br /><a href=\"javascript:history.back()\"><b>" . _BACK . "</b></a><br /><br /></div>";
    closetable();
} 
else if ($level_access == 1 && $visiteur == 0)
{
    opentable();
    echo "<br /><br /><div style=\"text-align: center;\">" . _USERENTRANCE . "<br /><br /><b><a href=\"index.php?file=User&amp;op=login_screen\">" . _LOGINUSER . "</a> | <a href=\"index.php?file=User&amp;op=reg_screen\">" . _REGISTERUSER . "</a></b><br /><br /></div>";
    closetable();
} 
else
{
    opentable();
    echo "<br /><br /><div style=\"text-align: center;\">" . _NOENTRANCE . "<br /><br /><a href=\"javascript:history.back()\"><b>" . _BACK . "</b></a><br /><br /></div>";
    closetable();
} 

?>

/spoiler
Merci d'avance de m'aider



2 réponses

AssassinTourist Messages postés 5709 Date d'inscription lundi 16 janvier 2012 Statut Contributeur Dernière intervention 29 février 2024 1 310
30 janv. 2012 à 09:57
Bonjour,

Votre code est trop long pour donner envie de tout lire et de vous aider. Est-ce que c'est ici que ça pose problème :

$sql5 = mysql_query("SELECT pseudo FROM " . USER_TABLE . " WHERE id = '" . $autor_id . "'");
$test = mysql_num_rows($sql5);
list($auteur) = mysql_fetch_array($sql5);
$auteur = "<a href=\"index.php?file=Members&op=detail&autor=" . urlencode($auteur) . "\">" . $auteur . "</a>";
1
thiryn Messages postés 15 Date d'inscription lundi 30 janvier 2012 Statut Membre Dernière intervention 7 février 2012
30 janv. 2012 à 18:03
Ouip :P je crois que ce forum ne dispose pas de balise spoiler, c'est bien dommage.
0
AssassinTourist Messages postés 5709 Date d'inscription lundi 16 janvier 2012 Statut Contributeur Dernière intervention 29 février 2024 1 310
30 janv. 2012 à 19:21
C'est vrai, c'est un comble pour un site de support informatique ;p

Sinon, deux choses :

- il ne me semble pas que php apprécie la redéfinition de variable à la volée comme tu as fait : $auteur = "blabla".$auteur; Je pense qu'il vaudrait mieux faire $lien_auteur = "blabla".$auteur;

- sinon, en regardant les propriétés de list (http://php.net/manual/fr/function.list.php), on peut voir qu'il s'agit d'un tableau ! Donc tu ne peux pas l'utiliser comme une variable simple. Soit, tu faire une boucle, soit tu fais $auteur[0]

NB : de même dans ton urlencode bien sûr.
0
thiryn Messages postés 15 Date d'inscription lundi 30 janvier 2012 Statut Membre Dernière intervention 7 février 2012
Modifié par thiryn le 30/01/2012 à 21:47
Donc ça ferait:
$sql5 = mysql_query("SELECT pseudo FROM " . USER_TABLE . " WHERE id = '" . $autor_id . "'");   
$test = mysql_num_rows($sql5);   
while($auteur = mysql_fetch_array($sql5));  
$liens_auteur = "<a href=\"index.php?file=Members&op=detail&autor=" . urlencode($auteur) . "\">" . $auteur . "</a>";  
$lien_auteur = $autor;


Ou quelque chose comme ça?
Je ne m'y connais pas énormément en php hein, je vois pas trop comment introduire le while

et dans ce cas là, dans le echo, je remplace par ça?:

. "<h4 class=\"title1\"><b>" . _AUTHOR . " :</b> " . $lien_auteur . "</h4>\n";


Merci de tes réponses
0
AssassinTourist Messages postés 5709 Date d'inscription lundi 16 janvier 2012 Statut Contributeur Dernière intervention 29 février 2024 1 310
31 janv. 2012 à 09:54
Non pas tout à fait. On est bien d'accord que $sql5 ne va renvoyer qu'un seul résultat (puisqu'on fait une condition sur le id). Donc pas besoin de faire une vraie boucle.

Ce sera illisible si je reprend exactement votre code, alors je vous laisse adapter.

$sql5 = mysql_query("SELECT pseudo FROM " . USER_TABLE . " WHERE id = '" . $autor_id . "'");
$test = mysql_num_rows($sql5);
$auteur = $test[0]; //cela récupère ta seule valeur
$liens_auteur = "<a href=\"index.php?file=Members&op=detail&autor=" . urlencode($auteur) . "\">" . $auteur . "</a>";

$lien_auteur = $autor; // Ca je ne comprend pas pourquoi tu fais ça ? Parce que là, ça réécrit ta variable $lien_auteur... et tout ce que tu as fait avant s'est enlevé. Donc le mieux c'est d'enlever cette ligne ¬¬
0
thiryn Messages postés 15 Date d'inscription lundi 30 janvier 2012 Statut Membre Dernière intervention 7 février 2012
1 févr. 2012 à 15:20
Merci beaucoup, mais dans le echo dans ce cas je mets quoi?
0
AssassinTourist Messages postés 5709 Date d'inscription lundi 16 janvier 2012 Statut Contributeur Dernière intervention 29 février 2024 1 310
1 févr. 2012 à 21:27
Comme vous avez dit :

. "<h4 class=\"title1\"><b>" . _AUTHOR . " :</b> " . $lien_auteur . "</h4>\n";
0