0byt3m1n1
Path:
/
data
/
17
/
1
/
18
/
11
/
1670011
/
user
/
1801231
/
htdocs
/
marketting
/
system
/
application
/
controllers
/
[
Home
]
File: rotator.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 - rotator.php | ------------------------------------------------------------------------- | | This controller file is used to show rotated marketing tools | */ class Rotator extends Public_Controller { var $username; var $tool_type; function __construct() { parent::Public_Controller(); //load required models $this->load->model('affiliate_marketing_model', 'affiliate_marketing'); $this->load->model('modules/module_affiliate_marketing_' . $this->uri->segment(2) . '_model', 'tools_model'); //create pagination links $this->config->set_item('uri', $this->config->item('base_folder_path') . '/' . $this->uri->segment(1)); $this->config->set_item('uri_string', str_replace('/', ':', trim_slashes($this->uri->uri_string()))); //set the username $this->username = $this->uri->segment(3); $this->tool_type = 'affiliate_' . $this->uri->segment(2); } function index() { redirect(); } // ------------------------------------------------------------------------ function rotate() { $data = $this->_get_random_ad(); $ext = explode('.', $data['banner_file_name']); //check the file extension //echo '<pre>'; print_r($data); exit(); $afflink = _jrox_public_url() . AFFILIATE_ROUTE . '/' . $this->username . '/tool/' . $this->uri->segment(2) . '/' . $data['id']; if ($this->tool_type == 'affiliate_banners') { $img_code = $this->tools_model->_generate_banner_code($data, $afflink); if ($ext != 'swf') { $code = '<a href="' . $afflink . '">' . $img_code . '</a>'; } echo 'document.write(\'' . $code . '\');'; } } // ------------------------------------------------------------------------ function _get_random_ad() { $query = $this->db->query('SELECT * FROM ' . $this->db->dbprefix($this->tool_type) . ' WHERE status = \'1\' ORDER BY RAND() LIMIT 1'); if ($query->num_rows() > 0) { return $query->row_array(); } } } ?>