Hi, Khách!
![]() | ![]() ![]() ![]() ![]() |
Yêu cầu: Wap phải có function màu níck nick() và dùng bbcode tags().
Đầu tiên upload file thongbao.zip tải ở phía dưới lên host trong thư mục users.
Xong giải nén file đó ra ta đc 2 file install.php và thongbao.php.
Chạy http://domain.xxx/users/install.php để cài data. báo "cài đặt thành công " là ok
Giờ ta mở file forum/includes/say.php để mod thông báo trích dẫn bài viết
Mở say.php tìm:
<?php
// Вычисляем, на какую страницу попадает добавляемый пост
$page = $set_forum['upfp' ? 1 : ceil(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 'm' AND `refid` = '$th'" . ($rights >= 7 ? '' : " AND `close` != '1'")), 0) / $kmess);
?>
Copy code
// Вычисляем, на какую страницу попадает добавляемый пост
$page = $set_forum['upfp' ? 1 : ceil(mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type` = 'm' AND `refid` = '$th'" . ($rights >= 7 ? '' : " AND `close` != '1'")), 0) / $kmess);
?>
Copy code
Thêm vào bên trên đoạn code vừa tìm được:
<?php
////mod thong bao trich dan
$tong=mysql_result(mysql_query("select count(*) from forum where refid = '{$th}' and type='m' order by time desc"),0);
$topic=mysql_fetch_array(mysql_query("select * from forum where refid='{$th}' and type='m' order by time asc limit 1"));
$sotrang=ceil($tong/$kmess);
mysql_query("INSERT INTO `thongbao` SET
`id_from`='".$user_id."',
`id_to` = '".$type1['user_id'."',
`hanhdong`='0',
`id_forum`='".$th."',
`text` = '".$sotrang."|".$topic['id'."',
`type`='f',
`time` = '" . time() . "'
");
/////ket thuc thong bao trich dan
?>
Copy code
////mod thong bao trich dan
$tong=mysql_result(mysql_query("select count(*) from forum where refid = '{$th}' and type='m' order by time desc"),0);
$topic=mysql_fetch_array(mysql_query("select * from forum where refid='{$th}' and type='m' order by time asc limit 1"));
$sotrang=ceil($tong/$kmess);
mysql_query("INSERT INTO `thongbao` SET
`id_from`='".$user_id."',
`id_to` = '".$type1['user_id'."',
`hanhdong`='0',
`id_forum`='".$th."',
`text` = '".$sotrang."|".$topic['id'."',
`type`='f',
`time` = '" . time() . "'
");
/////ket thuc thong bao trich dan
?>
Copy code
Thế là xong thông báo phần trích dẫn bài viết
Tiếp đến là thông báo like.
Mở forum/index.php tìm:
<?php
$checkthankdau = mysql_query('SELECT COUNT(*) FROM `forum_thank` WHERE `userthank` = "' . $user_id . '" and `topic` = "' . $_GET['thanks' . '" and `user` = "' . $_GET['user' . '"');
if ($user_id && $user_id != $_GET['user' && (mysql_result($checkthankdau, 0) < 1)) {
if ((isset ($_GET['thank'))&&(isset ($_GET['user'))&&(isset ($_GET['thanks'))) {
?>
Copy code
$checkthankdau = mysql_query('SELECT COUNT(*) FROM `forum_thank` WHERE `userthank` = "' . $user_id . '" and `topic` = "' . $_GET['thanks' . '" and `user` = "' . $_GET['user' . '"');
if ($user_id && $user_id != $_GET['user' && (mysql_result($checkthankdau, 0) < 1)) {
if ((isset ($_GET['thank'))&&(isset ($_GET['user'))&&(isset ($_GET['thanks'))) {
?>
Copy code
Chèn vào ngay bên dưới:
<?php
////mod thong bao like
$tong=mysql_result(mysql_query("select count(*) from forum where refid = '{$_GET['id'}' and type='m' order by time desc"),0);
$sotrang=ceil($tong/$kmess);
mysql_query("INSERT INTO `thongbao` SET
`id_from`='".$user_id."',
`id_to` = '".$_GET['user'."',
`hanhdong`='1',
`id_forum`='".$_GET['id'."',
`text` = '".$sotrang."|".$_GET['thanks'."',
`type`='f',
`time` = '" . time() . "'
");
/////kết thúc thông báo like
?>
Copy code
////mod thong bao like
$tong=mysql_result(mysql_query("select count(*) from forum where refid = '{$_GET['id'}' and type='m' order by time desc"),0);
$sotrang=ceil($tong/$kmess);
mysql_query("INSERT INTO `thongbao` SET
`id_from`='".$user_id."',
`id_to` = '".$_GET['user'."',
`hanhdong`='1',
`id_forum`='".$_GET['id'."',
`text` = '".$sotrang."|".$_GET['thanks'."',
`type`='f',
`time` = '" . time() . "'
");
/////kết thúc thông báo like
?>
Copy code
Vậy là xong! Giờ đến phần hiện thông báo ở head.php
Mở incfiles/head.php chèn vào chỗ thích hợp.
<?php
$thongbao=mysql_result(mysql_query("select count(*) from `thongbao` where `id_to`='{$user_id}' and `type`='f'"),0);
if($thongbao >0)
echo '<div class="phdr"><a href="../users/thongbao.php">Thông báo:<font color="red">'.$thongbao.'</font></a></div>';
?>
Copy code
$thongbao=mysql_result(mysql_query("select count(*) from `thongbao` where `id_to`='{$user_id}' and `type`='f'"),0);
if($thongbao >0)
echo '<div class="phdr"><a href="../users/thongbao.php">Thông báo:<font color="red">'.$thongbao.'</font></a></div>';
?>
Copy code
Thế là xong tất cả rồi nhé,cuối cùng là tải code về thôi
Chúc thành công!
Tải xuống thong-bao.zip (3.79 KB)

![]() | ![]() ![]() ![]() ![]() |
- Yêu cầu mod like trước nhé ace, nếu chạy /users/thongbao.php mà nó ko hiện thông báo thì tìm tags và xóa nó đi nhé. Vd: tags($topic['text') thì sửa thành $topic['text' nhé. Chúc thành công. Test ngon trên johncms 620

Trực Tuyến:
Khách: 1