10:16 / 07.03.2016 | #1 |
![]() | ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Share mod Thank to Download cho JohnCMS
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: Ovigame.Me
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:
''.highlight('$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'
" );').''
Thay thành:
''.highlight('$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'
" );').''
Tìm:
''.highlight('echo'</p><p><input type="submit" name="submit" value="'.$lng_forum['upload'] .'"/></p></form></div>'.
').''
Thêm vào bên trên:
''.highlight('echo'<div class="list1">Yêu cầu Thank bài viết<input type="checkbox" name="chkthank" value="1" /></div>';').''
Mở forum/includes/file.php tìm:
''.highlight('if (file_exists('../files/forum/attach/'.$res['filename'])) {
').''
Thêm vào bên dưới:
''.highlight('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;
}
}').''
Tìm tiếp:
''.highlight('header ('location: ../files/forum/attach/'.$res['filename']);').''
Thay thế thành:
''.highlight('$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;
').''
Mở forum/index.php tìm:
''.highlight('echo '<br /><a href="index.php?act=file&id='.$fres['id'] .'">'.$fres['filename'] .'</a>';').''
Thay thành:
''.highlight('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&id='.$fres['id'] .'">'.$fres['filename'] .'</a>';
}
}').''
Tạo file .htaccess vào thư mục /files/forum/attach
Thêm vào:
''.highlight('Order Deny,Allow
Deny from all').''
Thế là xong, chúc thành công!
Đã chỉnh sửa. Admin (10:38 / 07.03.2016) [1]
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: Ovigame.Me
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:
''.highlight('$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'
" );').''
Thay thành:
''.highlight('$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'
" );').''
Tìm:
''.highlight('echo'</p><p><input type="submit" name="submit" value="'.$lng_forum['upload'] .'"/></p></form></div>'.
').''
Thêm vào bên trên:
''.highlight('echo'<div class="list1">Yêu cầu Thank bài viết<input type="checkbox" name="chkthank" value="1" /></div>';').''
Mở forum/includes/file.php tìm:
''.highlight('if (file_exists('../files/forum/attach/'.$res['filename'])) {
').''
Thêm vào bên dưới:
''.highlight('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;
}
}').''
Tìm tiếp:
''.highlight('header ('location: ../files/forum/attach/'.$res['filename']);').''
Thay thế thành:
''.highlight('$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;
').''
Mở forum/index.php tìm:
''.highlight('echo '<br /><a href="index.php?act=file&id='.$fres['id'] .'">'.$fres['filename'] .'</a>';').''
Thay thành:
''.highlight('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&id='.$fres['id'] .'">'.$fres['filename'] .'</a>';
}
}').''
Tạo file .htaccess vào thư mục /files/forum/attach
Thêm vào:
''.highlight('Order Deny,Allow
Deny from all').''
Thế là xong, chúc thành công!
Đã chỉnh sửa. Admin (10:38 / 07.03.2016) [1]
Bạn cần phải Đăng nhập để có thể tải file
[Like 16]:
NTHpro, zolo3, tamhoangdk, aahappyaa,
Vuonghh1998, thaycungak, hoichemgio9x, Nice, MrLoc, DuyPlus, KenBiii, LTHH, ![vip](/images/vip2.png)
BoyHN, MVP, elvin97, lililil, thích bài này!
![vip](/images/vip1.png)
![vip](/images/vip1.png)
![vip](/images/vip2.png)
![pro](/images/pro.png)
Các thánh hãy cẩn thận
10:38 / 07.03.2016 | #2 |
![]() | ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Loằng ngoằng chả hiểu gì
Thành viên mới
16:06 / 20.04.2016 | #3 |
![]() | ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Bó tay @chấmcom
Mấy thằng kêu tên ta kẩn thận ta chém chết bây jờ
16:50 / 20.04.2016 | #4 |
![]() | ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![image image](/images/quote_icon.gif)
Bó tay @chấmcom
Mà có biết gì về wap/web đâu mà hiểu
Nhận cày thuê rank,level truy kích uy tín, giá rẻ
Nhận bán hộ nick truy kích, ai muốn mua nick truy kích pm
Nhận bán hộ nick truy kích, ai muốn mua nick truy kích pm
12:27 / 21.04.2016 | #5 |
![]() | ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![image image](/images/quote_icon.gif)
Không được đào top em ơi
Mà có biết gì về wap/web đâu mà hiểu
Mấy thằng kêu tên ta kẩn thận ta chém chết bây jờ
Bạn cần phải Đăng nhập để có thể tham gia bình luận!