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

Check MD5(md5sum for php)

WBOY
Freigeben: 2016-06-13 10:33:05
Original
2435 Leute haben es durchsucht

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

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Empfehlungen
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage