XtGem Forum catalog
↓↓xuống cuối trang↓↓
Chào mừng bạn đến với wap DinhLoi.XtGem.Com | Chúc bạn có 1 năm mới vui vẻ tốt lành hạnh phúc! Hãy giới thiệu website này cho bạn bè nhé!img
DinhLoi.XtGem.Com =>> CaFe9x.Gq
Bạn đến từ quốc gia:



Hôm nay ngày
25.02.25/20:19
img- Hi. Xin chào! Mozilla/5.0
logo
.
HOMECHÁTTruyệnFORUM
logo

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.
Home · Bang hội ·
* Đăng Nhập hoặc Đăng Kí
để sử dụng hết chức năng của diễn đàn.
Hi, Khách!
HomeBang hội » Wapmaster » JohnCMS » Share Mod Thank To Download Cho JohnCMS
Xuống dưới » Share Mod Thank To Download Cho JohnCMS
avatar by Pham_loi Pham_loi
Chức vụ:
05:20:24, 24-04-2016

Mô tả: Modul khi upload file đính kèm yêu cầu thành viên phải thank (like) bài viết mới có thể tải tập tin đính kèm.
Tác giả: HaiViet
Diễn đàn: Vina4Z.TK

Hướng dẫn sử dụng:
Yêu cầu đã cài đặt mod thank bài viết trước đó.
Upload install.php lên thự mục root và chạy đường dẫn domain.com/install.php

Mở forum/includes/addfiles.php tìm:

<?php
$res3
=mysql_fetch_array($req3);
// Заносим данные в базу
mysql_query("INSERT INTO `cms_forum_files` SET
`cat` = '" 
.$res3['refid' ."',
`subcat` = '" 
.$res2['refid' ."',
`topic` = '" 
.$res['refid' ."',
`post` = ' 
$id',
`time` = '" 
.$res['time' ."',
`filename` = '" 
.mysql_real_escape_string($fname) ."',
`filetype` = ' 
$type'
);
?>

Copy code


Thay thành:


<?php
$chkthank
= isset($_REQUEST['chkthank');
$chkthank= ($chkthank?'1':'0');
// Заносим данные в базу
mysql_query("INSERT INTO `cms_forum_files` SET
`cat` = '" 
.$res3['refid' ."',
`subcat` = '" 
.$res2['refid' ."',
`topic` = '" 
.$res['refid' ."',
`post` = ' 
$id',
`time` = '" 
.$res['time' ."',
`filename` = '" 
.mysql_real_escape_string($fname) ."',
`filetype` = ' 
$type',
`reqthank` = ' 
$chkthank'
);
?>

Copy code


Tìm:


<?php
echo'</p><p><input type="submit" name="submit" value="'.$lng_forum['upload' .'"/></p></form></div>'.
?>

Copy code


Thêm vào bên trên:


<?php
echo'<div class="list1">Yêu cầu Thank bài viết<input type="checkbox" name="chkthank" value="1" /></div>';
?>

Copy code


Mở forum/includes/file.php tìm:


<?php
if (file_exists('../files/forum/attach/'.$res['filename')) {
?>

Copy code


Thêm vào bên dưới:


<?php
if ($fres['reqthank' =='1') {
$resid=mysql_query("SELECT * FROM `forum` WHERE `id` = '$id'");
$checkthank=mysql_query('SELECT COUNT(*) FROM `forum_thank` WHERE `userthank` = "'.$user_id.'" and `topic` = "'.$id.'" and `user` = "'.$resid['user_id' .'"');
$thankcheck=mysql_result($checkthank,0);
if( 
$thankcheck<1&&$user_id!=$resid['user_id') {
require( 
'../incfiles/head.php');
echo 
functions::display_error('Bạn chưa cảm ơn bài viết','<a href="index.php">'.$lng['to_forum' .'</a>');
require( 
'../incfiles/end.php');
exit;
}
}
?>

Copy code


Tìm tiếp:


<?php
header 
('location: ../files/forum/attach/'.$res['filename');
?>

Copy code


Thay thế thành:


<?php
$path
='../files/forum/attach/'.$res['filename';
$infofile=pathinfo($path);
$file_ext=strtolower($infofile['extension');
if( 
$file_ext=='bmp') {
$ftype='image/bmp';
}
if( 
$file_ext=='png') {
$ftype='image/png';
}
if( 
$file_ext=='gif') {
$ftype='image/gif';
}
if( 
$file_ext=='jpg'||$file_ext=='jpeg') {
$ftype='image/jpeg';
}
if( 
$file_ext=='jar') {
$ftype='application/java-archive';
}
if( 
$file_ext=='zip') {
$ftype='application/zip';
}
if( 
$file_ext=='txt') {
$ftype='text/plain';
}
if( 
$file_ext=='rar') {
$ftype='application/x-rar-compressed';
}
if( 
$file_ext=='mp4') {
$ftype='video/mp4';
}
if( 
$file_ext=='3gp') {
$ftype='video/3gpp';
}
if( 
$file_ext=='exe') {
$ftype='application/octet-stream';
}
header ('Cache-Control: public');
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename=JohnMCSVN-'.$res['filename');
header('Content-type: '.$ftype);
header('Content-Transfer-Encoding: binary');
readfile($path);
exit;
?>

Copy code


Mở forum/index.php tìm:


<?php
echo '<br /><a href="index.php?act=file&amp;id='.$fres['id' .'">'.$fres['filename' .'</a>';
?>

Copy code


Thay thành:

<?php
if ($fres['reqthank' =='1') {
$checkthank=mysql_query('SELECT COUNT(*) FROM `forum_thank` WHERE `userthank` = "'.$user_id.'" and `topic` = "'.$res['id' .'" and `user` = "'.$res['user_id' .'"');
$thankcheck=mysql_result($checkthank,0);
if( 
$thankcheck<1&&$user_id!=$res['user_id') {
echo 
'Yêu cầu phải thank bài viết';
} else {
echo 
'<a href="index.php?act=file&amp;id='.$fres['id' .'">'.$fres['filename' .'</a>';
}
}
?>

Copy code


Tạo file .htaccess vào thư mục /files/forum/attach

Thêm vào:
Order Deny,Allow
Deny from all

Copy code


Thế là xong, chúc thành công! :D
like-to-download-johncms.zip


↓ Tập tin đính kèm ↓


Vui lòng Đăng Nhập để có thể tải file
like-to-download-johncms.zip
Thể loại: application/zip
Dung lượng: 2.08KB


Chỉnh sửa lúc 2016-04-24 05:26 bởi Pham_loi
Like: 0
Lên trên  Tổng số: 1







Trực Tuyến: Khách: 1
Diễn đàn teen Việt Nam
CopyRight 2014
Tag:
Bạn đến từ:
Share: img img img img img

Thanks To:XtGem
Liên kết:U-ON