Jump to content
php.lv forumi

CRC


Sephy

Recommended Posts

varbut kadam ir gatavs scripts kludu notiekshanai un izlaboshanai ar CRC metodem? Ja nav iedodiet kadu lapu kur paskaidrots kaa shis scripts javeido jo es google atradu tikai prieksh c++....

Edited by Sephy
Link to comment
Share on other sites

Njaa es vakar skatijos un neko kas labo nevar atrast. Ir tikai kas parbauda vai ir kadas kludas, bet taas kludas nelabo. Ir kada laba metode ar kuru var atrast kludas un taas izlabot?!

 

edit:

piemeram man ir kautkads word dokuments un saglabashu sev kodu ar kautko lidzigu crc32() failaa. ja velak atklajas kadas nevelamas parmainas vinsh automatiski parmaina to kodu un tadejadi arii manu dokumentu atpakal ;P

Edited by Sephy
Link to comment
Share on other sites

Ir taka majaslapa kur lietotajs var uplaod kautkadu dokumentu(piemeram word.doc). tad to word doc parveido ar crc32() un noglaba tekst faila! pec tam es uztaisit taka kopiju un noglabat kautkur uz sava servaka(to teksta failu ar kodu). velak varu salidzinat vai tas user fails ir vienads ar to manu kopijas failu(kodu nolasa no vina)(es gan nezinu kapec to user dokumentu kads var izmainit ;D) un ja nav vienads tad ar to kodu uztaisa vienadu....

Edited by Sephy
Link to comment
Share on other sites

Ko nozīmē "uztaisa vienādu" ? Cik saprotu, tad tev vienkārši vajag, lai, ja ir mainījies faila saturs uz servera, tad tas tiktu atjaunots no tavas kopijas ? Nu tad tev nevajag Version controllingu, bet pietiks ar to pašu crc32 vai md5.

Link to comment
Share on other sites

nwm atrisinaju savas problemas ar sito:

 

<?php
$chkfilename = "myfile.xxx";
$chkmd5return = md5_file($chkfilename);
if ($chkmd5return != "myfile.xxx's md5 value") {
    echo "You have replaced myfile.xxx with an unknown version of the file, please replace the original file.";
} else {
    (your code to be executed, now that it has confirmed your myfile.xxx has been unmodified)
}
?>

 

useris pats vainigs ka maina failus ;D. varbut velak izdomashu kaa ((echo "You have replaced myfile.xxx with an unknown version of the file, please replace the original file.";)) vietaa uzlikt automatiski orginalo failu ;P. man tieshi bija vajadzigs lai ja usera fails neatbilst mana faila kodam tad visnh automatiksi nomainaas....

Edited by Sephy
Link to comment
Share on other sites

×
×
  • Create New...