here is a not very well tested function:
function generate()
{
global $SERVER_ADDR;
// get the current ip, and convert it to its positive long value
$long_ip = ip2long($SERVER_ADDR);
if($long_ip < 0) $long_ip += pow(2,32);
// get the current microtime and make sure it's a positive
// long value
$time = microtime();
if($time < 0)
{
$time += pow(2,32);
}
// put those strings together
$combined = $long_ip . $time;
// md5 it and throw in some dashes for easy checking
$guid = md5($combined);
$guid = substr($guid, 0, 8) . "-" .
substr($guid, 8, 4) . "-" .
substr($guid, 12, 4) . "-" .
substr($guid, 16, 4) . "-" .
substr($guid, 20);
return $guid;
}