Hi, Khách!

![]() | ![]() ![]() ![]() ![]() |
Tác giả: Inuyasha
Yêu cầu:
Sử dụng mod thông báo này:
Mod thông báo cho JohnCMS bản mới
Áp dụng với wap dùng tags(). Đối với wap dùng bbcode::tags() thì cũng làm tương tự.
Bắt đầu thôi:
Mở users/thongbao.php tìm:
Thay lại thành:
Lưu file đó lại.
Mở file incfiles/bbcode.php chèn vào ngay dưới:
Code sau:
<?php
function tagtv($var){
$db=mysql_fetch_array(mysql_query("select * from users where name='{$var}'"));
if(mysql_num_rows(mysql_query("select * from users where name='{$var}'"))==0){
$ra='@'.$var.'';
} else {
$ra='@<a href="../users/profile.php?user='.$db['id'.'">'.$var.'</a>';
}
return $ra;
}
?>
Copy code
function tagtv($var){
$db=mysql_fetch_array(mysql_query("select * from users where name='{$var}'"));
if(mysql_num_rows(mysql_query("select * from users where name='{$var}'"))==0){
$ra='@'.$var.'';
} else {
$ra='@<a href="../users/profile.php?user='.$db['id'.'">'.$var.'</a>';
}
return $ra;
}
?>
Copy code
Sau đó tìm tiếp:
Chèn vào ngay phía dưới:
<?php
$var = preg_replace(array ('#@([\w\d{2,})#se'), array ("''.tagtv('$1').''"), str_replace("\n", "", $var));
?>
Copy code
$var = preg_replace(array ('#@([\w\d{2,})#se'), array ("''.tagtv('$1').''"), str_replace("\n", "", $var));
?>
Copy code
lưu lại.
Cuối cùng mở forum/includes/say.php tìm:
Ra 2 kết quả giống nhau, ta thêm vào ngay bên dưới cả 2 chỗ tìm đc:
Xong tìm tiếp:
Cũng sẽ ra 2 kết quả ta thêm vào ngay bên trên kết quả tìm đc thứ nhất đoạn code sau:
<?php
///mod tag thanh vien
if(preg_match('#@([\w\d{2,})#si',$tagtv)){
preg_match_all('#@([\w\d{2,})#si',$tagtv,$arr);
foreach($arr[1 as $tag){
$db=mysql_fetch_array(mysql_query("select * from users where name='{$tag}'"));
if(mysql_num_rows(mysql_query("select * from users where name='{$tag}'"))==0 || $db['id'==$user_id){
} else {
mysql_query("INSERT INTO `thongbao` SET
`id_from`='".$user_id."',
`id_to` = '".$db['id'."',
`hanhdong`='2',
`id_forum`='".$id."',
`text` = '".$_GET['page'."|',
`type`='f',
`time` = '" . time() . "'
");
}
}
}
///ket thuc mod tag thanh vien
?>
Copy code
///mod tag thanh vien
if(preg_match('#@([\w\d{2,})#si',$tagtv)){
preg_match_all('#@([\w\d{2,})#si',$tagtv,$arr);
foreach($arr[1 as $tag){
$db=mysql_fetch_array(mysql_query("select * from users where name='{$tag}'"));
if(mysql_num_rows(mysql_query("select * from users where name='{$tag}'"))==0 || $db['id'==$user_id){
} else {
mysql_query("INSERT INTO `thongbao` SET
`id_from`='".$user_id."',
`id_to` = '".$db['id'."',
`hanhdong`='2',
`id_forum`='".$id."',
`text` = '".$_GET['page'."|',
`type`='f',
`time` = '" . time() . "'
");
}
}
}
///ket thuc mod tag thanh vien
?>
Copy code
Tiếp ta thêm vào ngay bên trên kết quả tìm đc thứ hai đoạn code sau:
<?php
///mod tag thanh vien
if(preg_match('#@([\w\d{2,})#si',$tagtv)){
preg_match_all('#@([\w\d{2,})#si',$tagtv,$arr);
foreach($arr[1 as $tag){
$db=mysql_fetch_array(mysql_query("select * from users where name='{$tag}'"));
if(mysql_num_rows(mysql_query("select * from users where name='{$tag}'"))==0 || $db['id'==$user_id){
} else {
$sobai=mysql_result(mysql_query("select count(*) from forum where refid = '{$th}' and type='m' order by time desc"),0);
$sopage=ceil($sobai/$kmess);
mysql_query("INSERT INTO `thongbao` SET
`id_from`='".$user_id."',
`id_to` = '".$db['id'."',
`hanhdong`='2',
`id_forum`='".$th."',
`text` = '".$sopage."|',
`type`='f',
`time` = '" . time() . "'
");
}
}
}
///ket thuc mod tag thanh vien
?>
Copy code
///mod tag thanh vien
if(preg_match('#@([\w\d{2,})#si',$tagtv)){
preg_match_all('#@([\w\d{2,})#si',$tagtv,$arr);
foreach($arr[1 as $tag){
$db=mysql_fetch_array(mysql_query("select * from users where name='{$tag}'"));
if(mysql_num_rows(mysql_query("select * from users where name='{$tag}'"))==0 || $db['id'==$user_id){
} else {
$sobai=mysql_result(mysql_query("select count(*) from forum where refid = '{$th}' and type='m' order by time desc"),0);
$sopage=ceil($sobai/$kmess);
mysql_query("INSERT INTO `thongbao` SET
`id_from`='".$user_id."',
`id_to` = '".$db['id'."',
`hanhdong`='2',
`id_forum`='".$th."',
`text` = '".$sopage."|',
`type`='f',
`time` = '" . time() . "'
");
}
}
}
///ket thuc mod tag thanh vien
?>
Copy code
Xong.
Chúc thành công!

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