可以采用机器(电脑)唯一码 + 上传IP + 当前时间戳 + GUID ( + 随机数),然后MD5做为文件名。机器唯一码有电脑的CPU信息和MAC地址,这两个信息需要在linux或unix系统下才能获取吧。
//获取电脑的CPU信息
function OnlyU(){
$a = '';
$b = array();
if(function_exists('exec')){
if(mailto:!@exec( /all",$b)){
return false;
}
}elseif(function_exists('system')){
ob_start();
if(mailto:!@system( /all")){
return false;
}else{
}
$b = ob_get_contents();
ob_end_clean();
$b = explode("\n",$b);//print_r($b);
array_pop($b);
}else{
return false;
}
$all = sizeof($b);
for($i = 0; $i < $all; $i++){
if(strpos($b[$i],"Description") !== false){
if(strpos($b[$i+1],"Physical Address") !== false){
$c = explode(":",$b[$i+1]);
$a = trim($c[1]);
break;
}
}
} // End for
return empty($a)?false:$a;
} // End function OnlyU
//获取网卡的MAC的地址
function getMAC() {
@exec("ipconfig /all",$array);
for($Tmpa;$Tmpa<count($array);$Tmpa++){
if(eregi("Physical",$array[$Tmpa])){
$mac=explode(":",$array[$Tmpa]);
return $mac[1];
}
}
}
// 生成guid字符串
function guid($separated = true) {
if (function_exists ( 'com_create_guid' )) {
$charid = substr ( strtolower ( com_create_guid () ), 1, - 1 );
if (! $separated)
return str_replace ( '-', '', $charid );
else
return $charid;
} else {
// 生成一个随机的md5串, 然后通过分割来 获得guid
mt_srand ( ( double ) microtime () * 10000 );
$charid = md5 ( uniqid ( rand (), true ) );
}
if (! $separated) {
return $charid;
}
$hyphen = chr ( 45 );
$uuid = substr ( $charid, 0, 8 ) . $hyphen . substr ( $charid, 8, 4 ) . $hyphen . substr ( $charid, 12, 4 ) . $hyphen . substr ( $charid, 16, 4 ) . $hyphen . substr ( $charid, 20, 12 );
return $uuid;
}