Welcome Guest, Not a member yet? Register   Sign In
Problems with captcha due to microtime() php funcion
#2

[eluser]Ravnock[/eluser]
Hi again,

I think the problem is solved. I have used mt_rand funcion to generate $usec and $sec variables that uses the captcha instead microtime(). I don't know if I will have collateral problems because captcha save in $now variable the current date using $usec and $sec. It can be a temporal solution for people with the same problem.



The code (it's a bit faster than before!:

$usec = mt_rand(0,99999999);
$usec = $usec/ 100000000;
$sec = mt_rand(0,9999999999);
//Old version
//list($usec, $sec) = explode(" ", microtime());

$now = ((float)$usec + (float)$sec);


We can also detect when $usec and $sec are not setted and in this case use mt_rand


Messages In This Thread
Problems with captcha due to microtime() php funcion - by El Forum - 01-11-2008, 04:10 AM
Problems with captcha due to microtime() php funcion - by El Forum - 01-11-2008, 04:27 AM
Problems with captcha due to microtime() php funcion - by El Forum - 01-11-2008, 04:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB