function OnRegister() { global $root; //---- validation request if (!isset($_REQUEST['user']) || !is_array($_REQUEST['user']) || !isset($_REQUEST['verify_code']) || empty($_REQUEST['verify_code']) || !isset($_SESSION['verify_code']) || empty($_SESSION['verify_code'])) { header("Location: http://{$root}/wr_error_invalid.html"); exit; } //---- receive input $this->user = $_REQUEST['user']; $this->verify_code = $_REQUEST['verify_code']; //---- foreach ($this->user as $key => $value) { $value = trim($value); } //---- validation input if ($_SESSION['verify_code'] != $this->verify_code || $this->user['password'] != $this->user['confirm_password'] || empty($this->user['email']) || empty($this->user['name']) || empty($this->user['password']) || empty($this->user['country']) || empty($this->user['state']) || empty($this->user['city']) || empty($this->user['zipcode']) || empty($this->user['phone']) || empty($this->user['address']) || empty($this->user['phone_password']) || !$this->CheckPassword($this->user['password'])) { header("Location: http://{$root}/wr_error_invalid.html"); exit; } //--- prepare line $line = $this->user['email'] . "\n" . $this->user['password'] . "\n" . $this->user['group'] . "\n" . $this->user['leverage'] . "\n" . $this->user['zipcode'] . "\n" . $this->user['country'] . "\n" . $this->user['state'] . "\n" . $this->user['city'] . "\n" . $this->user['address'] . "\n" . $this->user['phone'] . "\n" . $this->user['name'] . "\n" . $this->user['phone_password'] . "\n" . $this->user['send_reports'] . "\n" . $this->user['deposit'] . "\n" . time(); $line .= "\n" . base_convert(crc32($line), 10, 36); //---- create new tools $tools = new CTools(); //---- compress line $line = gzcompress($line); //---- prepare url and key $url = "http://{$root}/wr_register.php?a[activate]=&key="; $key = str_replace(array('+', '/'), array('&', ','), rtrim(base64_encode($tools->Crypt($line, $this->crypt_key)), '=')); $url = $url . str_replace('&', '_', $key); //---- mail subject $mail_subject = 'Confirmation email from MetaTrader Server'; //--- body $mail_text = file_get_contents("templates/wr_email.txt"); $mail_text = str_replace('{username}', $this->user['name'], $mail_text); $mail_text = str_replace('{url}', $url, $mail_text); //---- send mail if (!$tools->Mail($this->user['email'], $this->user['name'], T_SMTP_FROM, T_SMTP_FROM_NAME, $mail_subject, $mail_text)) { header("Location: http://{$root}/wr_error_internal.html"); exit; } //--- add activate $this->AddActivation($key); //--- redirect header("Location: http://{$root}/wr_register_mail.html"); }