mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
Some changes.
This commit is contained in:
parent
20c16068ec
commit
d6cc8415dc
30 changed files with 359 additions and 106 deletions
|
|
@ -30,6 +30,33 @@ class Utils{
|
|||
public static function isOnline(){
|
||||
return ((@fsockopen("google.com", 80, $e = null, $n = null, 2) !== false or @fsockopen("www.linux.org", 80, $e = null, $n = null, 2) !== false or @fsockopen("www.php.net", 80, $e = null, $n = null, 2) !== false) ? true:false);
|
||||
}
|
||||
|
||||
public static function getUniqueID($raw = false, $extra = ""){
|
||||
$machine = php_uname("a");
|
||||
$machine .= file_exists("/proc/cpuinfo") ? file_get_contents("/proc/cpuinfo") : "";
|
||||
$machine .= sys_get_temp_dir();
|
||||
$machine .= $extra;
|
||||
if(Utils::getOS() == "win"){
|
||||
exec("ipconfig /ALL", $mac);
|
||||
$mac = implode("\n", $mac);
|
||||
if(preg_match_all("#Physical Address[. ]{1,}: ([0-9A-F\-]{17})#", $mac, $matches)){
|
||||
foreach($matches[1] as $i => $v){
|
||||
if($v == "00-00-00-00-00-00"){
|
||||
unset($matches[1][$i]);
|
||||
}
|
||||
}
|
||||
$machine .= implode(" ", $matches[1]); //Mac Addresses
|
||||
}
|
||||
}
|
||||
$data = $machine . PHP_MAXPATHLEN;
|
||||
$data .= PHP_INT_MAX;
|
||||
$data .= PHP_INT_SIZE;
|
||||
$data .= get_current_user();
|
||||
foreach(get_loaded_extensions() as $ext){
|
||||
$data .= $ext.":".phpversion($ext);
|
||||
}
|
||||
return hash("md5", $machine, $raw).hash("sha512", $data, $raw);
|
||||
}
|
||||
|
||||
public static function getIP($force = false){
|
||||
if(Utils::$online === false){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue