Index: trunk/globals.php =================================================================== diff -u -r1016 -r1020 --- trunk/globals.php (.../globals.php) (revision 1016) +++ trunk/globals.php (.../globals.php) (revision 1020) @@ -1635,8 +1635,39 @@ return defined('DEBUG_MODE') && constant('DEBUG_MODE') == 1 ? 1 : 0; } +/** + * Two strings in-case-sensitive compare. + * Returns >0, when string1 > string2, + * <0, when string1 > string2, + * 0, when string1 = string2 + * + * @param string $string1 + * @param string $string2 + * @return int + */ function stricmp ($string1, $string2) { return strcmp(strtolower($string1), strtolower($string2)); } +/** + * Generates unique code + * + * @return string + */ +function GenerateCode() +{ + list($usec, $sec) = explode(" ",microtime()); + + $id_part_1 = substr($usec, 4, 4); + $id_part_2 = mt_rand(1,9); + $id_part_3 = substr($sec, 6, 4); + $digit_one = substr($id_part_1, 0, 1); + if ($digit_one == 0) { + $digit_one = mt_rand(1,9); + $id_part_1 = ereg_replace("^0","",$id_part_1); + $id_part_1=$digit_one.$id_part_1; + } + return $id_part_1.$id_part_2.$id_part_3; +} + ?>