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

Check MD5(md5sum for php)

WBOY
WBOY原創
2016-06-13 10:33:052432瀏覽

<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>

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
上一篇:Java基础FAQ下一篇:shell中俄罗斯方块