Jump to content

Hashing process times out if Apache has been on for 24+ hours


Kryptix

Recommended Posts

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.