Reply to hello--please help function hash_file ($strFilename) is now broken in php5

Your name:

Reply:


Posted by opensourcearts on 01/02/08 21:18

hello there,

hash_file means something new in php5, and it seems to of broken my
code:

function hash_file ($strFilename) {
$n = 0;
for ($posFilename = strlen($strFilename) -1; $posFilename >= 0;
$posFilename-- ) {
$n *= 2;
if ($n & 4096) { $n |= 1; }
$n ^= (ord($strFilename[$posFilename])*11);
$n &= 4095;
}

return sprintf ("%02o/%02o", ($n/64) & 63 , $n&63);
}

For now, the error that I get with the above code is just:


PHP Fatal error: Cannot redeclare hash_file()

Is there some way to rewrite the above code, or something to
substitute for hash_file? Thanks!

The original coder also wrote this comment with the code:

// Don't even ask me how this works. Apparently it creates a
register for the filenme
// by xoring the characters into a number from right to left. The
top six bits and the
// bottom six bits are returned as the path name. I didn't write it
though, I just
// converted it from a perl function that I found in the pair
Networks private newsgroups.
// - Jason

Thanks for your help!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация