Kryptix Posted December 9, 2009 Share Posted December 9, 2009 function encode_username($username) { $username = strtolower($username); $clean = ''; for($i = 0;$i < strlen($username);$i++) { $c = ord($username{$i}); if($c >= 97 && $c <= 122) { $clean .= chr($c); } else if($c >= 48 && $c <= 57) { $clean .= chr($c); } else { $clean .= ' '; } } $clean = trim($clean); if(strlen($clean) > 12) { $clean = substr($clean, 0, 12); } $hash = '0'; for($i = 0;$i < strlen($clean);$i++) { $c = ord($clean{$i}); $hash = bcmul($hash, 37); if($c >= 97 && $c <= 122) { $hash = bcadd($hash, (1 + $c) - 97); } else if($c >= 48 && $c <= 57) { $hash = bcadd($hash, (27 + $c) - 48); } } return $hash; } If Apache has been started for (around) a day the following function causes the script to time out. If I restart Apache it works perfectly. Sometimes it takes 2-3 days to 'break' and other times it's just 1 day. Has anyone got any ideas? It's really starting to get annoying. Link to comment https://forums.phpfreaks.com/topic/184479-hashing-process-times-out-if-apache-has-been-on-for-24-hours/ Share on other sites More sharing options...
Kryptix Posted December 15, 2009 Author Share Posted December 15, 2009 Yeah, I didn't think anyone would know. Link to comment https://forums.phpfreaks.com/topic/184479-hashing-process-times-out-if-apache-has-been-on-for-24-hours/#findComment-977572 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.