mirror of
				https://github.com/Mibew/i18n.git
				synced 2025-11-01 01:36:57 +03:00 
			
		
		
		
	Prevent generation of negative tokens (see Issue #5)
This commit is contained in:
		
							parent
							
								
									5a93a16303
								
							
						
					
					
						commit
						da1a171fbc
					
				| @ -40,7 +40,14 @@ $kind_to_string = array($kind_user => "user", $kind_agent => "agent", $kind_for_ | ||||
| 
 | ||||
| function next_token() | ||||
| { | ||||
| 	return  function_exists('openssl_random_pseudo_bytes') ? hexdec(bin2hex(openssl_random_pseudo_bytes(4))) : mt_rand(99999, 99999999); | ||||
| 	if (function_exists('openssl_random_pseudo_bytes')) { | ||||
| 		$token_arr = unpack('N', "\x0" . openssl_random_pseudo_bytes(3)); | ||||
| 		$token = $token_arr[1]; | ||||
| 	} | ||||
| 	else { | ||||
| 		$token = mt_rand(99999, 99999999); | ||||
| 	} | ||||
| 	return $token; | ||||
| } | ||||
| 
 | ||||
| function next_revision($link) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user