0byt3m1n1
Path:
/
data
/
17
/
1
/
18
/
11
/
1670011
/
user
/
1801231
/
htdocs
/
marketting
/
system
/
application
/
controllers
/
[
Home
]
File: refer.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); /* | ------------------------------------------------------------------------- | COPYRIGHT NOTICE | Copyright 2008 JROX Technologies, Inc. All Rights Reserved. | ------------------------------------------------------------------------- | This script may be only used and modified in accordance to the license | agreement attached (license.txt) except where expressly noted within | commented areas of the code body. This copyright notice and the | comments above and below must remain intact at all times. By using this | code you agree to indemnify JROX Technologies, Inc, its corporate agents | and affiliates from any liability that might arise from its use. | | Selling the code for this program without prior written consent is | expressly forbidden and in violation of Domestic and International | copyright laws. | | ------------------------------------------------------------------------- | FILENAME - refer.php | ------------------------------------------------------------------------- | | This controller file is used for the affiliate referral URLs | */ class Refer extends Public_Controller { function __construct() { parent::Public_Controller(); $this->config->set_item('jrox_site_referral', $this->uri->segment(2)); } // ------------------------------------------------------------------------ function index() { redirect_301(); } // ------------------------------------------------------------------------ function id() { //set signup URL $this->security_model->_get_cart_url(); //run referral tracking functions $aff_data = $this->aff->_validate_user($this->config->item('jrox_site_referral')); if (!empty($aff_data)) { //check if this is a marketing tool URL if ($this->uri->segment(3) == 'tool' && $this->uri->segment(4) != false) { $tool_type = $this->uri->segment(4); $tool_id = (int)$this->uri->segment(5); } else { $tool_type = '0'; $tool_id = '0'; } $cid = $aff_data['mid'] . '-' . $aff_data['username'] . '-' . $tool_type . '-' . $tool_id; if ($cookie = set_tracking_cookie($cid)) { //insert the tracking data $sdata = array('date' => _generate_timestamp(), 'member_id' => $aff_data['mid'], 'tool_type' => $tool_type, 'tool_id' => $tool_id, 'referrer' => $this->agent->referrer(), 'ip_address' => $this->input->ip_address(), 'user_agent' => $this->agent->agent_string(), 'os' => $this->agent->platform(), 'browser' => $this->agent->browser(), 'isp' => gethostbyaddr($this->input->ip_address()), ); $this->aff->_insert_affiliate_traffic($sdata); //set the session data $this->session->set_userdata($cookie, serialize($aff_data)); $this->session->set_userdata('jrox_site_referral_regular', $cookie); } } //check if we are redirecting to a specific page $page = ''; $base_page = false; if ($this->uri->segment(3) == 'page' && $this->uri->segment(4) != false) { $page = referer_redirect('public', $this->uri->segment(4), ':'); //http://www.domain.com/JEM/affiliates/jrox45dkd/page/10-this_is_a_test } elseif ($this->uri->segment(3) == 'signup') { $page = $this->config->item('checkout_url_link') . 'registration/' . $aff_data['username']; $base_page = true; } elseif ($this->uri->segment(3) == 'tool' && $this->uri->segment(5) != false) { //check if this is a specific marketing tool $get_url = $this->aff->_get_tool_details($this->uri->segment(4), $this->uri->segment(5)); if (!empty($get_url)) { if ($get_url['enable_redirect'] == 1) { $page = $get_url['redirect_custom_url']; $base_page = true; } } } elseif ($aff_data['enable_custom_url'] == 1 && !empty($aff_data['custom_url_link'])) { //redirect to the user's custom web page $page = $aff_data['custom_url_link']; $base_page = true; } if (!empty($aff_data)) { //check for custom redirects foreach ($aff_data as $k => $v) { if ($aff_data != 'password') { $page = str_replace('{' . $k . '}', $aff_data[$k], $page); } } } redirect_301($page, $base_page); //default base url redirect } } ?>