Code tự động cập nhật tin tức từ diễn đàn ra trang chủ
Bạn tạo file getnews.php ngang hàng file index.php với nội dung là
Với code trên bạn có thể làm nhiều mục bài viết mới khác, vd[/url]
[/url]
Bạn tạo file getnews.php ngang hàng file index.php với nội dung là
- Code:
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('CSRF_PROTECTION', true);
require_once('./global.php');
echo $stylevar[htmldoctype];
echo "";
echo "";
echo "
body
{
background: #ffffff;
color: #000000;
font: 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
margin: 0px;
padding: 6px;
}
a:link
{
color: red;
text-decoration: none;
}
";
echo "";
echo "";
// #################### Lay Bai Moi #######################
if ($_REQUEST['do'] == 'thongbao')
{
$ketqua = 10;
$boxid = '2,3';
$latestpostq = $vbulletin->db->query_read("SELECT threadid,title FROM ". TABLE_PREFIX ."thread WHERE forumid IN ($boxid) AND visible = 1 ORDER BY dateline DESC LIMIT $ketqua");
while ($latestpost = $vbulletin->db->fetch_array($latestpostq))
{
echo "
[url=http://domain.com/showthread.php?t=%22.$latestpost[]".$latestpost['title']."[/url][url=http://domain.com/showthread.php?t=%22.$latestpost[]";
}
}
echo "";
echo "";
?>
$ketqua = 10; // SO luong bai moi
$boxid = '2,3'; // Id cac' box
Với code trên bạn có thể làm nhiều mục bài viết mới khác, vd[/url]
- Code:
[url=http://domain.com/showthread.php?t=%22.$latestpost[]// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('CSRF_PROTECTION', true);
require_once('./global.php');
echo $stylevar[htmldoctype];
echo "";
echo "";
echo "
body
{
background: #ffffff;
color: #000000;
font: 10pt verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
margin: 0px;
padding: 6px;
}
a:link
{
color: red;
text-decoration: none;
}
";
echo "";
echo "";
// #################### Thong Bao #######################
if ($_REQUEST['do'] == 'thongbao')
{
$ketqua = 10;
$boxid = '2,3';
$latestpostq = $vbulletin->db->query_read("SELECT threadid,title FROM ". TABLE_PREFIX ."thread WHERE forumid IN ($boxid) AND visible = 1 ORDER BY dateline DESC LIMIT $ketqua");
while ($latestpost = $vbulletin->db->fetch_array($latestpostq))
{
echo "[/url]
[url=http://domain.com/showthread.php?t=%22.$latestpost[]".$latestpost['title']."[/url][url=http://domain.com/showthread.php?t=%22.$latestpost[]";
}
}
// #################### Thong Bao #######################
if ($_REQUEST['do'] == 'congnghethongtin')
{
$ketqua = 20;
$boxid = '6,7';
$latestpostq = $vbulletin->db->query_read("SELECT threadid,title FROM ". TABLE_PREFIX ."thread WHERE forumid IN ($boxid) AND visible = 1 ORDER BY dateline DESC LIMIT $ketqua");
while ($latestpost = $vbulletin->db->fetch_array($latestpostq))
{
echo "[/url]
[url=http://domain.com/showthread.php?t=%22.$latestpost[]".$latestpost['title']."[/url][url=http://domain.com/showthread.php?t=%22.$latestpost[]";
}
}
echo "";
echo "";
?>
[/url]