Thread subject: muscapaul's PHP-Fusion website :: posts posted last 24 hour (today)

Posted by axel on 18-09-2008 15:26
#1

Help me..

Code
<?php
require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";

if (!iMEMBER) fallback("../../index.php");


$time =time() - 86400;
$i=0;



opentable($locale['028']);
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n<tr>\n";
echo "
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><span class='small'> </span></td>
<td width=45% class='tbl2'><span class='small'><b>".$locale['030']."</b></span></td>
<td width=55% class='tbl2'><span class='small'><b>".$locale['035']."</b></span></td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><span class='small'><b>".$locale['032']."</b></span></td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><span class='small'><b>".$locale['033']."</b></span></td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><span class='small'><b>".$locale['034']."</b></span></td>
</tr>\n";




$res = mysql_query("SELECT MAX(post_id) FROM ".$db_prefix."posts")or die(mysql_error());
$max_post_id = mysql_fetch_row($res);

for($post_id=$max_post_id[0]; $post_id>=0;$post_id=$post_id-1)
{

$query = "SELECT * FROM ".$db_prefix."posts WHERE post_id=$post_id";
$result1 = mysql_query( $query );
if( $result1 && $contact = mysql_fetch_object( $result1 ) )

{
$post_id = $contact -> post_id;
$post_subject = $contact -> post_subject;
$post_datestamp = $contact -> post_datestamp;
$thread_id = $contact -> thread_id;
}



$query = "SELECT * FROM ".$db_prefix."threads WHERE thread_id=$thread_id";
$result = mysql_query( $query );
if( $result && $contact = mysql_fetch_object( $result ) )
{




$forum_id = $contact -> forum_id;
$thread_id = $contact -> thread_id;
$thread_subject = $contact -> thread_subject;
$thread_author = $contact -> thread_author;
$thread_views = $contact -> thread_views;
$thread_lastpost = $contact -> thread_lastpost;
$thread_lastuser = $contact -> thread_lastuser;
$thread_locked = $contact -> thread_locked;

}

$query = "SELECT * FROM ".$db_prefix."forums WHERE forum_id=$forum_id";
$result2 = mysql_query( $query );
if( $result2 && $contact = mysql_fetch_object( $result2 ) )
{


$forum_name = $contact -> forum_name;
$forum_lastpost = $contact -> forum_lastpost;

}

$query = "SELECT * FROM ".$db_prefix."users WHERE user_id=$thread_lastuser";
$result3 = mysql_query( $query );
if( $result3 && $contact = mysql_fetch_object( $result3 ) )
{


$user_name = $contact -> user_name;
$user_id = $contact -> user_id;

}

if($thread_lastpost>=$time && $thread_lastpost==$post_datestamp)
{

if ($i % 2 == 0) { $row_color = "tbl1"; } else { $row_color = "tbl2"; }
$reply_count = dbcount("(thread_id)", "posts", "thread_id='".$thread_id."'");
$rstart = ($reply_count > 20 ? "rowstart=".((ceil($reply_count / 20)-1)*20)."&" : "");

$new_posts = dbcount("(post_id)", "posts", "thread_id='".$thread_id."' and post_datestamp>'$lastvisited'");

if ($thread_locked) {
echo "<tr>\n<td class='$row_color' align='center' width='25' class='tbl2'><img src='".THEME."forum/folderlock.gif' alt='".$locale['564']."'></td>";
} else {
if ($new_posts > 0 && $reply_count - 1 < 20) {
$folder = "<img src='".THEME."forum/foldernew.gif' alt='".$locale['560']."'>";
} else if ($new_posts > 0 && $reply_count - 1 >= 20) {
$folder = "<img src='".THEME."forum/folderhot.gif' alt='".$locale['562']."'>";
} else if ($reply_count - 1 > 20){
$folder = "<img src='".THEME."forum/folderhotold.gif' alt='".$locale['562']."'>";
} else {
$folder = "<img src='".THEME."forum/folder.gif' alt='".$locale['561']."'>";
}
echo "<tr>\n<td class='$row_color' align='center' width='25' class='tbl2'>$folder</td>";
}

echo"
<td class='$row_color'><span class='small'>".trimlink($forum_name, 30)."</span></td>
<td class='$row_color'><span class='small'><a href='".FORUM."viewthread.php?".$rstart."forum_id=".$forum_id."&thread_id=".$thread_id."#post_".$post_id."' title='".$post_subject."'>".trimlink($post_subject, 40)."</a></span></td>
<td align='center' width='1%' class='$row_color' style='white-space:nowrap'><span class='small'>".$thread_views."</span></td>
<td align='center' width='1%' class='$row_color' style='white-space:nowrap'><span class='small'>".($reply_count - 1)."</span></td>
<td align='center' width='1%' class='$row_color' style='white-space:nowrap'><span class='small'><a href='".BASEDIR."profile.php?lookup=".$thread_lastuser."'>".$user_name."</a></span></td>
</tr>\n";
$i++;
}
}


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

require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>



Posted by muscapaul on 18-09-2008 16:58
#2

Code
<?php
require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";

if (!iMEMBER) fallback("../../index.php");


$time =time() - 86400;
$i=0;



opentable($locale['028']);
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n<tr>\n";
echo "
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><span class='small'> </span></td>
<td width=45% class='tbl2'><span class='small'><b>".$locale['030']."</b></span></td>
<td width=55% class='tbl2'><span class='small'><b>".$locale['035']."</b></span></td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><span class='small'><b>".$locale['032']."</b></span></td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><span class='small'><b>".$locale['033']."</b></span></td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><span class='small'><b>".$locale['034']."</b></span></td>
</tr>\n";




$max_post_id = dbresult(dbquery("SELECT MAX(post_id) FROM ".$db_prefix."posts"),0);
$min_post_id = dbresult(dbquery("SELECT MIN(post_id) FROM ".$db_prefix."posts WHERE post_datestamp >= '".$time."'"),0);

for($post_id=$max_post_id; $post_id >= $min_post_id; $post_id=$post_id-1)
{

$query = "SELECT * FROM ".$db_prefix."posts WHERE post_id=$post_id";
$result1 = mysql_query( $query );
if( $result1 && $contact = mysql_fetch_object( $result1 ) )

{
$post_id = $contact -> post_id;
$post_subject = $contact -> post_subject;
$post_datestamp = $contact -> post_datestamp;
$thread_id = $contact -> thread_id;
}



$query = "SELECT * FROM ".$db_prefix."threads WHERE thread_id=$thread_id";
$result = mysql_query( $query );
if( $result && $contact = mysql_fetch_object( $result ) )
{




$forum_id = $contact -> forum_id;
$thread_id = $contact -> thread_id;
$thread_subject = $contact -> thread_subject;
$thread_author = $contact -> thread_author;
$thread_views = $contact -> thread_views;
$thread_lastpost = $contact -> thread_lastpost;
$thread_lastuser = $contact -> thread_lastuser;
$thread_locked = $contact -> thread_locked;

}

$query = "SELECT * FROM ".$db_prefix."forums WHERE forum_id=$forum_id";
$result2 = mysql_query( $query );
if( $result2 && $contact = mysql_fetch_object( $result2 ) )
{


$forum_name = $contact -> forum_name;
$forum_lastpost = $contact -> forum_lastpost;

}

$query = "SELECT * FROM ".$db_prefix."users WHERE user_id=$thread_lastuser";
$result3 = mysql_query( $query );
if( $result3 && $contact = mysql_fetch_object( $result3 ) )
{


$user_name = $contact -> user_name;
$user_id = $contact -> user_id;

}

if($thread_lastpost>=$time && $thread_lastpost==$post_datestamp)
{

if ($i % 2 == 0) { $row_color = "tbl1"; } else { $row_color = "tbl2"; }
$reply_count = dbcount("(thread_id)", "posts", "thread_id='".$thread_id."'");
$rstart = ($reply_count > 20 ? "rowstart=".((ceil($reply_count / 20)-1)*20)."&" : "");

$new_posts = dbcount("(post_id)", "posts", "thread_id='".$thread_id."' and post_datestamp>'$lastvisited'");

if ($thread_locked) {
echo "<tr>\n<td class='$row_color' align='center' width='25' class='tbl2'><img src='".THEME."forum/folderlock.gif' alt='".$locale['564']."'></td>";
} else {
if ($new_posts > 0 && $reply_count - 1 < 20) {
$folder = "<img src='".THEME."forum/foldernew.gif' alt='".$locale['560']."'>";
} else if ($new_posts > 0 && $reply_count - 1 >= 20) {
$folder = "<img src='".THEME."forum/folderhot.gif' alt='".$locale['562']."'>";
} else if ($reply_count - 1 > 20){
$folder = "<img src='".THEME."forum/folderhotold.gif' alt='".$locale['562']."'>";
} else {
$folder = "<img src='".THEME."forum/folder.gif' alt='".$locale['561']."'>";
}
echo "<tr>\n<td class='$row_color' align='center' width='25' class='tbl2'>$folder</td>";
}

echo"
<td class='$row_color'><span class='small'>".trimlink($forum_name, 30)."</span></td>
<td class='$row_color'><span class='small'><a href='".FORUM."viewthread.php?".$rstart."forum_id=".$forum_id."&thread_id=".$thread_id."#post_".$post_id."' title='".$post_subject."'>".trimlink($post_subject, 40)."</a></span></td>
<td align='center' width='1%' class='$row_color' style='white-space:nowrap'><span class='small'>".$thread_views."</span></td>
<td align='center' width='1%' class='$row_color' style='white-space:nowrap'><span class='small'>".($reply_count - 1)."</span></td>
<td align='center' width='1%' class='$row_color' style='white-space:nowrap'><span class='small'><a href='".BASEDIR."profile.php?lookup=".$thread_lastuser."'>".$user_name."</a></span></td>
</tr>\n";
$i++;
}
}


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

require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>




Notice: Undefined index: post_edituser in /home/muscapal/public_html/print.php on line 114
Edited by muscapaul on 20-09-2008 04:04

Posted by axel on 20-09-2008 03:46
#3

Paul thakyou

Disable smileys please.


Notice: Undefined index: post_edituser in /home/muscapal/public_html/print.php on line 114
Edited by axel on 20-09-2008 04:03

Posted by muscapaul on 20-09-2008 04:05
#4

Done.

Posted by gozoc on 21-11-2008 00:24
#5

Sorry ... but it dont works ...
Not in my portal v6.
I use this as /infusions/aw_forum_panel/last24.php
It runs, and runs, and runs .... came not back ;)