Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Restore Banner Manager


shanehamelin

Recommended Posts

Is there a way to remove and restore Banner Manager?

Seems when I try to update a banner link url I get a "Browser 405 error"

 

Then when I look at the current Banner Manager Mod the admin doesnt look like the one I have..

 

What php code do you need to look at to help?

 

Thanks

Shane

Link to comment
Share on other sites

I went into the current banner manager in admin

and thought I would remove a banner and then re-add it..

Like for instance - I removed baner_01 which I dont want to have a url link

it added with no error but still has a url and it opens in new window - it links to the store again in

new window. The url reads something with a goto:_9 or something but its to fast to read, just changes to my main root

I went to baner manager and put none in url and now it just stops here: http://store.shopshine.net/redirect.php?ac...nner&goto=9

doesn't redirect so I was able to read it

 

here is the banner.php

 

<?php
/*
 $Id: banner.php,v 1.9 2001/12/14 12:55:49 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2001 osCommerce

 Released under the GNU General Public License
*/

////
// Sets the status of a banner
 function tep_set_banner_status($banners_id, $status) {
if ($status == '1') {
  return tep_db_query("update " . TABLE_BANNERS . " set status = '1', date_status_change = now(), date_scheduled = NULL where banners_id = '" . $banners_id . "'");
} elseif ($status == '0') {
  return tep_db_query("update " . TABLE_BANNERS . " set status = '0', date_status_change = now() where banners_id = '" . $banners_id . "'");
} else {
  return -1;
}
 }

////
// Auto activate banners
 function tep_activate_banners() {
$banners_query = tep_db_query("select banners_id, date_scheduled from " . TABLE_BANNERS . " where date_scheduled != ''");
if (tep_db_num_rows($banners_query)) {
  while ($banners = tep_db_fetch_array($banners_query)) {
	if (date('Y-m-d H:i:s') >= $banners['date_scheduled']) {
	  tep_set_banner_status($banners['banners_id'], '1');
	}
  }
}
 }

////
// Auto expire banners
 function tep_expire_banners() {
$banners_query = tep_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 (tep_db_num_rows($banners_query)) {
  while ($banners = tep_db_fetch_array($banners_query)) {
	if ($banners['expires_date']) {
	  if (date('Y-m-d H:i:s') >= $banners['expires_date']) {
		tep_set_banner_status($banners['banners_id'], '0');
	  }
	} elseif ($banners['expires_impressions']) {
	  if ($banners['banners_shown'] >= $banners['expires_impressions']) {
		tep_set_banner_status($banners['banners_id'], '0');
	  }
	}
  }
}
 }

////
// Display a banner from the specified group or banner id ($identifier)
 function tep_display_banner($action, $identifier) {
// WebMakers.com Added: Banner Manager
global $my_page_ssl;

switch (true) {
case ( BANNERS_SHOW_ON_SSL=='1' and $my_page_ssl=='on' ):
  $my_banner_filter=" and banners_on_ssl= " . "'1' ";
  break;
case ( BANNERS_SHOW_ON_SSL=='1' and $my_page_ssl=='off' ):
  $my_banner_filter='';
  break;
case ( BANNERS_SHOW_ON_SSL=='0' and $my_page_ssl=='on' ):
  $my_banner_filter=" and banners_on_ssl= " . "'2' ";
  break;
case ( BANNERS_SHOW_ON_SSL=='0' and $my_page_ssl=='off' ):
  $my_banner_filter='';
  break;
}

if ($action == 'dynamic') {
  $banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' " . $my_banner_filter . " and banners_group = '" . $identifier . "'");
  $banners = tep_db_fetch_array($banners_query);
  if ($banners['count'] > 0) {
// WebMakers.com Added: Banner Manager
	$banner = tep_random_select("select banners_id, banners_title, banners_image, banners_html_text, banners_open_new_windows, banners_on_ssl from " . TABLE_BANNERS . " where status = '1' " . $my_banner_filter . "  and banners_group = '" . $identifier . "'");
  } else {
	return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>';
  }
} elseif ($action == 'static') {
  if (is_array($identifier)) {
	$banner = $identifier;
  } else {
// WebMakers.com Added: Banner Manager
	$banner_query = tep_db_query("select banners_id, banners_title, banners_image, banners_html_text,  banners_open_new_windows, banners_on_ssl from " . TABLE_BANNERS . " where status = '1'  " . $my_banner_filter . " and banners_id = '" . $identifier . "'");
	if (tep_db_num_rows($banner_query)) {
	  $banner = tep_db_fetch_array($banner_query);
	} else {
	  return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>';
	}
  }
} else {
  return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>';
}


if (tep_not_null($banner['banners_html_text'])) {
$banner_string = $banner['banners_html_text'];
} else {
// WebMakers.com Added: Banner Manager
if ( $banner['banners_open_new_windows'] =='1' ) {
if ( substr($banner['banners_image'], -3, 3) == 'swf' ) {
$size = getimagesize(DIR_WS_IMAGES . $banner['banners_image']);
$banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . mm_output_flash_movie( $banner['banners_title'], DIR_WS_IMAGES . $banner['banners_image'] , $size[0] , $size[1]) . '</a>';
} else {
$banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>';
}
} else {
if ( substr($banner['banners_image'], -3, 3) == 'swf' ) {
$size = getimagesize(DIR_WS_IMAGES . $banner['banners_image']);
$banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . mm_output_flash_movie( $banner['banners_title'], DIR_WS_IMAGES . $banner['banners_image'] , $size[0] , $size[1]) . '</a>';
} else {
$banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>';
}
}
}

tep_update_banner_display_count($banner['banners_id']);

return $banner_string;
 }

////
// Check to see if a banner exists
 function tep_banner_exists($action, $identifier) {
// WebMakers.com Added: Banner Manager
global $my_page_ssl;

switch (true) {
case ( BANNERS_SHOW_ON_SSL=='1' and $my_page_ssl=='on' ):
  $my_banner_filter=" and banners_on_ssl= " . "'1' ";
  break;
case ( BANNERS_SHOW_ON_SSL=='1' and $my_page_ssl=='off' ):
  $my_banner_filter='';
  break;
case ( BANNERS_SHOW_ON_SSL=='0' and $my_page_ssl=='on' ):
  $my_banner_filter=" and banners_on_ssl= " . "'2' ";
  break;
case ( BANNERS_SHOW_ON_SSL=='0' and $my_page_ssl=='off' ):
  $my_banner_filter='';
  break;
}

if ($action == 'dynamic') {
  return tep_random_select("select banners_id, banners_title, banners_image, banners_html_text, banners_open_new_windows from " . TABLE_BANNERS . " where status = '1'  " . $my_banner_filter . " and banners_group = '" . $identifier . "'");
} elseif ($action == 'static') {
  $banner_query = tep_db_query("select banners_id, banners_title, banners_image, banners_html_text, banners_open_new_windows from " . TABLE_BANNERS . " where status = '1'  " . $my_banner_filter . " and banners_id = '" . $identifier . "'");
  return tep_db_fetch_array($banner_query);
} else {
  return false;
}
 }

////
// Update the banner display statistics
 function tep_update_banner_display_count($banner_id) {
$banner_check_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . $banner_id . "' and date_format(banners_history_date, '%Y%m%d') = date_format(now(), '%Y%m%d')");
$banner_check = tep_db_fetch_array($banner_check_query);

if ($banner_check['count'] > 0) {
  tep_db_query("update " . TABLE_BANNERS_HISTORY . " set banners_shown = banners_shown + 1 where banners_id = '" . $banner_id . "' and date_format(banners_history_date, '%Y%m%d') = date_format(now(), '%Y%m%d')");
} else {
  tep_db_query("insert into " . TABLE_BANNERS_HISTORY . " (banners_id, banners_shown, banners_history_date) values ('" . $banner_id . "', 1, now())");
}
 }

////
// Update the banner click statistics
 function tep_update_banner_click_count($banner_id) {
tep_db_query("update " . TABLE_BANNERS_HISTORY . " set banners_clicked = banners_clicked + 1 where banners_id = '" . $banner_id . "' and date_format(banners_history_date, '%Y%m%d') = date_format(now(), '%Y%m%d')");
 }
?>

Link to comment
Share on other sites

I did find this, does it help?

 

<?php
/*
 $Id: redirect.php,v 1.10 2003/06/05 23:31:31 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 switch ($HTTP_GET_VARS['action']) {
case 'banner':
  $banner_query = tep_db_query("select banners_url from " . TABLE_BANNERS . " where banners_id = '" . (int)$HTTP_GET_VARS['goto'] . "'");
  if (tep_db_num_rows($banner_query)) {
	$banner = tep_db_fetch_array($banner_query);
	tep_update_banner_click_count($HTTP_GET_VARS['goto']);

	tep_redirect($banner['banners_url']);
  }
  break;

case 'url':
  if (isset($HTTP_GET_VARS['goto']) && tep_not_null($HTTP_GET_VARS['goto'])) {
	$check_query = tep_db_query("select products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_url = '" . tep_db_input($HTTP_GET_VARS['goto']) . "' limit 1");
	if (tep_db_num_rows($check_query)) {
	  tep_redirect('http://' . $HTTP_GET_VARS['goto']);
	}
  }
  break;

case 'manufacturer':
  if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
	$manufacturer_query = tep_db_query("select manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$languages_id . "'");
	if (tep_db_num_rows($manufacturer_query)) {
// url exists in selected language
	  $manufacturer = tep_db_fetch_array($manufacturer_query);

	  if (tep_not_null($manufacturer['manufacturers_url'])) {
		tep_db_query("update " . TABLE_MANUFACTURERS_INFO . " set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$languages_id . "'");

		tep_redirect($manufacturer['manufacturers_url']);
	  }
	} else {
// no url exists for the selected language, lets use the default language then
	  $manufacturer_query = tep_db_query("select mi.languages_id, mi.manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " mi, " . TABLE_LANGUAGES . " l where mi.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and mi.languages_id = l.languages_id and l.code = '" . DEFAULT_LANGUAGE . "'");
	  if (tep_db_num_rows($manufacturer_query)) {
		$manufacturer = tep_db_fetch_array($manufacturer_query);

		if (tep_not_null($manufacturer['manufacturers_url'])) {
		  tep_db_query("update " . TABLE_MANUFACTURERS_INFO . " set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$manufacturer['languages_id'] . "'");

		  tep_redirect($manufacturer['manufacturers_url']);
		}
	  }
	}
  }
  break;
 }

 tep_redirect(tep_href_link(FILENAME_DEFAULT));
?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...