چند روز پیش این کد رو پیدا کردم که با اون میشد آخرین ارسالی های وی بی رو با اتصال به دیتابیس تو سایت نشون داد
اینم کدش
?<?php// Ajax Last VB Posts$gtset = 1; // مقدار 1 براي انتقال به آخرين پست ، تاپيک $Last_New = 20; /// تعداد تاپيک ها براي نمايش$db_server = 'localhost'; // localhost معمولا$db_name = 'HERE'; // نام ديتابيس$db_username = 'HERE'; // نام کاربري ديتابيس$db_password = 'HERE'; // پسورد ديتابيس$forumurl = 'http://YourSite.com/forum/'; // آدرس انجمن$a = mysql_connect($db_server, $db_username, $db_password, false, MYSQL_CLIENT_COMPRESS) OR die(mysql_error());$b = mysql_select_db($db_name) OR die(mysql_error());$p = $_REQUEST['p'];function UsernameColor($username) { list($usergroupid,$membergroupids) = mysql_fetch_array(mysql_query("SELECT usergroupid,membergroupids FROM `user` WHERE username = '$username'")); if(!empty($membergroupids) and $usergroupid == 2){ $ug = explode(',',$membergroupids); $usergroupid = $ug[0]; } list($opentag, $closetag) = mysql_fetch_array(mysql_query("SELECT opentag,closetag FROM usergroup WHERE usergroupid = $usergroupid")); $username = $opentag.$username.$closetag; return $username;}function MTForumBlock($p=1){ global $gtset,$Last_New; $from = $Last_New * ($p-1); $query = mysql_query("SELECT threadid, lastposter , title FROM thread ORDER BY lastpostid DESC LIMIT $from,$Last_New") OR die(mysql_error()); $content .= "<table>\n"; $content .= "<tr class=\"MTForumfirst\">\n"; $content .= "<td class=\"MTForumtitle\">عنوان</td>\n"; $content .= "<td class=\"MTForumanswer\">پاسخ</td>\n"; $content .= "<td class=\"MTForumview\">بازديد</td>\n"; $content .= "<td class=\"MTForumlast\">آخرين ارسال</td>\n"; $content .= "</tr>\n"; while($row=mysql_fetch_assoc($query)) { $title = $row['title']; $lastposter = $row['lastposter']; $threadid = intval($row['threadid']); $query3 = mysql_query("SELECT * FROM thread Where threadid = '$threadid'") OR die(mysql_error()); $row3 = mysql_fetch_assoc($query3) ; $LastReplies = $row3['replycount']; $TopicViews = intval($row3['views']); $TopicPoster = $row3['postuserid']; $query4 = mysql_query("SELECT username, userid FROM user where username='$lastposter'"); list($username, $userid)=mysql_fetch_assoc($query4); if($gtset == "1") { $topicurl = "/forum/showthread.php?threadid=$threadid"; } else { $topicurl = "/forum/showthread.php?threadid=$threadid&goto=newpost"; } $content .= "<tr>\n"; $content .= "<td class=\"MTForumrowtitle\"><a href=\"$topicurl\">« $title</a></td>\n"; $content .= "<td class=\"MTForumanswer\">$LastReplies</td>\n"; $content .= "<td class=\"MTForumview\">$TopicViews</td>\n"; $content .= "<td class=\"MTForumlast\">".UsernameColor($row['lastposter'])."</td>\n"; $content .= "</tr>\n"; } $content .= "</table>\n"; return $content;}switch($_REQUEST['req']){ case "LastTopics": echo MTForumBlock($p); break; default: echo MTForumBlock(); break;}?>حالا کسی میتونه کمک کنه اینو برا IPB اجراش کنم
با آی فریم میشه ولی یه مشکله
اونم این که مطالب ایندکس نمیشه و من میخوام از این طریق مطالب ایندکس بشه
میشه کاری کرد آیا؟
اینم کدش
?<?php// Ajax Last VB Posts$gtset = 1; // مقدار 1 براي انتقال به آخرين پست ، تاپيک $Last_New = 20; /// تعداد تاپيک ها براي نمايش$db_server = 'localhost'; // localhost معمولا$db_name = 'HERE'; // نام ديتابيس$db_username = 'HERE'; // نام کاربري ديتابيس$db_password = 'HERE'; // پسورد ديتابيس$forumurl = 'http://YourSite.com/forum/'; // آدرس انجمن$a = mysql_connect($db_server, $db_username, $db_password, false, MYSQL_CLIENT_COMPRESS) OR die(mysql_error());$b = mysql_select_db($db_name) OR die(mysql_error());$p = $_REQUEST['p'];function UsernameColor($username) { list($usergroupid,$membergroupids) = mysql_fetch_array(mysql_query("SELECT usergroupid,membergroupids FROM `user` WHERE username = '$username'")); if(!empty($membergroupids) and $usergroupid == 2){ $ug = explode(',',$membergroupids); $usergroupid = $ug[0]; } list($opentag, $closetag) = mysql_fetch_array(mysql_query("SELECT opentag,closetag FROM usergroup WHERE usergroupid = $usergroupid")); $username = $opentag.$username.$closetag; return $username;}function MTForumBlock($p=1){ global $gtset,$Last_New; $from = $Last_New * ($p-1); $query = mysql_query("SELECT threadid, lastposter , title FROM thread ORDER BY lastpostid DESC LIMIT $from,$Last_New") OR die(mysql_error()); $content .= "<table>\n"; $content .= "<tr class=\"MTForumfirst\">\n"; $content .= "<td class=\"MTForumtitle\">عنوان</td>\n"; $content .= "<td class=\"MTForumanswer\">پاسخ</td>\n"; $content .= "<td class=\"MTForumview\">بازديد</td>\n"; $content .= "<td class=\"MTForumlast\">آخرين ارسال</td>\n"; $content .= "</tr>\n"; while($row=mysql_fetch_assoc($query)) { $title = $row['title']; $lastposter = $row['lastposter']; $threadid = intval($row['threadid']); $query3 = mysql_query("SELECT * FROM thread Where threadid = '$threadid'") OR die(mysql_error()); $row3 = mysql_fetch_assoc($query3) ; $LastReplies = $row3['replycount']; $TopicViews = intval($row3['views']); $TopicPoster = $row3['postuserid']; $query4 = mysql_query("SELECT username, userid FROM user where username='$lastposter'"); list($username, $userid)=mysql_fetch_assoc($query4); if($gtset == "1") { $topicurl = "/forum/showthread.php?threadid=$threadid"; } else { $topicurl = "/forum/showthread.php?threadid=$threadid&goto=newpost"; } $content .= "<tr>\n"; $content .= "<td class=\"MTForumrowtitle\"><a href=\"$topicurl\">« $title</a></td>\n"; $content .= "<td class=\"MTForumanswer\">$LastReplies</td>\n"; $content .= "<td class=\"MTForumview\">$TopicViews</td>\n"; $content .= "<td class=\"MTForumlast\">".UsernameColor($row['lastposter'])."</td>\n"; $content .= "</tr>\n"; } $content .= "</table>\n"; return $content;}switch($_REQUEST['req']){ case "LastTopics": echo MTForumBlock($p); break; default: echo MTForumBlock(); break;}?>حالا کسی میتونه کمک کنه اینو برا IPB اجراش کنم
با آی فریم میشه ولی یه مشکله
اونم این که مطالب ایندکس نمیشه و من میخوام از این طریق مطالب ایندکس بشه
میشه کاری کرد آیا؟