
Chatbox|Admin nhận làm wap/web, giá cả thương lượng... Thông tin admin tại mỗi bài viết.
Hi, Khách!
![]() | ![]() ![]() ![]() ![]() |
Đây là hàm (function) hiển thị nick thành viên cho JohnCMS bao gồm:
+Màu nick
+Nick bị band
Các bạn tạo file mang tên func.php (Nếu chưa có thì tạo) rồi dán code sau vào:
<?php
function nick($id, $mod = false) {
$ban = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_ban_users` WHERE `user_id` = '" . $id . "' AND `ban_time` > '" . time() . "'"), 0);
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $id . "'"));
if($ban > 0) {
$out .= '<font color="black">'.($mod == 1 ? '<small>' : '<b>').'<s>' . $user['name' . '</s>'.($mod == 1 ? '</small>' : '</b>').'</font>';
} else {
if($user['rights' > 1) {
if($user['rights' == 3) {$font = '<font color="green">';}
if($user['rights' > 3) {$font = '<font color="red">';}
if($user['rights' == 6) {$font = '<font color="#993399">';}
if($user['rights' == 7) {$font = '<font color="gold">';}
if($user['rights' == 9) {$font = '<font color="red">';}
if($user['rights' == 10) {$font = '<font color="#7192a8">';}
$out .= ''.$font.'' . $user['name' . '</font>';
} else {
$out .= '<font color="blue">' . $user['name' . '</font>';
}
}
return $out;
}
?>
Copy code
function nick($id, $mod = false) {
$ban = mysql_result(mysql_query("SELECT COUNT(*) FROM `cms_ban_users` WHERE `user_id` = '" . $id . "' AND `ban_time` > '" . time() . "'"), 0);
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $id . "'"));
if($ban > 0) {
$out .= '<font color="black">'.($mod == 1 ? '<small>' : '<b>').'<s>' . $user['name' . '</s>'.($mod == 1 ? '</small>' : '</b>').'</font>';
} else {
if($user['rights' > 1) {
if($user['rights' == 3) {$font = '<font color="green">';}
if($user['rights' > 3) {$font = '<font color="red">';}
if($user['rights' == 6) {$font = '<font color="#993399">';}
if($user['rights' == 7) {$font = '<font color="gold">';}
if($user['rights' == 9) {$font = '<font color="red">';}
if($user['rights' == 10) {$font = '<font color="#7192a8">';}
$out .= ''.$font.'' . $user['name' . '</font>';
} else {
$out .= '<font color="blue">' . $user['name' . '</font>';
}
}
return $out;
}
?>
Copy code
Các bạn up func.php lên thư mục incfiles
Tiếp theo mở file incfiles/core.php và dán đoạn sau vào dưới cùng:
Xong!
Hướng dẫn sử dụng trước khi dùng:
Các bạn sẽ phải chỉnh sửa forum/file index.php, function.php
Cách dùng:
Tìm
$res['from'
(Trong forum)
Thay bằng:
nick($res['user_id')
hầu như là thay from thành user_id và thêm hàm nick() ở trước và name thành id.
Nguồn: NhanhNao
Chỉnh sửa lúc 2016-04-21 23:55 bởi Pham_loi

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