PDA

View Full Version : I'll eat my screen , pb with my new hack


grog6
04-28-2003, 07:19 PM
It's now more than 1 hour I'm searching the error but don't find it :sleep:

This hack works perfectly in some forums, but shows a wrong username in others forums, it's this hack :

https://vborg.vbsupport.ru/showthread.php?s=&postid=387852

Here is the modification to do in the forumdisplay.php :

$nbeposts=$DB_site->query_first("SELECT SUM(replycount) AS reply FROM `thread` WHERE forumid=$forumid");
$nbepost=number_format($nbeposts['reply']);

$nbemesss=$DB_site->query_first("SELECT COUNT(*) AS nbe FROM thread WHERE forumid=$forumid");
$nbemess=number_format($nbemesss['nbe']);


$i=1;
$j=1;
$nom[1]="";
$counts[1]=0;
$counts[0]=0;
$listes=$DB_site->query("SELECT postusername,postuserid FROM `thread` WHERE forumid='$forumid' ORDER BY postusername");
while ($liste=$DB_site->fetch_array($listes)) {
if ($liste[postusername]!=$nom[$i-1]) {

$nom[$i]=$liste[postusername];
$userid[$i]=$liste[postuserid];
$i=$i+1;

}

else {
$counts[$i-1]=$counts[$i-1]+1;
}
}




while ($j<=$i)
{

if ($counts[$j]>$counts[$j-1])
{
$mposteur=$nom[$j];
$liste[postuserid]=$userid[$j];
}
$j=$j+1;
}


$avgposteurs=$DB_site->query_first("SELECT COUNT(postusername) AS moyenne FROM thread WHERE (forumid='$forumid' AND

postusername='$mposteur')");
$avgposteuri=number_format($avgposteurs['moyenne']);
$avgposteur=(($avgposteuri/$nbemess)*100);
$avgposteur=number_format($avgposteur);

$threadavg=$DB_site->query_first("SELECT AVG(vote) AS moythread FROM thread,threadrate WHERE (thread.forumid='$forumid' AND
threadrate.threadid=thread.threadid)");
$moyenne=number_format($threadavg[moythread]);

if ($moyenne>=0 AND $moyenne<=0.5) $moyenne="<img src=\"images/0stars.gif\">";
if ($moyenne>0.5 AND $moyenne<=1.5) $moyenne="<img src=\"images/1stars.gif\">";
if ($moyenne>1.5 AND $moyenne<=2.5) $moyenne="<img src=\"images/2stars.gif\">";
if ($moyenne>2.5 AND $moyenne<=3.5) $moyenne="<img src=\"images/3stars.gif\">";
if ($moyenne>3.5 AND $moyenne<=4.5) $moyenne="<img src=\"images/4stars.gif\">";
if ($moyenne>4.5 AND $moyenne<=5) $moyenne="<img src=\"images/5stars.gif\">";


$vues=$DB_site->query_first("SELECT SUM(views) AS vu FROM thread WHERE forumid='$forumid'");
$vue=$vues['vu'];

$dposteurs=$DB_site->query_first("SELECT lastposter FROM thread WHERE forumid='$forumid' ORDER BY threadid DESC");
$dposteur=$dposteurs['lastposter'];

but the problem is here I think, what could be wrong here :

while ($j<=$i)
{

if ($counts[$j]>$counts[$j-1])
{
$mposteur=$nom[$j];
$liste[postuserid]=$userid[$j];
}
$j=$j+1;
}

:confused:

Xenon
04-29-2003, 04:33 PM
i would really advice you, to format your code much better, it's really hard to read....

well i don't know the problem itselft, but maybe your threadcounters are just not uptodate.

have you tried to update counters from acp?

grog6
04-29-2003, 04:45 PM
It's Ok Xenon

https://vborg.vbsupport.ru/showthread.php?postid=388881#post388881

Thx to you, in the future, I promiss I'll improve my hack's coding ;)

Xenon
04-29-2003, 05:08 PM
:)
good amy :)