diff --git a/upload/engine/user.class.php b/upload/engine/user.class.php index e045cc1..255fd86 100644 --- a/upload/engine/user.class.php +++ b/upload/engine/user.class.php @@ -145,6 +145,34 @@ } + public function logintouuid($string){ + $string = "OfflinePlayer:".$string; + $val = md5($string, true); + $byte = array_values(unpack('C16', $val)); + + $tLo = ($byte[0] << 24) | ($byte[1] << 16) | ($byte[2] << 8) | $byte[3]; + $tMi = ($byte[4] << 8) | $byte[5]; + $tHi = ($byte[6] << 8) | $byte[7]; + $csLo = $byte[9]; + $csHi = $byte[8] & 0x3f | (1 << 7); + + if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) { + $tLo = (($tLo & 0x000000ff) << 24) | (($tLo & 0x0000ff00) << 8) | (($tLo & 0x00ff0000) >> 8) | (($tLo & 0xff000000) >> 24); + $tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8); + $tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8); + } + + $tHi &= 0x0fff; + $tHi |= (3 << 12); + + $uuid = sprintf( + '%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x', + $tLo, $tMi, $tHi, $csHi, $csLo, + $byte[10], $byte[11], $byte[12], $byte[13], $byte[14], $byte[15] + ); + return $uuid; + } + public function update_default_permissions(){ $query = $this->db->query("SELECT `value`, `type`, `default` FROM `mcr_permissions`"); diff --git a/upload/install/step_3.php b/upload/install/step_3.php index 247ca1f..905e35e 100644 --- a/upload/install/step_3.php +++ b/upload/install/step_3.php @@ -65,6 +65,7 @@ $salt = $this->db->safesql($this->core->random()); $password = $this->core->gen_password(@$_POST['password'], $salt, $method); $password = $this->db->safesql($password); + $uuid = $this->db->safesql($this->user->logintouuid(@$_POST['login'])); $ip = $this->user->ip; $data = array( @@ -100,9 +101,9 @@ } $sql1 = $this->db->query("INSERT INTO `mcr_users` - (`gid`, `login`, `email`, `password`, `salt`, `ip_create`, `ip_last`, `data`) + (`gid`, `login`, `email`, `password`, `uuid`, `salt`, `ip_create`, `ip_last`, `data`) VALUES - ('3', '$login', '$email', '$password', '$salt', '$ip', '$ip', '$data')"); + ('3', '$login', '$email', '$password', '$uuid', '$salt', '$ip', '$ip', '$data')"); if(!$sql1){ $this->core->notify($this->lng['e_msg'], $this->lng_m['e_add_admin'], 2, 'install/?mode=step_3'); } diff --git a/upload/install/tables.sql b/upload/install/tables.sql index a518b4d..9905527 100644 --- a/upload/install/tables.sql +++ b/upload/install/tables.sql @@ -355,6 +355,7 @@ `login` varchar(32) CHARACTER SET latin1 NOT NULL, `email` varchar(64) CHARACTER SET latin1 NOT NULL, `password` varchar(64) CHARACTER SET latin1 NOT NULL, + `uuid` varchar(64) NOT NULL, `salt` varchar(10) NOT NULL, `tmp` varchar(32) CHARACTER SET latin1 NOT NULL, `is_skin` tinyint(1) NOT NULL DEFAULT '0', diff --git a/upload/modules/admin/users.class.php b/upload/modules/admin/users.class.php index 753e502..f1f1652 100644 --- a/upload/modules/admin/users.class.php +++ b/upload/modules/admin/users.class.php @@ -184,6 +184,7 @@ if($_SERVER['REQUEST_METHOD']=='POST'){ $login = $this->db->safesql(@$_POST['login']); + $uuid = $this->db->safesql($this->user->logintouuid(@$_POST['login'])); $salt = $this->db->safesql($this->core->random()); $password = $this->core->gen_password($_POST['password'], $salt); @@ -224,9 +225,9 @@ $new_data = $this->db->safesql(json_encode($new_data)); $insert = $this->db->query("INSERT INTO `mcr_users` - (gid, login, email, password, `salt`, ip_create, ip_last, `data`) + (gid, login, email, password, `uuid`, `salt`, ip_create, ip_last, `data`) VALUES - ('$gid', '$login', '$email', '$password', '$salt', '{$this->user->ip}', '{$this->user->ip}', '$new_data')"); + ('$gid', '$login', '$email', '$password', '$uuid', '$salt', '{$this->user->ip}', '{$this->user->ip}', '$new_data')"); if(!$insert){ $this->core->notify($this->core->lng["e_msg"], $this->core->lng["e_sql_critical"], 2, '?mode=admin&do=users'); } @@ -293,6 +294,7 @@ if($_SERVER['REQUEST_METHOD']=='POST'){ $login = $this->db->safesql(@$_POST['login']); + $uuid = $this->db->safesql($this->user->logintouuid(@$_POST['login'])); $password = "`password`"; $salt = "`salt`"; @@ -342,7 +344,7 @@ $update = $this->db->query("UPDATE `mcr_users` SET gid='$gid', login='$login', gid='$gid', email='$email', - password=$password, `salt`=$salt, `data`='$new_data' + password=$password, `uuid`='$uuid', `salt`=$salt, `data`='$new_data' WHERE id='$id'"); if(!$update){ $this->core->notify($this->core->lng["e_msg"], $this->core->lng["e_sql_critical"], 2, '?mode=admin&do=users&op=edit&id='.$id); } diff --git a/upload/modules/ajax/register.php b/upload/modules/ajax/register.php index fdf413d..739526f 100644 --- a/upload/modules/ajax/register.php +++ b/upload/modules/ajax/register.php @@ -21,6 +21,7 @@ $login = $this->db->safesql(@$_POST['login']); $email = $this->db->safesql(@$_POST['email']); + $uuid = $this->db->safesql($this->user->logintouuid(@$_POST['login'])); $password = @$_POST['password']; if(intval($_POST['rules'])!==1){ $this->core->js_notify($this->lng['reg_e_rules']); } @@ -69,9 +70,9 @@ $notify_message = $this->core->lng['e_success']; $insert = $this->db->query("INSERT INTO `mcr_users` - (gid, login, email, password, `salt`, `tmp`, ip_create, ip_last, `data`) + (gid, login, email, password, `uuid`, `salt`, `tmp`, ip_create, ip_last, `data`) VALUES - ('$gid', '$login', '$email', '$password', '$salt', '$tmp', '$ip', '$ip', '$newdata')"); + ('$gid', '$login', '$email', '$password', '$uuid', '$salt', '$tmp', '$ip', '$ip', '$newdata')"); if(!$insert){ $this->core->js_notify($this->core->lng['e_sql_critical']); } diff --git a/upload/modules/statics.php b/upload/modules/statics.php index a990260..d172abf 100644 --- a/upload/modules/statics.php +++ b/upload/modules/statics.php @@ -42,7 +42,7 @@ $title = $this->db->HSC($ar['title']); $bc = array( - $this->lng['t_static'] => BASE_URL."?mode=statics&id=$uniq", + $this->lng['mod_name'] => BASE_URL."?mode=statics&id=$uniq", $title => BASE_URL."?mode=statics&id=$uniq" ); diff --git a/upload/system.php b/upload/system.php index d12f95e..9fd84ee 100644 --- a/upload/system.php +++ b/upload/system.php @@ -4,10 +4,11 @@ ini_set("upload_max_filesize", "50M"); ini_set("post_max_size", "50M"); +@date_default_timezone_set('Europe/Moscow'); // System constants define('PROGNAME', 'WebMCR Reloaded'. MCR); -define('VERSION', 'WebMCR Beta 1.0'); +define('VERSION', 'WebMCR Beta 1.1'); define('FEEDBACK', ''.PROGNAME.' © 2013-'.date("Y").' Qexy'); define('MCR_ROOT', dirname(__FILE__).'/'); define('MCR_MODE_PATH', MCR_ROOT.'modules/');