盗版猖獗,必须在资源上留下来源及版权,这样在别人转发、出售你的资源并且没经过编辑时,就会露出马脚。在文件打开后能查到我们留的相关信息。我是以wordpress做示例,大家看着改:
1、伪静态
需要将文件上传目录伪静态到新的PHP脚本进行数据处理:
# BEGIN WordPress# 在“BEGIN WordPress”与“END WordPress”之间的指令(行)是# 动态生成的,只应被WordPress过滤器修改。# 任何对标记之间的指令的修改都会被覆盖。<IfModule mod_rewrite.c>RewriteEngine OnRewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]RewriteBase /ziyuan/RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /ziyuan/index.php [L]# 下载重定向,并在下载时处理一些事情RewriteRule ^wp-content/uploads/(.*)?$ down/down.php?file= [L]</IfModule># END WordPress# BEGIN WordPress # 在“BEGIN WordPress”与“END WordPress”之间的指令(行)是 # 动态生成的,只应被WordPress过滤器修改。 # 任何对标记之间的指令的修改都会被覆盖。 <IfModule mod_rewrite.c> RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase /ziyuan/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /ziyuan/index.php [L] # 下载重定向,并在下载时处理一些事情 RewriteRule ^wp-content/uploads/(.*)?$ down/down.php?file= [L] </IfModule> # END WordPress# BEGIN WordPress # 在“BEGIN WordPress”与“END WordPress”之间的指令(行)是 # 动态生成的,只应被WordPress过滤器修改。 # 任何对标记之间的指令的修改都会被覆盖。 <IfModule mod_rewrite.c> RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase /ziyuan/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /ziyuan/index.php [L] # 下载重定向,并在下载时处理一些事情 RewriteRule ^wp-content/uploads/(.*)?$ down/down.php?file= [L] </IfModule> # END WordPress
2、PHP文件
<?phpfunction download_document($filename,$path="",$mimetype){header("Cache-Control: must-revalidate, post-check=0, pre-check=0");header("Content-Disposition: attachment; filename = $filename");header("Content-Length: " . filesize($pathto . $filename));header("Content-Type: $mimetype");echo file_get_contents($pathto . $filename)."\r\n"."文曦博客"."\r\n".time();}$filename = "H:/wwwroot/127.0.0.1/ziyuan/wp-content/uploads/".$_REQUEST['file'];$type = mime_content_type($filename);download_document($filename,$path="",$type);?><?php function download_document($filename,$path="",$mimetype) { header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Disposition: attachment; filename = $filename"); header("Content-Length: " . filesize($pathto . $filename)); header("Content-Type: $mimetype"); echo file_get_contents($pathto . $filename)."\r\n"."文曦博客"."\r\n".time(); } $filename = "H:/wwwroot/127.0.0.1/ziyuan/wp-content/uploads/".$_REQUEST['file']; $type = mime_content_type($filename); download_document($filename,$path="",$type); ?><?php function download_document($filename,$path="",$mimetype) { header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Disposition: attachment; filename = $filename"); header("Content-Length: " . filesize($pathto . $filename)); header("Content-Type: $mimetype"); echo file_get_contents($pathto . $filename)."\r\n"."文曦博客"."\r\n".time(); } $filename = "H:/wwwroot/127.0.0.1/ziyuan/wp-content/uploads/".$_REQUEST['file']; $type = mime_content_type($filename); download_document($filename,$path="",$type); ?>
3、文件路径

下载的图片查看留的信息示例:

图片是正常预览的,如果是文本,会在后面追加文本

© 版权声明
THE END
暂无评论内容