Advertisement
Guest User

signup

a guest
Jan 24th, 2020
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.63 KB | None | 0 0
  1. <?php $this->load->helper('signup'); $this->load->helper('email'); if (!empty($this->data['locale'])) { $admin_locale = $this->data['locale']; include(FTT_SITE_BASE . "/sy\163\x74\x65m/application/includes/locale.\x70\150\160"); } $response = new stdClass(); $response->status = 'error'; $response->messages = array(); $no_check = false; if (isset($this->data['no_check'])) $no_check = $this->data['no_check']; $ftt_settings_raw = $this->db->fetch_all_array( "SELECT SQL_CACHE name, value FROM settings WHERE `group`='general' OR `group`='signup' OR `group`='admin'" ); foreach ($ftt_settings_raw as $ftt_setting) { if (!defined($ftt_setting['name'])) { define($ftt_setting['name'], $ftt_setting['value']); } } if (!$no_check && !FTT_SIGNUP_ALLOW_SIGNUP) { $response->messages[] = 'Signup form is closed for this site'; die(json_encode($response)); } $this->dbg = new FTT_Database('GLOBAL'); $logged_in = false; if (!empty($this->data['partner_email'])) { $query = 'SELECT SQL_NO_CACHE * FROM global_partners WHERE `status` = "activated" AND `email` = "' . $this->dbg->escape( $this->data['partner_email'] ) . '"'; $query .= ' and `password` = "' . $this->dbg->escape(@$this->data['partner_password']) . '"'; $partner_data = $this->dbg->query_first($query); if ($partner_data) { $logged_in = true; } else { $response->messages[] = __('Partner email or password is invalid'); die(json_encode($response)); } } $required_fields = array(); if (strlen(FTT_SIGNUP_REQUIRED_FIELDS)) { $required_fields = explode(',', FTT_SIGNUP_REQUIRED_FIELDS); } $error = false; if (empty($this->data['url'])) { $response->messages[] = __('Return url not set'); $error = true; } $this->data['url'] = prep_url(strtolower($this->data['url'])); if (strlen($this->data['url']) > 255) { $response->messages[] = sprintf(__('Return url max length is %d'), 255); $error = true; } if (in_array('title', $required_fields) && empty($this->data['title'])) {
  2. $response->messages[] = __('Title is required!'); $error = true; } if (FTT_SIGNUP_TITLE_MAX && strlen($this->data['title']) > FTT_SIGNUP_TITLE_MAX) { $response->messages[] = sprintf(__('Maximum title length is %d'), FTT_SIGNUP_TITLE_MAX); $error = true; } if (FTT_SIGNUP_TITLE_MIN && strlen($this->data['title']) < FTT_SIGNUP_TITLE_MIN) { $response->messages[] = sprintf(__('Minimum title length is %d'), FTT_SIGNUP_TITLE_MIN); $error = true; } if (in_array('description', $required_fields) && empty($this->data['description'])) { $response->messages[] = __('Description is required'); $error = true; } if (FTT_SIGNUP_DESCRIPTION_MAX && !empty($this->data['description']) && strlen($this->data['description']) > FTT_SIGNUP_DESCRIPTION_MAX) { $response->messages[] = sprintf(__('Maximum description length is %d'), FTT_SIGNUP_DESCRIPTION_MAX); $error = true; } if (FTT_SIGNUP_DESCRIPTION_MIN && !empty($this->data['description']) && strlen($this->data['description']) < FTT_SIGNUP_DESCRIPTION_MIN) { $response->messages[] = sprintf(__('Minimum description length is %d'), FTT_SIGNUP_DESCRIPTION_MIN); $error = true; } if (!$logged_in) { if (!$no_check && in_array('email', $required_fields) && empty($this->data['email'])) { $response->messages[] = __('Email is required'); $error = true; } if (!$no_check && $this->data['email'] && !valid_email($this->data['email'])) { $response->messages[] = __('Wrong email address format'); $error = true; } if (!$no_check && @strlen(@$this->data['email']) > 60) { $response->messages[] = sprintf(__('Maximum email length is %d'), 60); $error = true; } if (!$no_check && in_array('jabber', $required_fields) && empty($this->data['jabber'])) { $response->messages[] = __('Jabber is required'); $error = true; } if (!$no_check && $this->data['jabber'] && !valid_email($this->data['jabber'])) { $response->messages[] = __('Wrong jabber address format'); $error = true; } if (!$no_check && @strlen(@$this->data['jabber']) > 60) { $response->messages[] = sprintf(__('Maximum jabber length is %d'), 60); $error = true; } if (!$no_check && in_array('icq', $required_fields) && empty($this->data['icq'])) { $response->messages[] = __('ICQ is required'); $error = true; } if (!$no_check && in_array('nickname', $required_fields) && empty($this->data['nickname'])) { $response->messages[] = __('Nickname is required'); $error = true; } $this->data['nickname'] = strip_tags(trim($this->data['nickname'])); if (!$no_check && strlen($this->data['nickname']) > 30) { $response->messages[] = sprintf(__('Nickname max length is %d'), 30); $error = true; } } if ($error) { die(json_encode($response)); } if (empty($this->data['domain'])) { $this->data['domain'] = ftt_get_domain($this->data['url']); } $data = array(); $data['url'] = $this->data['url']; $data['domain'] = $this->data['domain']; $data['toplist_name'] = @$this->data['title']; $data['toplist_description'] = @(string)$this->data['description']; $data['webmaster_ip'] = @$this->data['webmaster_ip']; if ($logged_in) { $data['webmaster_email'] = $partner_data['email']; $data['webmaster_jabber'] = $partner_data['jabber']; $data['webmaster_icq'] = $partner_data['icq']; $data['webmaster_nickname'] = $partner_data['nickname']; $data['maxtrade_hour'] = FTT_SIGNUP_PARTNER_MAXTRADE_HOUR; $data['maxtrade_day'] = FTT_SIGNUP_PARTNER_MAXTRADE_DAY; $data['enabled'] = 1; $data['cap'] = FTT_SIGNUP_PARTNER_CAP; $data['enable_toplist'] = 1; $data['new'] = FTT_SIGNUP_PARTNER_NEW; $data['color'] = FTT_SIGNUP_PARTNER_COLOR; $data['nocookie_ok'] = FTT_SIGNUP_PARTNER_NOCOOKIE_OK; $choose_groups = array(); $groups = @$this->data['groups']; if (!is_array($groups)) {
  3. $groups = array(); } foreach (explode(',', FTT_SIGNUP_PARTNER_CHOOSE_GROUPS) as $group) { $tmp = explode(':', $group); $choose_groups[] = $tmp[0]; } if (strlen(FTT_SIGNUP_PARTNER_CHOOSE_GROUPS) and !count(array_diff($groups, $choose_groups))) { $data['groups'] = implode(',', $this->data['groups']); } else { $data['groups'] = FTT_SIGNUP_PARTNER_GROUPS; } $data['allow_from'] = FTT_SIGNUP_PARTNER_ALLOW_FROM; $data['skim_scheme'] = FTT_SIGNUP_PARTNER_SKIM_SCHEME; $data['skim_scheme_ignore'] = FTT_SIGNUP_PARTNER_SKIM_SCHEME_IGNORE; $data['activated'] = 1; $data['partner_id'] = $partner_data['id']; } else { $data['webmaster_email'] = (string)@$this->data['email']; $data['webmaster_jabber'] = (string)@$this->data['jabber']; $data['webmaster_icq'] = (string)@$this->data['icq']; $data['webmaster_nickname'] = (string)@$this->data['nickname']; $data['maxtrade_hour'] = $no_check && isset($this->data['maxtrade_hour']) ? $this->data['maxtrade_hour'] : FTT_SIGNUP_DEFAULT_MAXTRADE_HOUR; $data['maxtrade_day'] = $no_check && isset($this->data['maxtrade_day']) ? $this->data['maxtrade_day'] : FTT_SIGNUP_DEFAULT_MAXTRADE_DAY; $data['enabled'] = $no_check && isset($this->data['enabled']) ? $this->data['enabled'] : FTT_SIGNUP_DEFAULT_ENABLED; $data['cap'] = $no_check && isset($this->data['cap']) ? $this->data['cap'] : FTT_SIGNUP_DEFAULT_CAP; $data['enable_toplist'] = $no_check && isset($this->data['enable_toplist']) ? $this->data['enable_toplist'] : FTT_SIGNUP_DEFAULT_TOPLIST; $data['new'] = $no_check && isset($this->data['new']) ? $this->data['new'] : FTT_SIGNUP_DEFAULT_NEW; $data['color'] = $no_check && isset($this->data['color']) ? $this->data['color'] : FTT_SIGNUP_DEFAULT_COLOR; $data['nocookie_ok'] = $no_check && isset($this->data['nocookie_ok']) ? $this->data['nocookie_ok'] : FTT_SIGNUP_DEFAULT_NOCOOKIE_OK; $choose_groups = array(); $groups = (string)@$this->data['groups']; if (!is_array($groups)) { $groups = array(); } foreach (explode(',', FTT_SIGNUP_DEFAULT_CHOOSE_GROUPS) as $group) { $tmp = explode(':', $group); $choose_groups[] = $tmp[0]; } if (strlen(FTT_SIGNUP_DEFAULT_CHOOSE_GROUPS) and !count(array_diff($groups, $choose_groups))) { $data['groups'] = implode(',', @$this->data['groups']); } else { $data['groups'] = FTT_SIGNUP_DEFAULT_GROUPS; } $data['allow_from'] = $no_check && isset($this->data['allow_from']) ? $this->data['allow_from'] : FTT_SIGNUP_DEFAULT_ALLOW_FROM; $data['skim_scheme'] = $no_check && isset($this->data['skim_scheme']) ? $this->data['skim_scheme'] : FTT_SIGNUP_DEFAULT_SKIM_SCHEME; $data['skim_scheme_ignore'] = $no_check && isset($this->data['skim_scheme_ignore']) ? $this->data['skim_scheme_ignore'] : FTT_SIGNUP_DEFAULT_SKIM_SCHEME_IGNORE; $data['activated'] = $no_check && isset($this->data['activated']) ? $this->data['activated'] : 0; $data['partner_id'] = 0; } $data['signup_time'] = ftt_now(); if (FTT_SIGNUP_ALLOW_STATS == 1 && strlen($this->data['domain_password'])) { $data['webmaster_password'] = $this->data['domain_password']; } else { $data['webmaster_password'] = substr(md5(uniqid()), 0, 6); } $ip = @$this->data['ip']; if (!strlen($ip)) { $ip = '127.0.0.1'; } $data['webmaster_ip'] = ftt_lip($ip); $failed = false; $this->db->query('SELECT 1 FROM traders WHERE domain = {}', $data['domain']); if ($this->db->num_rows) { $response->messages[] = __('This trade already exists in the database'); $failed = true; }
  4. if (!$failed) { $blacklist = $this->db->query_first( 'SELECT `reason`, `timestamp`
  5. FROM blacklist_domains WHERE domain = {}', $data['domain'] ); if (!$blacklist) { $blacklist = $this->dbg->query_first( 'SELECT `reason`, `timestamp`
  6. FROM global_blacklist_domains WHERE domain = {}', $data['domain'] ); } if (isset($blacklist['reason'])) { $response->messages[] = sprintf(__('Sorry, your domain was blacklisted on %s'), date('F j, Y', $blacklist['timestamp'])); if (strlen($blacklist['reason'])) { $response->messages[] = sprintf(__("Blacklist reason is: %s"), $blacklist['reason']); } die(json_encode($response)); }
  7. $server_ip = gethostbyname($data['domain']); if ($server_ip != $data['domain']) { $server_ip = ftt_lip($server_ip); } $blacklist = $this->db->query_first( 'SELECT `reason`, `timestamp`, `domain`
  8. FROM blacklist_ips WHERE ip = {}', $server_ip ); if (!$blacklist) { $blacklist = $this->dbg->query_first( 'SELECT `reason`, `timestamp`, `domain`
  9. FROM global_blacklist_ips WHERE ip = {}', $server_ip ); } if (isset($blacklist['reason'])) { $response->messages[] = sprintf(__('Sorry, your domain was blacklisted on %s'), date('F j, Y', $blacklist['timestamp'])); if (strlen($blacklist['reason'])) { $response->messages[] = sprintf(__("Blacklist reason is: %s"), $blacklist['reason']); } if (strlen($blacklist['domain'])) { $response->messages[] = sprintf(__("Related domain: %s."), $blacklist['domain']); } die(json_encode($response)); }
  10. $blacklist = $this->db->query_first( 'SELECT `reason`, `timestamp`, `domain`
  11. FROM blacklist_webmasters WHERE `ip` = {}
  12. OR ( length(`email`) AND `email` = {} ) OR ( length(`icq`) AND `icq` = {} )', array( $data['webmaster_ip'], $data['webmaster_email'], $data['webmaster_icq'] ) ); if (!$blacklist) { $blacklist = $this->dbg->query_first( 'SELECT `reason`, `timestamp`, `domain`
  13. FROM global_blacklist_webmasters WHERE `ip` = {}
  14. OR ( length(`email`) AND `email` = {}) OR ( length(`icq`) AND `icq` = {})', array( $data['webmaster_ip'], $data['webmaster_email'], $data['webmaster_icq'] ) ); } if (isset($blacklist['reason'])) { $response->messages[] = sprintf(__("Sorry, you \167as \x62\154a\x63\x6b\154\x69\163\164\x65\144 on %s."), date('F j, Y', $blacklist['timestamp'])); if (strlen($blacklist['reason'])) { $response->messages[] = sprintf(__("Reaso\156 is: %s."), $blacklist['reason']); } if (strlen($blacklist['domain'])) { $response->messages[] = sprintf(__("Related domain: %s."), $blacklist['domain']); } $response->messages[] = __("\111\x66 you feel that is error, \160\x6c\145\141\x73\x65, contact site owner."); die(json_encode($response)); } $global_insert = array( 'url' => $data['url'], 'domain' => $data['domain'], 'ratio' => FTT_DEFAULT_RATIO, 'toplist_name' => $data['toplist_name'], 'toplist_description' => $data['toplist_description'], 'webmaster_password' => $data['webmaster_password'], 'webmaster_email' => $data['webmaster_email'], 'webmaster_jabber' => $data['webmaster_jabber'], 'webmaster_icq' => $data['webmaster_icq'], 'webmaster_nickname' => $data['webmaster_nickname'], 'nocookie_ok' => FTT_DEFAULT_NOCOOKIE_OK, 'allow_from' => FTT_DEFAULT_ALLOW_FROM, 'count_subdomains' => FTT_DEFAULT_COUNT_SUBDOMAINS ); $global_update = array('url' => $data['url']); if (strlen($data['toplist_name'])) { $global_update['toplist_name'] = $data['toplist_name']; } if (strlen($data['toplist_description'])) { $global_update['toplist_description'] = $data['toplist_description']; } if (strlen($data['webmaster_password'])) { $global_update['webmaster_password'] = $data['webmaster_password']; } if (strlen($data['webmaster_email'])) { $global_update['webmaster_email'] = $data['webmaster_email']; } if (strlen($data['webmaster_jabber'])) { $global_update['webmaster_jabber'] = $data['webmaster_jabber']; } if (strlen($data['webmaster_icq'])) { $global_update['webmaster_icq'] = $data['webmaster_icq']; } if (strlen($data['webmaster_nickname'])) { $global_update['webmaster_nickname'] = $data['webmaster_nickname']; } $this->dbg->safeQuery('INSERT INTO global_traders (' . join(',', array_keys($global_insert)) . ') VALUES (?a) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id),?u', array_values($global_insert), $global_update); $trade_id = $this->dbg->insertId(); if (!$trade_id) { $response->messages[] = __('Unpredictable error...'); die(json_encode($response)); } $data['id'] = $trade_id; $data['troyan_message'] = ''; $this->db->query_insert('traders', $data); $response->messages[] = __("Tr\x61\144\x65 Added! \x59\157u \x63\141\156 start to send traffic!"); $response->messages[] = sprintf(__("U\x52\114 to send traffic to: %s"), FTT_SIGNUP_URL); if ($data['allow_from']) { $response->messages[] = sprintf( __('You can also send to %s so that noref traffic will be counted'), rtrim('/', FTT_SIGNUP_URL) . "/?id=$trade_id" ); } if (FTT_SIGNUP_EMAIL_NOTIFY and strlen(FTT_SIGNUP_EMAIL)) { signup_email_notification($data); } $response->status = "OK"; } die(json_encode($response));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement