本帖最后由 eisdl 于 2009-12-8 16:12 编辑
discuz的模板文件都是htm的,这种文件很容易被人下载走
我的这个方法就是把htm的模板文件该名成php,并且在模板的开头都加上<?exit?>
打开global.func.php
找到-
- if($templateid != 1 && !file_exists($tplfile)) {
- $tplfile = DISCUZ_ROOT.'./templates/default/'.$filebak.'.htm';
- }
复制代码 替换
- /*======*/
- if($templateid != 1 && !file_exists($tplfile)) {
- $tplfile = DISCUZ_ROOT.'./'.$tpldir.'/'.$file.'.html.php';
- if(!file_exists($tplfile)){
- $tplfile = DISCUZ_ROOT.'./templates/default/'.$filebak.'.htm';
- }
- }
- /*======*/
复制代码 打开template.func.php
找到
- $basefile = $file = basename($tplfile, '.htm');
复制代码 替换
- /*======*/
- if(strpos($tplfile, '.html.php') === false){
- $suffix='.htm';
- }else{
- $suffix='.html.php';
- }
- $basefile = $file = basename($tplfile, $suffix);
- /*======*/
复制代码 找到
- dexit("Current template file './$tpldir/$file.htm' not found or have no access!");/*======*/
复制代码 替换
- dexit("Current template file './$tpldir/$file'$suffix not found or have no access!");/*======*/
复制代码 找到在上面加
- /*======*/
- $template = str_replace('<?exit?>', '', $template);
- /*======*/
复制代码 若你网站之前从未修改过程序代码并且discuz版本为7.2的可以直接下载附件替换掉源文件 |