function OnActivate() { global $root; //---- validation request if (!isset($_REQUEST['key'])) { header("Location: http://{$root}/wr_error_invalid.html"); exit; } //---- receive key $key = str_replace('_', '&', $_REQUEST['key']); //--- check activation $this->CheckActivation($key); //---- $tools = new CTools(); //---- extract data and crc32 $data = base64_decode(str_replace(array('&', ','), array('+', '/'), $key)); $data = explode("\n", gzuncompress($tools->Crypt($data, $this->crypt_key))); $crc32 = base_convert(crc32(implode("\n", array_slice($data, 0, -1))), 10, 36); //---- check crc if ($crc32 == $data[15]) { //--- put parameters in our structure $this->user['email'] = $data[0]; $this->user['password'] = $data[1]; $this->user['group'] = $data[2]; $this->user['leverage'] = $data[3]; $this->user['zipcode'] = $data[4]; $this->user['country'] = $data[5]; $this->user['state'] = $data[6]; $this->user['city'] = $data[7]; $this->user['address'] = $data[8]; $this->user['phone'] = $data[9]; $this->user['name'] = $data[10]; $this->user['phone_password'] = $data[11]; $this->user['send_reports'] = $data[12]; $this->user['deposit'] = $data[13]; //--- map group name $this->user['group'] = Group($this->user['group']); //--- create new account $ret = $this->CreateAccount($this->user); //--- parse result $ret = explode("\r\n", $ret); //--- it is error? if (empty($ret) || empty($ret[0]) || $ret[0] == 'error' || $ret[0] == 'ERROR') { //--- parse error code if (strpos($ret[1], 'blocked') !== false) { header("Location: http://{$root}/wr_error_blocked.html"); } else { header("Location: http://{$root}/wr_error_internal.html"); } exit; } //--- receive login $login = explode("=", $ret[1]); if (is_array($login)) { $login = $login[1]; } //--- set activation $this->SetActivation($key); //--- goto to complete page header("Location: http://{$root}/wr_complete.php?login={$login}"); } else { header("Location: http://{$root}/wr_error_internal.html"); } exit; }