首页 > php教程 > php手册 > Check MD5(md5sum for php)

Check MD5(md5sum for php)

WBOY
发布: 2016-06-13 10:33:05
原创
2435 人浏览过

<span style="COLOR: #000000"><span style="COLOR: #0000bb"></span><span style="COLOR: #007700"></span><span style="COLOR: #0000bb"><u><font color="#336699">php</font></u><br></span><span style="COLOR: #ff8000">/******************************************************************<br>Check MD5(md5sum for <u><font color="#336699">php</font></u>)<br>2008-11-09<br>amxku.net<br><br><br>校验文件的准确性.<br>在网站被入侵后,检查文件的准确性。<br><br><br>*UIX下可以用md5sum * >md5sum 来得到所有文件的md5值,然后把两次得到的<br>MD5值来进行对比。<br><br><br>在<u><font color="#336699">代码</font></u>检查方面那么有一丁点用处,别的没什么用。<br>******************************************************************/<br></span><span style="COLOR: #007700">echo </span><span style="COLOR: #dd0000"><meta></span><span style="COLOR: #007700">;<br>echo </span><span style="COLOR: #dd0000"><title>Check MD5(md5sum for <u><font color="#336699">php</font></u>)</title></span><span style="COLOR: #007700">;<br></span><span style="COLOR: #0000bb">check_md5</span><span style="COLOR: #007700">(</span><span style="COLOR: #dd0000">"."</span><span style="COLOR: #007700">);<br><br><br>function </span><span style="COLOR: #0000bb">check_md5</span><span style="COLOR: #007700">(</span><span style="COLOR: #0000bb">$directory</span><span style="COLOR: #007700">){<br>    </span><span style="COLOR: #0000bb">$check_md5_dir </span><span style="COLOR: #007700">= @</span><span style="COLOR: #0000bb">opendir</span><span style="COLOR: #007700">(</span><span style="COLOR: #0000bb">$directory</span><span style="COLOR: #007700">);<br>    echo </span><span style="COLOR: #dd0000"><ul></ul></span><span style="COLOR: #007700">;<br>    while (</span><span style="COLOR: #0000bb">$file </span><span style="COLOR: #007700">= @</span><span style="COLOR: #0000bb">readdir</span><span style="COLOR: #007700">(</span><span style="COLOR: #0000bb">$check_md5_dir</span><span style="COLOR: #007700">)) {<br>    if (</span><span style="COLOR: #0000bb">$file </span><span style="COLOR: #007700">!= </span><span style="COLOR: #dd0000">"." </span><span style="COLOR: #007700">&& </span><span style="COLOR: #0000bb">$file </span><span style="COLOR: #007700">!= </span><span style="COLOR: #dd0000">".."</span><span style="COLOR: #007700">) {<br>    if(</span><span style="COLOR: #0000bb">is_dir</span><span style="COLOR: #007700">(</span><span style="COLOR: #dd0000">"$directory/$file"</span><span style="COLOR: #007700">)){<br>        echo </span><span style="COLOR: #dd0000"><li><strong></strong></li></span><span style="COLOR: #007700">.</span><span style="COLOR: #0000bb">$file</span><span style="COLOR: #007700">.</span><span style="COLOR: #dd0000"></span><span style="COLOR: #007700">;<br>        </span><span style="COLOR: #0000bb">tree</span><span style="COLOR: #007700">(</span><span style="COLOR: #dd0000">"$directory/$file"</span><span style="COLOR: #007700">);<br>    }else{<br>        echo </span><span style="COLOR: #dd0000"><li></span><span style="COLOR: #007700">.</span><span style="COLOR: #0000bb">$file</span><span style="COLOR: #007700">.</span><span style="COLOR: #dd0000"> ==> </span><span style="COLOR: #007700">.</span><span style="COLOR: #0000bb">md5_file</span><span style="COLOR: #007700">(</span><span style="COLOR: #dd0000">"$directory/$file"</span><span style="COLOR: #007700">).</span><span style="COLOR: #dd0000"></span><span style="COLOR: #007700">;<br>    }<br>    }<br>    }<br>    echo </span><span style="COLOR: #dd0000"></span><span style="COLOR: #007700">;<br>    </span><span style="COLOR: #0000bb">closedir</span><span style="COLOR: #007700">(</span><span style="COLOR: #0000bb">$check_md5_dir</span><span style="COLOR: #007700">);<br>}<br></span><span style="COLOR: #0000bb">?></span></span>

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板