示例#1
0
function smn_expire_banners()
{
    $banners_query = smn_db_query("select b.banners_id, b.expires_date, b.expires_impressions, sum(bh.banners_shown) as banners_shown from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_HISTORY . " bh where b.status = '1' and b.banners_id = bh.banners_id group by b.banners_id");
    if (smn_db_num_rows($banners_query)) {
        while ($banners = smn_db_fetch_array($banners_query)) {
            if (smn_not_null($banners['expires_date'])) {
                if (date('Y-m-d H:i:s') >= $banners['expires_date']) {
                    smn_set_banner_status($banners['banners_id'], '0');
                }
            } elseif (smn_not_null($banners['expires_impressions'])) {
                if ($banners['expires_impressions'] > 0 && $banners['banners_shown'] >= $banners['expires_impressions']) {
                    smn_set_banner_status($banners['banners_id'], '0');
                }
            }
        }
    }
}
  
  Portions Copyright (c) 2002 osCommerce
  
  This source file is subject to version 2.0 of the GPL license,   
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately.
*/
require 'includes/application_top.php';
$affiliate_banner_extension = smn_banner_image_extension();
if ($_GET['action']) {
    switch ($_GET['action']) {
        case 'setaffiliate_flag':
            if ($_GET['affiliate_flag'] == '0' || $_GET['affiliate_flag'] == '1') {
                smn_set_banner_status($_GET['abID'], $_GET['affiliate_flag']);
                $messageStack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success');
            } else {
                $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error');
            }
            smn_redirect(smn_href_link(FILENAME_AFFILIATE_BANNER_MANAGER, 'selected_box=affiliate&page=' . $_GET['page'] . '&abID=' . $_GET['abID']));
            break;
        case 'insert':
        case 'update':
            $affiliate_banners_id = smn_db_prepare_input($_POST['affiliate_banners_id']);
            $affiliate_banners_title = smn_db_prepare_input($_POST['affiliate_banners_title']);
            $affiliate_products_id = smn_db_prepare_input($_POST['affiliate_products_id']);
            $new_affiliate_banners_group = smn_db_prepare_input($_POST['new_affiliate_banners_group']);
            $affiliate_banners_group = empty($new_affiliate_banners_group) ? smn_db_prepare_input($_POST['affiliate_banners_group']) : $new_affiliate_banners_group;
            $affiliate_banners_image_target = smn_db_prepare_input($_POST['affiliate_banners_image_target']);
            $affiliate_html_text = smn_db_prepare_input($_POST['affiliate_html_text']);
  Portions Copyright (c) 2002 osCommerce
  
  This source file is subject to version 2.0 of the GPL license,   
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately.
*/
require 'includes/application_top.php';
$action = isset($_GET['action']) ? $_GET['action'] : '';
$banner_extension = smn_banner_image_extension();
if (smn_not_null($action)) {
    switch ($action) {
        case 'setflag':
            if ($_GET['flag'] == '0' || $_GET['flag'] == '1') {
                smn_set_banner_status($_GET['bID'], $_GET['flag']);
                $messageStack->add_session(SUCCESS_BANNER_STATUS_UPDATED, 'success');
            } else {
                $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error');
            }
            smn_redirect(smn_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']));
            break;
        case 'insert':
        case 'update':
            $banners_image_target = 'banners/';
            if (isset($_POST['banners_id'])) {
                $banners_id = smn_db_prepare_input($_POST['banners_id']);
            }
            $banners_title = smn_db_prepare_input($_POST['banners_title']);
            $banners_url = smn_db_prepare_input($_POST['banners_url']);
            $new_banners_group = smn_db_prepare_input($_POST['new_banners_group']);