Jump to content
Sign in to follow this  
BGSoyCandle

warnings & fatal errors in admin

Recommended Posts

I cannot log in to my admin panel now. Please help!

 

Warning: main(includes/affiliate_application_top.php): failed to open stream: No such file or directory in /home/bgsoycan/public_html/ecommerce/os/catalog/admin/includes/application_top.php on line 209

 

Warning: main(includes/affiliate_application_top.php): failed to open stream: No such file or directory in /home/bgsoycan/public_html/ecommerce/os/catalog/admin/includes/application_top.php on line 209

 

Fatal error: main(): Failed opening required 'includes/affiliate_application_top.php' (include_path='.:/usr/local/lib/php') in /home/bgsoycan/public_html/ecommerce/os/catalog/admin/includes/application_top.php on line 209

 

includes/affiliate_application_top.php is loaded exactly as in the directions (I think)

<?php
/*
 $Id: affiliate_application_top.php,v 2.00 2003/10/12

 OSC-Affiliate

 Contribution based on:

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

 Copyright (c) 2002 - 2003 osCommerce

 Released under the GNU General Public License
*/

// Set the local configuration parameters - mainly for developers
 if (file_exists(DIR_WS_INCLUDES . 'local/affiliate_configure.php')) include(DIR_WS_INCLUDES . 'local/affiliate_configure.php');

 require(DIR_WS_INCLUDES . 'affiliate_configure.php');
 require(DIR_WS_FUNCTIONS . 'affiliate_functions.php');

 define('FILENAME_AFFILIATE', 'affiliate_affiliates.php');
 define('FILENAME_AFFILIATE_BANNERS', 'affiliate_banners.php');
 define('FILENAME_AFFILIATE_BANNER_MANAGER', 'affiliate_banners.php');
 define('TABLE_AFFILIATE_NEWS_CONTENTS', 'affiliate_news_contents');
 define('FILENAME_AFFILIATE_CLICKS', 'affiliate_clicks.php');
 define('FILENAME_AFFILIATE_CONTACT', 'affiliate_contact.php');
 define('FILENAME_AFFILIATE_HELP_1', 'affiliate_help1.php');
 define('FILENAME_AFFILIATE_HELP_2', 'affiliate_help2.php');
 define('FILENAME_AFFILIATE_HELP_3', 'affiliate_help3.php');
 define('FILENAME_AFFILIATE_HELP_4', 'affiliate_help4.php');
 define('FILENAME_AFFILIATE_HELP_5', 'affiliate_help5.php');
 define('FILENAME_AFFILIATE_HELP_6', 'affiliate_help6.php');
 define('FILENAME_AFFILIATE_HELP_7', 'affiliate_help7.php');
 define('FILENAME_AFFILIATE_HELP_8', 'affiliate_help8.php');
 define('FILENAME_AFFILIATE_INVOICE', 'affiliate_invoice.php');
 define('FILENAME_AFFILIATE_NEWS', 'affiliate_news.php');
 define('FILENAME_AFFILIATE_NEWSLETTERS', 'affiliate_newsletters.php');
 define('FILENAME_AFFILIATE_PAYMENT', 'affiliate_payment.php');
 define('FILENAME_AFFILIATE_POPUP_IMAGE', 'affiliate_popup_image.php');
 define('FILENAME_AFFILIATE_SALES', 'affiliate_sales.php');
 define('FILENAME_AFFILIATE_STATISTICS', 'affiliate_statistics.php');
 define('FILENAME_AFFILIATE_SUMMARY', 'affiliate_summary.php');
 define('FILENAME_AFFILIATE_RESET', 'affiliate_reset.php');
 define('FILENAME_AFFILIATE_VALIDPRODUCTS', 'affiliate_validproducts.php');

 define('FILENAME_CATALOG_AFFILIATE_PAYMENT_INFO','affiliate_payment.php');
 define('FILENAME_CATALOG_PRODUCT_INFO', 'product_info.php');

 define('TABLE_AFFILIATE', 'affiliate_affiliate');
 define('TABLE_AFFILIATE_NEWS', 'affiliate_news');
 define('TABLE_AFFILIATE_NEWSLETTERS', 'affiliate_newsletters');
 define('TABLE_AFFILIATE_BANNERS', 'affiliate_banners');
 define('TABLE_AFFILIATE_BANNERS_HISTORY', 'affiliate_banners_history');
 define('TABLE_AFFILIATE_CLICKTHROUGHS', 'affiliate_clickthroughs');
 define('TABLE_AFFILIATE_PAYMENT', 'affiliate_payment');
 define('TABLE_AFFILIATE_PAYMENT_STATUS', 'affiliate_payment_status');
 define('TABLE_AFFILIATE_PAYMENT_STATUS_HISTORY', 'affiliate_payment_status_history');
 define('TABLE_AFFILIATE_SALES', 'affiliate_sales');

// include the language translations
 require(DIR_WS_LANGUAGES . 'affiliate_' . $language . '.php');

// If an order is deleted delete the sale too (optional)
 if ($HTTP_GET_VARS['action'] == 'deleteconfirm' && basename($HTTP_SERVER_VARS['SCRIPT_FILENAME']) == FILENAME_ORDERS && AFFILIATE_DELETE_ORDERS == 'true') {
   $affiliate_oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
   tep_db_query("delete from " . TABLE_AFFILIATE_SALES . " where affiliate_orders_id = '" . tep_db_input($affiliate_oID) . "' and affiliate_billing_status != 1");
 }
?>

 

lines 205 - 210 of ecommerce/os/catalog/admin/includes/application_top.php is

 

 

  if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
   $messageStack->add(WARNING_FILE_UPLOADS_DISABLED, 'warning');
 }
 // Include OSC-AFFILIATE
 require('includes/affiliate_application_top.php');
?>

Share this post


Link to post
Share on other sites

The file is not being found - it should be in the /admin/includes/ directory :-"

 

Perhaps you have it in /includes/ ?

 

Matti


Matti Ressler

 

We were all once expert at...... nothing

_____

Share this post


Link to post
Share on other sites

I have re-uploaded every file from the affiliate module. I still cannot get into my admin panel.

 

Warning: main(includes/affiliate_application_top.php): failed to open stream: No such file or directory in /home/bgsoycan/public_html/ecommerce/os/catalog/admin/includes/application_top.php on line 209

 

Warning: main(includes/affiliate_application_top.php): failed to open stream: No such file or directory in /home/bgsoycan/public_html/ecommerce/os/catalog/admin/includes/application_top.php on line 209

 

Fatal error: main(): Failed opening required 'includes/affiliate_application_top.php' (include_path='.:/usr/local/lib/php') in /home/bgsoycan/public_html/ecommerce/os/catalog/admin/includes/application_top.php on line 209

 

This is what I have in /public_html/ecommerce/os/admin/includes/affiliate_application_top.php

 

<?php
/*
 $Id: affiliate_application_top.php,v 2.00 2003/10/12

 OSC-Affiliate

 Contribution based on:

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

 Copyright (c) 2002 - 2003 osCommerce

 Released under the GNU General Public License
*/

// Set the local configuration parameters - mainly for developers
 if (file_exists(DIR_WS_INCLUDES . 'local/affiliate_configure.php')) include(DIR_WS_INCLUDES . 'local/affiliate_configure.php');

 require(DIR_WS_INCLUDES . 'affiliate_configure.php');
 require(DIR_WS_FUNCTIONS . 'affiliate_functions.php');

 define('FILENAME_AFFILIATE', 'affiliate_affiliates.php');
 define('FILENAME_AFFILIATE_BANNERS', 'affiliate_banners.php');
 define('FILENAME_AFFILIATE_BANNER_MANAGER', 'affiliate_banners.php');
 define('TABLE_AFFILIATE_NEWS_CONTENTS', 'affiliate_news_contents');
 define('FILENAME_AFFILIATE_CLICKS', 'affiliate_clicks.php');
 define('FILENAME_AFFILIATE_CONTACT', 'affiliate_contact.php');
 define('FILENAME_AFFILIATE_HELP_1', 'affiliate_help1.php');
 define('FILENAME_AFFILIATE_HELP_2', 'affiliate_help2.php');
 define('FILENAME_AFFILIATE_HELP_3', 'affiliate_help3.php');
 define('FILENAME_AFFILIATE_HELP_4', 'affiliate_help4.php');
 define('FILENAME_AFFILIATE_HELP_5', 'affiliate_help5.php');
 define('FILENAME_AFFILIATE_HELP_6', 'affiliate_help6.php');
 define('FILENAME_AFFILIATE_HELP_7', 'affiliate_help7.php');
 define('FILENAME_AFFILIATE_HELP_8', 'affiliate_help8.php');
 define('FILENAME_AFFILIATE_INVOICE', 'affiliate_invoice.php');
 define('FILENAME_AFFILIATE_NEWS', 'affiliate_news.php');
 define('FILENAME_AFFILIATE_NEWSLETTERS', 'affiliate_newsletters.php');
 define('FILENAME_AFFILIATE_PAYMENT', 'affiliate_payment.php');
 define('FILENAME_AFFILIATE_POPUP_IMAGE', 'affiliate_popup_image.php');
 define('FILENAME_AFFILIATE_SALES', 'affiliate_sales.php');
 define('FILENAME_AFFILIATE_STATISTICS', 'affiliate_statistics.php');
 define('FILENAME_AFFILIATE_SUMMARY', 'affiliate_summary.php');
 define('FILENAME_AFFILIATE_RESET', 'affiliate_reset.php');
 define('FILENAME_AFFILIATE_VALIDPRODUCTS', 'affiliate_validproducts.php');

 define('FILENAME_CATALOG_AFFILIATE_PAYMENT_INFO','affiliate_payment.php');
 define('FILENAME_CATALOG_PRODUCT_INFO', 'product_info.php');

 define('TABLE_AFFILIATE', 'affiliate_affiliate');
 define('TABLE_AFFILIATE_NEWS', 'affiliate_news');
 define('TABLE_AFFILIATE_NEWSLETTERS', 'affiliate_newsletters');
 define('TABLE_AFFILIATE_BANNERS', 'affiliate_banners');
 define('TABLE_AFFILIATE_BANNERS_HISTORY', 'affiliate_banners_history');
 define('TABLE_AFFILIATE_CLICKTHROUGHS', 'affiliate_clickthroughs');
 define('TABLE_AFFILIATE_PAYMENT', 'affiliate_payment');
 define('TABLE_AFFILIATE_PAYMENT_STATUS', 'affiliate_payment_status');
 define('TABLE_AFFILIATE_PAYMENT_STATUS_HISTORY', 'affiliate_payment_status_history');
 define('TABLE_AFFILIATE_SALES', 'affiliate_sales');

// include the language translations
 require(DIR_WS_LANGUAGES . 'affiliate_' . $language . '.php');

// If an order is deleted delete the sale too (optional)
 if ($HTTP_GET_VARS['action'] == 'deleteconfirm' && basename($HTTP_SERVER_VARS['SCRIPT_FILENAME']) == FILENAME_ORDERS && AFFILIATE_DELETE_ORDERS == 'true') {
   $affiliate_oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
   tep_db_query("delete from " . TABLE_AFFILIATE_SALES . " where affiliate_orders_id = '" . tep_db_input($affiliate_oID) . "' and affiliate_billing_status != 1");
 }
?>

 

I'm not quite sure where to go next to try to fix this?

Share this post


Link to post
Share on other sites

It looks like the same file is in /public_html/ecommerce/os/catalog/includes

Would that make any difference? The affiliate info is showing up on my cataolg page

http://bgsoycandle.com/ecommerce/os/catalog

 

<?php
/*
 $Id: affiliate_application_top.php,v 2.00 2003/10/12

 OSC-Affiliate

 Contribution based on:

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

 Copyright (c) 2002 - 2003 osCommerce

 Released under the GNU General Public License
*/


// Set the local configuration parameters - mainly for developers
 if (file_exists(DIR_WS_INCLUDES . 'local/affiliate_configure.php')) include(DIR_WS_INCLUDES . 'local/affiliate_configure.php');

 require(DIR_WS_INCLUDES . 'affiliate_configure.php');
 require(DIR_WS_FUNCTIONS . 'affiliate_functions.php');

// define the database table names used in the contribution
 define('TABLE_AFFILIATE', 'affiliate_affiliate');
 define('TABLE_AFFILIATE_NEWS', 'affiliate_news');

// if you change this -> affiliate_show_banner must be changed too
 define('TABLE_AFFILIATE_BANNERS', 'affiliate_banners');
 define('TABLE_AFFILIATE_BANNERS_HISTORY', 'affiliate_banners_history');
 define('TABLE_AFFILIATE_CLICKTHROUGHS', 'affiliate_clickthroughs');
 define('TABLE_AFFILIATE_SALES', 'affiliate_sales');
 define('TABLE_AFFILIATE_PAYMENT', 'affiliate_payment');
 define('TABLE_AFFILIATE_PAYMENT_STATUS', 'affiliate_payment_status');
 define('TABLE_AFFILIATE_PAYMENT_STATUS_HISTORY', 'affiliate_payment_status_history');

// define the filenames used in the project
 define('FILENAME_AFFILIATE_SUMMARY', 'affiliate_summary.php');
 define('FILENAME_AFFILIATE_LOGOUT', 'affiliate_logout.php');
 define('FILENAME_AFFILIATE', 'affiliate_affiliate.php'); 
 define('FILENAME_AFFILIATE_CONTACT', 'affiliate_contact.php');
 define('FILENAME_AFFILIATE_FAQ', 'affiliate_faq.php');
 define('FILENAME_AFFILIATE_ACCOUNT', 'affiliate_details.php');
 define('FILENAME_AFFILIATE_DETAILS', 'affiliate_details.php');
 define('FILENAME_AFFILIATE_DETAILS_OK', 'affiliate_details_ok.php');
 define('FILENAME_AFFILIATE_TERMS','affiliate_terms.php');
 define('FILENAME_AFFILIATE_TERMS_POPUP','affiliate_terms_popup.php');
 define('FILENAME_AFFILIATE_NEWS', 'affiliate_news.php');
 define('FILENAME_AFFILIATE_NEWSLETTER', 'affiliate_newsletter.php');

 define('FILENAME_AFFILIATE_HELP_1', 'affiliate_help1.php');
 define('FILENAME_AFFILIATE_HELP_2', 'affiliate_help2.php');
 define('FILENAME_AFFILIATE_HELP_3', 'affiliate_help3.php');
 define('FILENAME_AFFILIATE_HELP_4', 'affiliate_help4.php');
 define('FILENAME_AFFILIATE_HELP_5', 'affiliate_help5.php');
 define('FILENAME_AFFILIATE_HELP_6', 'affiliate_help6.php');
 define('FILENAME_AFFILIATE_HELP_7', 'affiliate_help7.php');
 define('FILENAME_AFFILIATE_HELP_8', 'affiliate_help8.php');
 define('FILENAME_AFFILIATE_HELP_9', 'affiliate_help9.php');
 define('FILENAME_AFFILIATE_HELP_10', 'affiliate_help10.php');
 define('FILENAME_AFFILIATE_HELP_11', 'affiliate_help11.php');
 define('FILENAME_AFFILIATE_HELP_12', 'affiliate_help12.php');
 define('FILENAME_AFFILIATE_HELP_13', 'affiliate_help13.php');
 define('FILENAME_AFFILIATE_HELP_14', 'affiliate_help14.php');
 define('FILENAME_AFFILIATE_HELP_15', 'affiliate_help15.php');
 define('FILENAME_AFFILIATE_HELP_16', 'affiliate_help16.php');
 define('FILENAME_AFFILIATE_HELP_17', 'affiliate_help17.php');
 define('FILENAME_AFFILIATE_HELP_18', 'affiliate_help18.php');
 define('FILENAME_AFFILIATE_HELP_19', 'affiliate_help19.php');
 define('FILENAME_AFFILIATE_HELP_20', 'affiliate_help20.php');
 define('FILENAME_AFFILIATE_HELP_21', 'affiliate_help21.php');
 define('FILENAME_AFFILIATE_HELP_22', 'affiliate_help22.php');
define('FILENAME_AFFILIATE_BANNERS_CATEGORY', 'affiliate_banners_category.php');
 define('FILENAME_AFFILIATE_BANNERS_BUILD_CAT', 'affiliate_banners_build_cat.php');
 define('FILENAME_AFFILIATE_VALIDCATS', 'affiliate_validcats.php');
 define('FILENAME_AFFILIATE_INFO', 'affiliate_info.php');
define('TABLE_AFFILIATE_NEWS_CONTENTS', 'affiliate_news_contents');
 define('FILENAME_AFFILIATE_BANNERS', 'affiliate_banners.php');
 define('FILENAME_AFFILIATE_BANNERS_BANNERS', 'affiliate_banners_banners.php');
 define('FILENAME_AFFILIATE_BANNERS_BUILD', 'affiliate_banners_build.php');
 define('FILENAME_AFFILIATE_BANNERS_PRODUCT', 'affiliate_banners_product.php');
 define('FILENAME_AFFILIATE_BANNERS_TEXT', 'affiliate_banners_text.php');
 define('FILENAME_AFFILIATE_SHOW_BANNER', 'affiliate_show_banner.php');

 define('FILENAME_AFFILIATE_REPORTS', 'affiliate_reports.php');
 define('FILENAME_AFFILIATE_CLICKS', 'affiliate_clicks.php');
 define('FILENAME_AFFILIATE_VALIDPRODUCTS', 'affiliate_validproducts.php');

 define('FILENAME_AFFILIATE_PASSWORD', 'affiliate_password.php');
 define('FILENAME_AFFILIATE_PASSWORD_FORGOTTEN', 'affiliate_password_forgotten.php');

 define('FILENAME_AFFILIATE_LOGOUT', 'affiliate_logout.php');
 define('FILENAME_AFFILIATE_SALES', 'affiliate_sales.php');
 define('FILENAME_AFFILIATE_SIGNUP', 'affiliate_signup.php');

 define('FILENAME_AFFILIATE_SIGNUP_OK', 'affiliate_signup_ok.php');
 define('FILENAME_AFFILIATE_PAYMENT', 'affiliate_payment.php');

// include the language translations
 require(DIR_WS_LANGUAGES . 'affiliate_' . $language . '.php');

 $affiliate_clientdate = (date ("Y-m-d H:i:s"));
 $affiliate_clientbrowser = $HTTP_SERVER_VARS["HTTP_USER_AGENT"];
 $affiliate_clientip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
 $affiliate_clientreferer = $HTTP_SERVER_VARS["HTTP_REFERER"];

 if (!$HTTP_SESSION_VARS['affiliate_ref']) {
   tep_session_register('affiliate_ref');
   tep_session_register('affiliate_clickthroughs_id');
   if (($HTTP_GET_VARS['ref'] || $HTTP_POST_VARS['ref'])) {
     if ($HTTP_GET_VARS['ref']) $affiliate_ref = $HTTP_GET_VARS['ref'];
     if ($HTTP_POST_VARS['ref']) $affiliate_ref = $HTTP_POST_VARS['ref'];
     if ($HTTP_GET_VARS['products_id']) $affiliate_products_id = $HTTP_GET_VARS['products_id'];
     if ($HTTP_POST_VARS['products_id']) $affiliate_products_id = $HTTP_POST_VARS['products_id'];
     if ($HTTP_GET_VARS['affiliate_banner_id']) $affiliate_banner_id = $HTTP_GET_VARS['affiliate_banner_id'];
     if ($HTTP_POST_VARS['affiliate_banner_id']) $affiliate_banner_id = $HTTP_POST_VARS['affiliate_banner_id'];

     if (!$link_to) $link_to = "0";
     $sql_data_array = array('affiliate_id' => $affiliate_ref,
                             'affiliate_clientdate' => $affiliate_clientdate,
                             'affiliate_clientbrowser' => $affiliate_clientbrowser,
                             'affiliate_clientip' => $affiliate_clientip,
                             'affiliate_clientreferer' => $affiliate_clientreferer,
                             'affiliate_products_id' => $affiliate_products_id,
                             'affiliate_banner_id' => $affiliate_banner_id);
     tep_db_perform(TABLE_AFFILIATE_CLICKTHROUGHS, $sql_data_array);
     $affiliate_clickthroughs_id = tep_db_insert_id();

  // Banner has been clicked, update stats:
     if ($affiliate_banner_id && $affiliate_ref) {
       $today = date('Y-m-d');
       $sql = "select * from " . TABLE_AFFILIATE_BANNERS_HISTORY . " where affiliate_banners_id = '" . $affiliate_banner_id  . "' and  affiliate_banners_affiliate_id = '" . $affiliate_ref . "' and affiliate_banners_history_date = '" . $today . "'";
       $banner_stats_query = tep_db_query($sql);

    // Banner has been shown today
       if (tep_db_fetch_array($banner_stats_query)) {
       tep_db_query("update " . TABLE_AFFILIATE_BANNERS_HISTORY . " set affiliate_banners_clicks = affiliate_banners_clicks + 1 where affiliate_banners_id = '" . $affiliate_banner_id . "' and affiliate_banners_affiliate_id = '" . $affiliate_ref. "' and affiliate_banners_history_date = '" . $today . "'");
  // Initial entry if banner has not been shown
     } else {
       $sql_data_array = array('affiliate_banners_id' => $affiliate_banner_id,
                               'affiliate_banners_products_id' => $affiliate_products_id,
                               'affiliate_banners_affiliate_id' => $affiliate_ref,
                               'affiliate_banners_clicks' => '1',
                               'affiliate_banners_history_date' => $today);
       tep_db_perform(TABLE_AFFILIATE_BANNERS_HISTORY, $sql_data_array);
     }
   }

// Set Cookie if the customer comes back and orders it counts
   setcookie('affiliate_ref', $affiliate_ref, time() + AFFILIATE_COOKIE_LIFETIME);
   }
   if ($HTTP_COOKIE_VARS['affiliate_ref']) { // Customer comes back and is registered in cookie
     $affiliate_ref = $HTTP_COOKIE_VARS['affiliate_ref'];
   }
 }

////
// Compatibility to older Snapshots

// set the type of request (secure or not)
 if (!isset($request_type)) $request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

// Emulate the breadcrumb class
 if (!class_exists(breadcrumb)) {
   class breadcrumb {
     function add($title, $link = '') {
       global $location;
       $location='» <a href="' . $link . '" class="headerNavigation">' . $title . '</a>';
     }
   }
   $breadcrumb = new breadcrumb;
 }
?>

Share this post


Link to post
Share on other sites

Is there really NO ONE who can help me with this?

 

I've been fooling with this since yesterday.

 

I've uninstalled and reinstalled the affiliate module.

 

I've gone through the instructions with a fine-tooth comb.

 

I'm still getting this message when I try to log in to admin:

 

Warning: main(includes/affiliate_application_top.php): failed to open stream: No such file or directory in /home/bgsoycan/public_html/ecommerce/os/catalog/admin/includes/application_top.php on line 209

 

Warning: main(includes/affiliate_application_top.php): failed to open stream: No such file or directory in /home/bgsoycan/public_html/ecommerce/os/catalog/admin/includes/application_top.php on line 209

 

Fatal error: main(): Failed opening required 'includes/affiliate_application_top.php' (include_path='.:/usr/local/lib/php') in /home/bgsoycan/public_html/ecommerce/os/catalog/admin/includes/application_top.php on line 209

 

Yes, I have installed includes/affiliate_application_top.php and yes I did change application_top.php, in all the places it said to change it.

 

PLEASE, ANYONE???????

Share this post


Link to post
Share on other sites

Someone suggested my problem may be in one of my configure files.

this is catalog/includes

<?php
/*
 $Id: configure.php,v 1.14 2003/07/09 01:15:48 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
 define('HTTP_SERVER', ''); // eg, http://localhost - should not be empty for productive servers
 define('HTTPS_SERVER', ''); // eg, https://localhost - should not be empty for productive servers
 define('ENABLE_SSL', false); // secure webserver for checkout procedure?
 define('HTTP_COOKIE_DOMAIN', '');
 define('HTTPS_COOKIE_DOMAIN', '');
 define('HTTP_COOKIE_PATH', '');
 define('HTTPS_COOKIE_PATH', '');
 define('DIR_WS_HTTP_CATALOG', '');
 define('DIR_WS_HTTPS_CATALOG', '');
 define('DIR_WS_IMAGES', 'images/');
 define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
 define('DIR_WS_INCLUDES', 'includes/');
 define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
 define('DIR_FS_CATALOG', dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']));
 define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
 define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection
 define('DB_SERVER', ''); // eg, localhost - should not be empty for productive servers
 define('DB_SERVER_USERNAME', '');
 define('DB_SERVER_PASSWORD', '');
 define('DB_DATABASE', 'osCommerce');
 define('USE_PCONNECT', 'false'); // use persistent connections?
 define('STORE_SESSIONS', ''); // leave empty '' for default handler or set to 'mysql'
?>

 

and this is catalog/admin/configuration

<?php
/*
 $Id: configuration.php,v 1.43 2003/06/29 22:50:51 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');

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 if (tep_not_null($action)) {
   switch ($action) {
     case 'save':
       $configuration_value = tep_db_prepare_input($HTTP_POST_VARS['configuration_value']);
       $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);

       tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . tep_db_input($configuration_value) . "', last_modified = now() where configuration_id = '" . (int)$cID . "'");

       tep_redirect(tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cID));
       break;
   }
 }

 $gID = (isset($HTTP_GET_VARS['gID'])) ? $HTTP_GET_VARS['gID'] : 1;

 $cfg_group_query = tep_db_query("select configuration_group_title from " . TABLE_CONFIGURATION_GROUP . " where configuration_group_id = '" . (int)$gID . "'");
 $cfg_group = tep_db_fetch_array($cfg_group_query);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo $cfg_group['configuration_group_title']; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr class="dataTableHeadingRow">
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_TITLE; ?></td>
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_VALUE; ?></td>
               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
             </tr>
<?php
 $configuration_query = tep_db_query("select configuration_id, configuration_title, configuration_value, use_function from " . TABLE_CONFIGURATION . " where configuration_group_id = '" . (int)$gID . "' order by sort_order");
 while ($configuration = tep_db_fetch_array($configuration_query)) {
   if (tep_not_null($configuration['use_function'])) {
     $use_function = $configuration['use_function'];
     if (ereg('->', $use_function)) {
       $class_method = explode('->', $use_function);
       if (!is_object(${$class_method[0]})) {
         include(DIR_WS_CLASSES . $class_method[0] . '.php');
         ${$class_method[0]} = new $class_method[0]();
       }
       $cfgValue = tep_call_function($class_method[1], $configuration['configuration_value'], ${$class_method[0]});
     } else {
       $cfgValue = tep_call_function($use_function, $configuration['configuration_value']);
     }
   } else {
     $cfgValue = $configuration['configuration_value'];
   }

   if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $configuration['configuration_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
     $cfg_extra_query = tep_db_query("select configuration_key, configuration_description, date_added, last_modified, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_id = '" . (int)$configuration['configuration_id'] . "'");
     $cfg_extra = tep_db_fetch_array($cfg_extra_query);

     $cInfo_array = array_merge($configuration, $cfg_extra);
     $cInfo = new objectInfo($cInfo_array);
   }

   if ( (isset($cInfo) && is_object($cInfo)) && ($configuration['configuration_id'] == $cInfo->configuration_id) ) {
     echo '                  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit') . '\'">' . "\n";
   } else {
     echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $configuration['configuration_id']) . '\'">' . "\n";
   }
?>
               <td class="dataTableContent"><?php echo $configuration['configuration_title']; ?></td>
               <td class="dataTableContent"><?php echo htmlspecialchars($cfgValue); ?></td>
               <td class="dataTableContent" align="right"><?php if ( (isset($cInfo) && is_object($cInfo)) && ($configuration['configuration_id'] == $cInfo->configuration_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $configuration['configuration_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
             </tr>
<?php
 }
?>
           </table></td>
<?php
 $heading = array();
 $contents = array();

 switch ($action) {
   case 'edit':
     $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');

     if ($cInfo->set_function) {
       eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");');
     } else {
       $value_field = tep_draw_input_field('configuration_value', $cInfo->configuration_value);
     }

     $contents = array('form' => tep_draw_form('configuration', FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=save'));
     $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
     $contents[] = array('text' => '<br><b>' . $cInfo->configuration_title . '</b><br>' . $cInfo->configuration_description . '<br>' . $value_field);
     $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
   default:
     if (isset($cInfo) && is_object($cInfo)) {
       $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');

       $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CONFIGURATION, 'gID=' . $HTTP_GET_VARS['gID'] . '&cID=' . $cInfo->configuration_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
       $contents[] = array('text' => '<br>' . $cInfo->configuration_description);
       $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added));
       if (tep_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_INFO_LAST_MODIFIED . ' ' . tep_date_short($cInfo->last_modified));
     }
     break;
 }

 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
   echo '            <td width="25%" valign="top">' . "\n";

   $box = new box;
   echo $box->infoBox($heading, $contents);

   echo '            </td>' . "\n";
 }
?>
         </tr>
       </table></td>
     </tr>
   </table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

This is my

catalog/includes/application_top.php

<?php
/*
 $Id: application_top.php,v 1.280 2003/07/12 09:38:07 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// start the timer for the page parse time log
 define('PAGE_PARSE_START_TIME', microtime());

// set the level of error reporting
 error_reporting(E_ALL & ~E_NOTICE);

// check if register_globals is enabled.
// since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
 if (function_exists('ini_get')) {
   ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');
 }

// Set the local configuration parameters - mainly for developers
 if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');

// include server parameters
 require('includes/configure.php');

 if (strlen(DB_SERVER) < 1) {
   if (is_dir('install')) {
     header('Location: install/index.php');
   }
 }

// define the project version
 define('PROJECT_VERSION', 'osCommerce 2.2-MS2');

// set the type of request (secure or not)
 $request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

// set php_self in the local scope
 if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];

 if ($request_type == 'NONSSL') {
   define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
 } else {
   define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
 }

// include the list of project filenames
 require(DIR_WS_INCLUDES . 'filenames.php');

// include the list of project database tables
 require(DIR_WS_INCLUDES . 'database_tables.php');

// customization for the design layout
 define('BOX_WIDTH', 150); // how wide the boxes should be in pixels (default: 125)

// include the database functions
 require(DIR_WS_FUNCTIONS . 'database.php');

// make a connection to the database... now
 tep_db_connect() or die('Unable to connect to database server!');

// set the application parameters
 $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
 while ($configuration = tep_db_fetch_array($configuration_query)) {
   define($configuration['cfgKey'], $configuration['cfgValue']);
 }

// if gzip_compression is enabled, start to buffer the output
 if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') ) {
   if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {
     if (PHP_VERSION >= '4.0.4') {
       ob_start('ob_gzhandler');
     } else {
       include(DIR_WS_FUNCTIONS . 'gzip_compression.php');
       ob_start();
       ob_implicit_flush();
     }
   } else {
     ini_set('zlib.output_compression_level', GZIP_LEVEL);
   }
 }

// set the HTTP GET parameters manually if search_engine_friendly_urls is enabled
 if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
   if (strlen(getenv('PATH_INFO')) > 1) {
     $GET_array = array();
     $PHP_SELF = str_replace(getenv('PATH_INFO'), '', $PHP_SELF);
     $vars = explode('/', substr(getenv('PATH_INFO'), 1));
     for ($i=0, $n=sizeof($vars); $i<$n; $i++) {
       if (strpos($vars[$i], '[]')) {
         $GET_array[substr($vars[$i], 0, -2)][] = $vars[$i+1];
       } else {
         $HTTP_GET_VARS[$vars[$i]] = $vars[$i+1];
       }
       $i++;
     }

     if (sizeof($GET_array) > 0) {
       while (list($key, $value) = each($GET_array)) {
         $HTTP_GET_VARS[$key] = $value;
       }
     }
   }
 }

// define general functions used application-wide
 require(DIR_WS_FUNCTIONS . 'general.php');
 require(DIR_WS_FUNCTIONS . 'html_output.php');

// set the cookie domain
 $cookie_domain = (($request_type == 'NONSSL') ? HTTP_COOKIE_DOMAIN : HTTPS_COOKIE_DOMAIN);
 $cookie_path = (($request_type == 'NONSSL') ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH);

// include cache functions if enabled
 if (USE_CACHE == 'true') include(DIR_WS_FUNCTIONS . 'cache.php');

// include shopping cart class
 require(DIR_WS_CLASSES . 'shopping_cart.php');

// include navigation history class
 require(DIR_WS_CLASSES . 'navigation_history.php');

// some code to solve compatibility issues
 require(DIR_WS_FUNCTIONS . 'compatibility.php');

// check if sessions are supported, otherwise use the php3 compatible session class
 if (!function_exists('session_start')) {
   define('PHP_SESSION_NAME', 'osCsid');
   define('PHP_SESSION_PATH', $cookie_path);
   define('PHP_SESSION_DOMAIN', $cookie_domain);
   define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY);

   include(DIR_WS_CLASSES . 'sessions.php');
 }

// define how the session functions will be used
 require(DIR_WS_FUNCTIONS . 'sessions.php');

// set the session name and save path
 tep_session_name('osCsid');
 tep_session_save_path(SESSION_WRITE_DIRECTORY);

// set the session cookie parameters
  if (function_exists('session_set_cookie_params')) {
   session_set_cookie_params(0, $cookie_path, $cookie_domain);
 } elseif (function_exists('ini_set')) {
   ini_set('session.cookie_lifetime', '0');
   ini_set('session.cookie_path', $cookie_path);
   ini_set('session.cookie_domain', $cookie_domain);
 }

// set the session ID if it exists
  if (isset($HTTP_POST_VARS[tep_session_name()])) {
    tep_session_id($HTTP_POST_VARS[tep_session_name()]);
  } elseif ( ($request_type == 'SSL') && isset($HTTP_GET_VARS[tep_session_name()]) ) {
    tep_session_id($HTTP_GET_VARS[tep_session_name()]);
  }

// start the session
 $session_started = false;
 if (SESSION_FORCE_COOKIE_USE == 'True') {
   tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

   if (isset($HTTP_COOKIE_VARS['cookie_test'])) {
     tep_session_start();
     $session_started = true;
   }
 } elseif (SESSION_BLOCK_SPIDERS == 'True') {
   $user_agent = strtolower(getenv('HTTP_USER_AGENT'));
   $spider_flag = false;

   if (tep_not_null($user_agent)) {
     $spiders = file(DIR_WS_INCLUDES . 'spiders.txt');

     for ($i=0, $n=sizeof($spiders); $i<$n; $i++) {
       if (tep_not_null($spiders[$i])) {
         if (is_integer(strpos($user_agent, trim($spiders[$i])))) {
           $spider_flag = true;
           break;
         }
       }
     }
   }

   if ($spider_flag == false) {
     tep_session_start();
     $session_started = true;
   }
 } else {
   tep_session_start();
   $session_started = true;
 }

// set SID once, even if empty
 $SID = (defined('SID') ? SID : '');

// verify the ssl_session_id if the feature is enabled
 if ( ($request_type == 'SSL') && (SESSION_CHECK_SSL_SESSION_ID == 'True') && (ENABLE_SSL == true) && ($session_started == true) ) {
   $ssl_session_id = getenv('SSL_SESSION_ID');
   if (!tep_session_is_registered('SSL_SESSION_ID')) {
     $SESSION_SSL_ID = $ssl_session_id;
     tep_session_register('SESSION_SSL_ID');
   }

   if ($SESSION_SSL_ID != $ssl_session_id) {
     tep_session_destroy();
     tep_redirect(tep_href_link(FILENAME_SSL_CHECK));
   }
 }

// verify the browser user agent if the feature is enabled
 if (SESSION_CHECK_USER_AGENT == 'True') {
   $http_user_agent = getenv('HTTP_USER_AGENT');
   if (!tep_session_is_registered('SESSION_USER_AGENT')) {
     $SESSION_USER_AGENT = $http_user_agent;
     tep_session_register('SESSION_USER_AGENT');
   }

   if ($SESSION_USER_AGENT != $http_user_agent) {
     tep_session_destroy();
     tep_redirect(tep_href_link(FILENAME_LOGIN));
   }
 }

// verify the IP address if the feature is enabled
 if (SESSION_CHECK_IP_ADDRESS == 'True') {
   $ip_address = tep_get_ip_address();
   if (!tep_session_is_registered('SESSION_IP_ADDRESS')) {
     $SESSION_IP_ADDRESS = $ip_address;
     tep_session_register('SESSION_IP_ADDRESS');
   }

   if ($SESSION_IP_ADDRESS != $ip_address) {
     tep_session_destroy();
     tep_redirect(tep_href_link(FILENAME_LOGIN));
   }
 }

// create the shopping cart & fix the cart if necesary
 if (tep_session_is_registered('cart') && is_object($cart)) {
   if (PHP_VERSION < 4) {
     $broken_cart = $cart;
     $cart = new shoppingCart;
     $cart->unserialize($broken_cart);
   }
 } else {
   tep_session_register('cart');
   $cart = new shoppingCart;
 }

// include currencies class and create an instance
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

// include the mail classes
 require(DIR_WS_CLASSES . 'mime.php');
 require(DIR_WS_CLASSES . 'email.php');

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
   if (!tep_session_is_registered('language')) {
     tep_session_register('language');
     tep_session_register('languages_id');
   }

   include(DIR_WS_CLASSES . 'language.php');
   $lng = new language();

   if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
     $lng->set_language($HTTP_GET_VARS['language']);
   } else {
     $lng->get_browser_language();
   }

   $language = $lng->language['directory'];
   $languages_id = $lng->language['id'];
 }

// include the language translations
 require(DIR_WS_LANGUAGES . $language . '.php');

// currency
 if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {
   if (!tep_session_is_registered('currency')) tep_session_register('currency');

   if (isset($HTTP_GET_VARS['currency'])) {
     if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
   } else {
     $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
   }
 }

// navigation history
 if (tep_session_is_registered('navigation')) {
   if (PHP_VERSION < 4) {
     $broken_navigation = $navigation;
     $navigation = new navigationHistory;
     $navigation->unserialize($broken_navigation);
   }
 } else {
   tep_session_register('navigation');
   $navigation = new navigationHistory;
 }
 $navigation->add_current_page();

// Shopping cart actions
 if (isset($HTTP_GET_VARS['action'])) {
// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
   if ($session_started == false) {
     tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
   }

   if (DISPLAY_CART == 'true') {
     $goto =  FILENAME_SHOPPING_CART;
     $parameters = array('action', 'cPath', 'products_id', 'pid');
   } else {
     $goto = basename($PHP_SELF);
     if ($HTTP_GET_VARS['action'] == 'buy_now') {
       $parameters = array('action', 'pid', 'products_id');
     } else {
       $parameters = array('action', 'pid');
     }
   }
   switch ($HTTP_GET_VARS['action']) {
     // customer wants to update the product quantity in their shopping cart
     case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {
                               if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {
                                 $cart->remove($HTTP_POST_VARS['products_id'][$i]);
                               } else {
                                 if (PHP_VERSION < 4) {
                                   // if PHP3, make correction for lack of multidimensional array.
                                   reset($HTTP_POST_VARS);
                                   while (list($key, $value) = each($HTTP_POST_VARS)) {
                                     if (is_array($value)) {
                                       while (list($key2, $value2) = each($value)) {
                                         if (ereg ("(.*)\]\[(.*)", $key2, $var)) {
                                           $id2[$var[1]][$var[2]] = $value2;
                                         }
                                       }
                                     }
                                   }
                                   $attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';
                                 } else {
                                   $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
                                 }
                                 $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
     // customer adds a product from the products page
     case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                               $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
     // performed by the 'buy now' button in product listings and review page
     case 'buy_now' :        if (isset($HTTP_GET_VARS['products_id'])) {
                               if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
                                 tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
                               } else {
                                 $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
     case 'notify' :         if (tep_session_is_registered('customer_id')) {
                               if (isset($HTTP_GET_VARS['products_id'])) {
                                 $notify = $HTTP_GET_VARS['products_id'];
                               } elseif (isset($HTTP_GET_VARS['notify'])) {
                                 $notify = $HTTP_GET_VARS['notify'];
                               } elseif (isset($HTTP_POST_VARS['notify'])) {
                                 $notify = $HTTP_POST_VARS['notify'];
                               } else {
                                 tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
                               }
                               if (!is_array($notify)) $notify = array($notify);
                               for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
                                 $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'");
                                 $check = tep_db_fetch_array($check_query);
                                 if ($check['count'] < 1) {
                                   tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");
                                 }
                               }
                               tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
                             } else {
                               $navigation->set_snapshot();
                               tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
                             }
                             break;
     case 'notify_remove' :  if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) {
                               $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                               $check = tep_db_fetch_array($check_query);
                               if ($check['count'] > 0) {
                                 tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                               }
                               tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));
                             } else {
                               $navigation->set_snapshot();
                               tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
                             }
                             break;
     case 'cust_order' :     if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
                               if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
                                 tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
                               } else {
                                 $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
   }
 }

// include the who's online functions
 require(DIR_WS_FUNCTIONS . 'whos_online.php');
 tep_update_whos_online();

// include the password crypto functions
 require(DIR_WS_FUNCTIONS . 'password_funcs.php');

// include validation functions (right now only email address)
 require(DIR_WS_FUNCTIONS . 'validations.php');

// split-page-results
 require(DIR_WS_CLASSES . 'split_page_results.php');

// infobox
 require(DIR_WS_CLASSES . 'boxes.php');

// auto activate and expire banners
 require(DIR_WS_FUNCTIONS . 'banner.php');
 tep_activate_banners();
 tep_expire_banners();

// auto expire special products
 require(DIR_WS_FUNCTIONS . 'specials.php');
 tep_expire_specials();

// calculate category path
 if (isset($HTTP_GET_VARS['cPath'])) {
   $cPath = $HTTP_GET_VARS['cPath'];
 } elseif (isset($HTTP_GET_VARS['products_id']) && !isset($HTTP_GET_VARS['manufacturers_id'])) {
   $cPath = tep_get_product_path($HTTP_GET_VARS['products_id']);
 } else {
   $cPath = '';
 }

 if (tep_not_null($cPath)) {
   $cPath_array = tep_parse_category_path($cPath);
   $cPath = implode('_', $cPath_array);
   $current_category_id = $cPath_array[(sizeof($cPath_array)-1)];
 } else {
   $current_category_id = 0;
 }

// include the breadcrumb class and start the breadcrumb trail
 require(DIR_WS_CLASSES . 'breadcrumb.php');
 $breadcrumb = new breadcrumb;

 $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
 $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

// add category names or the manufacturer name to the breadcrumb trail
 if (isset($cPath_array)) {
   for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) {
     $categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'");
     if (tep_db_num_rows($categories_query) > 0) {
       $categories = tep_db_fetch_array($categories_query);
       $breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));
     } else {
       break;
     }
   }
 } elseif (isset($HTTP_GET_VARS['manufacturers_id'])) {
   $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
   if (tep_db_num_rows($manufacturers_query)) {
     $manufacturers = tep_db_fetch_array($manufacturers_query);
     $breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));
   }
 }

// add the products model to the breadcrumb trail
 if (isset($HTTP_GET_VARS['products_id'])) {
   $model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   if (tep_db_num_rows($model_query)) {
     $model = tep_db_fetch_array($model_query);
     $breadcrumb->add($model['products_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
   }
 }

// initialize the message stack for output messages
 require(DIR_WS_CLASSES . 'message_stack.php');
 $messageStack = new messageStack;

// set which precautions should be checked
 define('WARN_INSTALL_EXISTENCE', 'true');
 define('WARN_CONFIG_WRITEABLE', 'true');
 define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE', 'true');
 define('WARN_SESSION_AUTO_START', 'true');
 define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true');
 // Include OSC-AFFILIATE
 require(DIR_WS_INCLUDES . 'affiliate_application_top.php');
?>

 

this is catalog/admin/includes/application_top.php

<?php
/*
 $Id: application_top.php,v 1.162 2003/07/12 09:39:03 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// Start the clock for the page parse time log
 define('PAGE_PARSE_START_TIME', microtime());

// Set the level of error reporting
 error_reporting(E_ALL & ~E_NOTICE);

// Check if register_globals is enabled.
// Since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
 if (function_exists('ini_get')) {
   ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');
 }

// Set the local configuration parameters - mainly for developers
 if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');

// Include application configuration parameters
 require('includes/configure.php');

// Define the project version
 define('PROJECT_VERSION', 'osCommerce 2.2-MS2');

// set php_self in the local scope
 $PHP_SELF = (isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME']);

// Used in the "Backup Manager" to compress backups
 define('LOCAL_EXE_GZIP', '/usr/bin/gzip');
 define('LOCAL_EXE_GUNZIP', '/usr/bin/gunzip');
 define('LOCAL_EXE_ZIP', '/usr/local/bin/zip');
 define('LOCAL_EXE_UNZIP', '/usr/local/bin/unzip');

// include the list of project filenames
 require(DIR_WS_INCLUDES . 'filenames.php');

// include the list of project database tables
 require(DIR_WS_INCLUDES . 'database_tables.php');

// customization for the design layout
 define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125)

// Define how do we update currency exchange rates
// Possible values are 'oanda' 'xe' or ''
 define('CURRENCY_SERVER_PRIMARY', 'oanda');
 define('CURRENCY_SERVER_BACKUP', 'xe');

// include the database functions
 require(DIR_WS_FUNCTIONS . 'database.php');

// make a connection to the database... now
 tep_db_connect() or die('Unable to connect to database server!');

// set application wide parameters
 $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
 while ($configuration = tep_db_fetch_array($configuration_query)) {
   define($configuration['cfgKey'], $configuration['cfgValue']);
 }

// define our general functions used application-wide
 require(DIR_WS_FUNCTIONS . 'general.php');
 require(DIR_WS_FUNCTIONS . 'html_output.php');

// initialize the logger class
 require(DIR_WS_CLASSES . 'logger.php');

// include shopping cart class
 require(DIR_WS_CLASSES . 'shopping_cart.php');

// some code to solve compatibility issues
 require(DIR_WS_FUNCTIONS . 'compatibility.php');

// check to see if php implemented session management functions - if not, include php3/php4 compatible session class
 if (!function_exists('session_start')) {
   define('PHP_SESSION_NAME', 'osCAdminID');
   define('PHP_SESSION_PATH', '/');
   define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY);

   include(DIR_WS_CLASSES . 'sessions.php');
 }

// define how the session functions will be used
 require(DIR_WS_FUNCTIONS . 'sessions.php');

// set the session name and save path
 tep_session_name('osCAdminID');
 tep_session_save_path(SESSION_WRITE_DIRECTORY);

// set the session cookie parameters
  if (function_exists('session_set_cookie_params')) {
   session_set_cookie_params(0, DIR_WS_ADMIN);
 } elseif (function_exists('ini_set')) {
   ini_set('session.cookie_lifetime', '0');
   ini_set('session.cookie_path', DIR_WS_ADMIN);
 }

// lets start our session
 tep_session_start();

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
   if (!tep_session_is_registered('language')) {
     tep_session_register('language');
     tep_session_register('languages_id');
   }

   include(DIR_WS_CLASSES . 'language.php');
   $lng = new language();

   if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
     $lng->set_language($HTTP_GET_VARS['language']);
   } else {
     $lng->get_browser_language();
   }

   $language = $lng->language['directory'];
   $languages_id = $lng->language['id'];
 }

// include the language translations
 require(DIR_WS_LANGUAGES . $language . '.php');
 $current_page = basename($PHP_SELF);
 if (file_exists(DIR_WS_LANGUAGES . $language . '/' . $current_page)) {
   include(DIR_WS_LANGUAGES . $language . '/' . $current_page);
 }

// define our localization functions
 require(DIR_WS_FUNCTIONS . 'localization.php');

// Include validation functions (right now only email address)
 require(DIR_WS_FUNCTIONS . 'validations.php');

// setup our boxes
 require(DIR_WS_CLASSES . 'table_block.php');
 require(DIR_WS_CLASSES . 'box.php');

// initialize the message stack for output messages
 require(DIR_WS_CLASSES . 'message_stack.php');
 $messageStack = new messageStack;

// split-page-results
 require(DIR_WS_CLASSES . 'split_page_results.php');

// entry/item info classes
 require(DIR_WS_CLASSES . 'object_info.php');

// email classes
 require(DIR_WS_CLASSES . 'mime.php');
 require(DIR_WS_CLASSES . 'email.php');

// file uploading class
 require(DIR_WS_CLASSES . 'upload.php');

// calculate category path
 if (isset($HTTP_GET_VARS['cPath'])) {
   $cPath = $HTTP_GET_VARS['cPath'];
 } else {
   $cPath = '';
 }

 if (tep_not_null($cPath)) {
   $cPath_array = tep_parse_category_path($cPath);
   $cPath = implode('_', $cPath_array);
   $current_category_id = $cPath_array[(sizeof($cPath_array)-1)];
 } else {
   $current_category_id = 0;
 }

// default open navigation box
 if (!tep_session_is_registered('selected_box')) {
   tep_session_register('selected_box');
   $selected_box = 'configuration';
 }

 if (isset($HTTP_GET_VARS['selected_box'])) {
   $selected_box = $HTTP_GET_VARS['selected_box'];
 }

// the following cache blocks are used in the Tools->Cache section
// ('language' in the filename is automatically replaced by available languages)
 $cache_blocks = array(array('title' => TEXT_CACHE_CATEGORIES, 'code' => 'categories', 'file' => 'categories_box-language.cache', 'multiple' => true),
                       array('title' => TEXT_CACHE_MANUFACTURERS, 'code' => 'manufacturers', 'file' => 'manufacturers_box-language.cache', 'multiple' => true),
                       array('title' => TEXT_CACHE_ALSO_PURCHASED, 'code' => 'also_purchased', 'file' => 'also_purchased-language.cache', 'multiple' => true)
                      );

// check if a default currency is set
 if (!defined('DEFAULT_CURRENCY')) {
   $messageStack->add(ERROR_NO_DEFAULT_CURRENCY_DEFINED, 'error');
 }

// check if a default language is set
 if (!defined('DEFAULT_LANGUAGE')) {
   $messageStack->add(ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
 }

 if (function_exists('ini_get') && ((bool)ini_get('file_uploads') == false) ) {
   $messageStack->add(WARNING_FILE_UPLOADS_DISABLED, 'warning');
 }
 // Include OSC-AFFILIATE
 require('includes/affiliate_application_top.php');
?>

Share this post


Link to post
Share on other sites

this is

admin/includes/affiliate_application_top.php

<?php
/*
 $Id: affiliate_application_top.php,v 2.00 2003/10/12

 OSC-Affiliate

 Contribution based on:

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

 Copyright (c) 2002 - 2003 osCommerce

 Released under the GNU General Public License
*/

// Set the local configuration parameters - mainly for developers
 if (file_exists(DIR_WS_INCLUDES . 'local/affiliate_configure.php')) include(DIR_WS_INCLUDES . 'local/affiliate_configure.php');

 require(DIR_WS_INCLUDES . 'affiliate_configure.php');
 require(DIR_WS_FUNCTIONS . 'affiliate_functions.php');

 define('FILENAME_AFFILIATE', 'affiliate_affiliates.php');
 define('FILENAME_AFFILIATE_BANNERS', 'affiliate_banners.php');
 define('FILENAME_AFFILIATE_BANNER_MANAGER', 'affiliate_banners.php');
 define('TABLE_AFFILIATE_NEWS_CONTENTS', 'affiliate_news_contents');
 define('FILENAME_AFFILIATE_CLICKS', 'affiliate_clicks.php');
 define('FILENAME_AFFILIATE_CONTACT', 'affiliate_contact.php');
 define('FILENAME_AFFILIATE_HELP_1', 'affiliate_help1.php');
 define('FILENAME_AFFILIATE_HELP_2', 'affiliate_help2.php');
 define('FILENAME_AFFILIATE_HELP_3', 'affiliate_help3.php');
 define('FILENAME_AFFILIATE_HELP_4', 'affiliate_help4.php');
 define('FILENAME_AFFILIATE_HELP_5', 'affiliate_help5.php');
 define('FILENAME_AFFILIATE_HELP_6', 'affiliate_help6.php');
 define('FILENAME_AFFILIATE_HELP_7', 'affiliate_help7.php');
 define('FILENAME_AFFILIATE_HELP_8', 'affiliate_help8.php');
 define('FILENAME_AFFILIATE_INVOICE', 'affiliate_invoice.php');
 define('FILENAME_AFFILIATE_NEWS', 'affiliate_news.php');
 define('FILENAME_AFFILIATE_NEWSLETTERS', 'affiliate_newsletters.php');
 define('FILENAME_AFFILIATE_PAYMENT', 'affiliate_payment.php');
 define('FILENAME_AFFILIATE_POPUP_IMAGE', 'affiliate_popup_image.php');
 define('FILENAME_AFFILIATE_SALES', 'affiliate_sales.php');
 define('FILENAME_AFFILIATE_STATISTICS', 'affiliate_statistics.php');
 define('FILENAME_AFFILIATE_SUMMARY', 'affiliate_summary.php');
 define('FILENAME_AFFILIATE_RESET', 'affiliate_reset.php');
 define('FILENAME_AFFILIATE_VALIDPRODUCTS', 'affiliate_validproducts.php');

 define('FILENAME_CATALOG_AFFILIATE_PAYMENT_INFO','affiliate_payment.php');
 define('FILENAME_CATALOG_PRODUCT_INFO', 'product_info.php');

 define('TABLE_AFFILIATE', 'affiliate_affiliate');
 define('TABLE_AFFILIATE_NEWS', 'affiliate_news');
 define('TABLE_AFFILIATE_NEWSLETTERS', 'affiliate_newsletters');
 define('TABLE_AFFILIATE_BANNERS', 'affiliate_banners');
 define('TABLE_AFFILIATE_BANNERS_HISTORY', 'affiliate_banners_history');
 define('TABLE_AFFILIATE_CLICKTHROUGHS', 'affiliate_clickthroughs');
 define('TABLE_AFFILIATE_PAYMENT', 'affiliate_payment');
 define('TABLE_AFFILIATE_PAYMENT_STATUS', 'affiliate_payment_status');
 define('TABLE_AFFILIATE_PAYMENT_STATUS_HISTORY', 'affiliate_payment_status_history');
 define('TABLE_AFFILIATE_SALES', 'affiliate_sales');

// include the language translations
 require(DIR_WS_LANGUAGES . 'affiliate_' . $language . '.php');

// If an order is deleted delete the sale too (optional)
 if ($HTTP_GET_VARS['action'] == 'deleteconfirm' && basename($HTTP_SERVER_VARS['SCRIPT_FILENAME']) == FILENAME_ORDERS && AFFILIATE_DELETE_ORDERS == 'true') {
   $affiliate_oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
   tep_db_query("delete from " . TABLE_AFFILIATE_SALES . " where affiliate_orders_id = '" . tep_db_input($affiliate_oID) . "' and affiliate_billing_status != 1");
 }
?>

 

and this is

cataolg/includes/affiliate_application_top.php

<?php
/*
 $Id: affiliate_application_top.php,v 2.00 2003/10/12

 OSC-Affiliate

 Contribution based on:

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

 Copyright (c) 2002 - 2003 osCommerce

 Released under the GNU General Public License
*/


// Set the local configuration parameters - mainly for developers
 if (file_exists(DIR_WS_INCLUDES . 'local/affiliate_configure.php')) include(DIR_WS_INCLUDES . 'local/affiliate_configure.php');

 require(DIR_WS_INCLUDES . 'affiliate_configure.php');
 require(DIR_WS_FUNCTIONS . 'affiliate_functions.php');

// define the database table names used in the contribution
 define('TABLE_AFFILIATE', 'affiliate_affiliate');
 define('TABLE_AFFILIATE_NEWS', 'affiliate_news');

// if you change this -> affiliate_show_banner must be changed too
 define('TABLE_AFFILIATE_BANNERS', 'affiliate_banners');
 define('TABLE_AFFILIATE_BANNERS_HISTORY', 'affiliate_banners_history');
 define('TABLE_AFFILIATE_CLICKTHROUGHS', 'affiliate_clickthroughs');
 define('TABLE_AFFILIATE_SALES', 'affiliate_sales');
 define('TABLE_AFFILIATE_PAYMENT', 'affiliate_payment');
 define('TABLE_AFFILIATE_PAYMENT_STATUS', 'affiliate_payment_status');
 define('TABLE_AFFILIATE_PAYMENT_STATUS_HISTORY', 'affiliate_payment_status_history');

// define the filenames used in the project
 define('FILENAME_AFFILIATE_SUMMARY', 'affiliate_summary.php');
 define('FILENAME_AFFILIATE_LOGOUT', 'affiliate_logout.php');
 define('FILENAME_AFFILIATE', 'affiliate_affiliate.php'); 
 define('FILENAME_AFFILIATE_CONTACT', 'affiliate_contact.php');
 define('FILENAME_AFFILIATE_FAQ', 'affiliate_faq.php');
 define('FILENAME_AFFILIATE_ACCOUNT', 'affiliate_details.php');
 define('FILENAME_AFFILIATE_DETAILS', 'affiliate_details.php');
 define('FILENAME_AFFILIATE_DETAILS_OK', 'affiliate_details_ok.php');
 define('FILENAME_AFFILIATE_TERMS','affiliate_terms.php');
 define('FILENAME_AFFILIATE_TERMS_POPUP','affiliate_terms_popup.php');
 define('FILENAME_AFFILIATE_NEWS', 'affiliate_news.php');
 define('FILENAME_AFFILIATE_NEWSLETTER', 'affiliate_newsletter.php');

 define('FILENAME_AFFILIATE_HELP_1', 'affiliate_help1.php');
 define('FILENAME_AFFILIATE_HELP_2', 'affiliate_help2.php');
 define('FILENAME_AFFILIATE_HELP_3', 'affiliate_help3.php');
 define('FILENAME_AFFILIATE_HELP_4', 'affiliate_help4.php');
 define('FILENAME_AFFILIATE_HELP_5', 'affiliate_help5.php');
 define('FILENAME_AFFILIATE_HELP_6', 'affiliate_help6.php');
 define('FILENAME_AFFILIATE_HELP_7', 'affiliate_help7.php');
 define('FILENAME_AFFILIATE_HELP_8', 'affiliate_help8.php');
 define('FILENAME_AFFILIATE_HELP_9', 'affiliate_help9.php');
 define('FILENAME_AFFILIATE_HELP_10', 'affiliate_help10.php');
 define('FILENAME_AFFILIATE_HELP_11', 'affiliate_help11.php');
 define('FILENAME_AFFILIATE_HELP_12', 'affiliate_help12.php');
 define('FILENAME_AFFILIATE_HELP_13', 'affiliate_help13.php');
 define('FILENAME_AFFILIATE_HELP_14', 'affiliate_help14.php');
 define('FILENAME_AFFILIATE_HELP_15', 'affiliate_help15.php');
 define('FILENAME_AFFILIATE_HELP_16', 'affiliate_help16.php');
 define('FILENAME_AFFILIATE_HELP_17', 'affiliate_help17.php');
 define('FILENAME_AFFILIATE_HELP_18', 'affiliate_help18.php');
 define('FILENAME_AFFILIATE_HELP_19', 'affiliate_help19.php');
 define('FILENAME_AFFILIATE_HELP_20', 'affiliate_help20.php');
 define('FILENAME_AFFILIATE_HELP_21', 'affiliate_help21.php');
 define('FILENAME_AFFILIATE_HELP_22', 'affiliate_help22.php');
define('FILENAME_AFFILIATE_BANNERS_CATEGORY', 'affiliate_banners_category.php');
 define('FILENAME_AFFILIATE_BANNERS_BUILD_CAT', 'affiliate_banners_build_cat.php');
 define('FILENAME_AFFILIATE_VALIDCATS', 'affiliate_validcats.php');
 define('FILENAME_AFFILIATE_INFO', 'affiliate_info.php');
define('TABLE_AFFILIATE_NEWS_CONTENTS', 'affiliate_news_contents');
 define('FILENAME_AFFILIATE_BANNERS', 'affiliate_banners.php');
 define('FILENAME_AFFILIATE_BANNERS_BANNERS', 'affiliate_banners_banners.php');
 define('FILENAME_AFFILIATE_BANNERS_BUILD', 'affiliate_banners_build.php');
 define('FILENAME_AFFILIATE_BANNERS_PRODUCT', 'affiliate_banners_product.php');
 define('FILENAME_AFFILIATE_BANNERS_TEXT', 'affiliate_banners_text.php');
 define('FILENAME_AFFILIATE_SHOW_BANNER', 'affiliate_show_banner.php');

 define('FILENAME_AFFILIATE_REPORTS', 'affiliate_reports.php');
 define('FILENAME_AFFILIATE_CLICKS', 'affiliate_clicks.php');
 define('FILENAME_AFFILIATE_VALIDPRODUCTS', 'affiliate_validproducts.php');

 define('FILENAME_AFFILIATE_PASSWORD', 'affiliate_password.php');
 define('FILENAME_AFFILIATE_PASSWORD_FORGOTTEN', 'affiliate_password_forgotten.php');

 define('FILENAME_AFFILIATE_LOGOUT', 'affiliate_logout.php');
 define('FILENAME_AFFILIATE_SALES', 'affiliate_sales.php');
 define('FILENAME_AFFILIATE_SIGNUP', 'affiliate_signup.php');

 define('FILENAME_AFFILIATE_SIGNUP_OK', 'affiliate_signup_ok.php');
 define('FILENAME_AFFILIATE_PAYMENT', 'affiliate_payment.php');

// include the language translations
 require(DIR_WS_LANGUAGES . 'affiliate_' . $language . '.php');

 $affiliate_clientdate = (date ("Y-m-d H:i:s"));
 $affiliate_clientbrowser = $HTTP_SERVER_VARS["HTTP_USER_AGENT"];
 $affiliate_clientip = $HTTP_SERVER_VARS["REMOTE_ADDR"];
 $affiliate_clientreferer = $HTTP_SERVER_VARS["HTTP_REFERER"];

 if (!$HTTP_SESSION_VARS['affiliate_ref']) {
   tep_session_register('affiliate_ref');
   tep_session_register('affiliate_clickthroughs_id');
   if (($HTTP_GET_VARS['ref'] || $HTTP_POST_VARS['ref'])) {
     if ($HTTP_GET_VARS['ref']) $affiliate_ref = $HTTP_GET_VARS['ref'];
     if ($HTTP_POST_VARS['ref']) $affiliate_ref = $HTTP_POST_VARS['ref'];
     if ($HTTP_GET_VARS['products_id']) $affiliate_products_id = $HTTP_GET_VARS['products_id'];
     if ($HTTP_POST_VARS['products_id']) $affiliate_products_id = $HTTP_POST_VARS['products_id'];
     if ($HTTP_GET_VARS['affiliate_banner_id']) $affiliate_banner_id = $HTTP_GET_VARS['affiliate_banner_id'];
     if ($HTTP_POST_VARS['affiliate_banner_id']) $affiliate_banner_id = $HTTP_POST_VARS['affiliate_banner_id'];

     if (!$link_to) $link_to = "0";
     $sql_data_array = array('affiliate_id' => $affiliate_ref,
                             'affiliate_clientdate' => $affiliate_clientdate,
                             'affiliate_clientbrowser' => $affiliate_clientbrowser,
                             'affiliate_clientip' => $affiliate_clientip,
                             'affiliate_clientreferer' => $affiliate_clientreferer,
                             'affiliate_products_id' => $affiliate_products_id,
                             'affiliate_banner_id' => $affiliate_banner_id);
     tep_db_perform(TABLE_AFFILIATE_CLICKTHROUGHS, $sql_data_array);
     $affiliate_clickthroughs_id = tep_db_insert_id();

  // Banner has been clicked, update stats:
     if ($affiliate_banner_id && $affiliate_ref) {
       $today = date('Y-m-d');
       $sql = "select * from " . TABLE_AFFILIATE_BANNERS_HISTORY . " where affiliate_banners_id = '" . $affiliate_banner_id  . "' and  affiliate_banners_affiliate_id = '" . $affiliate_ref . "' and affiliate_banners_history_date = '" . $today . "'";
       $banner_stats_query = tep_db_query($sql);

    // Banner has been shown today
       if (tep_db_fetch_array($banner_stats_query)) {
       tep_db_query("update " . TABLE_AFFILIATE_BANNERS_HISTORY . " set affiliate_banners_clicks = affiliate_banners_clicks + 1 where affiliate_banners_id = '" . $affiliate_banner_id . "' and affiliate_banners_affiliate_id = '" . $affiliate_ref. "' and affiliate_banners_history_date = '" . $today . "'");
  // Initial entry if banner has not been shown
     } else {
       $sql_data_array = array('affiliate_banners_id' => $affiliate_banner_id,
                               'affiliate_banners_products_id' => $affiliate_products_id,
                               'affiliate_banners_affiliate_id' => $affiliate_ref,
                               'affiliate_banners_clicks' => '1',
                               'affiliate_banners_history_date' => $today);
       tep_db_perform(TABLE_AFFILIATE_BANNERS_HISTORY, $sql_data_array);
     }
   }

// Set Cookie if the customer comes back and orders it counts
   setcookie('affiliate_ref', $affiliate_ref, time() + AFFILIATE_COOKIE_LIFETIME);
   }
   if ($HTTP_COOKIE_VARS['affiliate_ref']) { // Customer comes back and is registered in cookie
     $affiliate_ref = $HTTP_COOKIE_VARS['affiliate_ref'];
   }
 }

////
// Compatibility to older Snapshots

// set the type of request (secure or not)
 if (!isset($request_type)) $request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

// Emulate the breadcrumb class
 if (!class_exists(breadcrumb)) {
   class breadcrumb {
     function add($title, $link = '') {
       global $location;
       $location='» <a href="' . $link . '" class="headerNavigation">' . $title . '</a>';
     }
   }
   $breadcrumb = new breadcrumb;
 }
?>

Share this post


Link to post
Share on other sites

This is my affiliate.sql

I uploaded it to /public_html/ecommerce/os

Does that sound right?

# $Id: affiliate.sql,v 1.20 2003/07/12 13:13:38 simarilius Exp $
#
# OSC-Affiliate
#
# Contribution based on:
#
# osCommerce, Open Source E-Commerce Solutions
# http://www.oscommerce.com
#
# Copyright (c) 2002 - 2003 osCommerce
#
# Released under the GNU General Public License
#
# NOTE: * Please make any modifications to this file by hand!
#       * DO NOT use a mysqldump created file for new changes!
#       * Please take note of the table structure, and use this
#         structure as a standard for future modifications!
#       * Any tables you add here should be added in admin/backup.php
#         and in catalog/install/includes/functions/database.php
#       * To see the 'diff'erence between MySQL databases, use
#         the mysqldiff perl script located in the extras
#         directory of the 'catalog' module.
#       * Comments should be like these, full line comments.
#         (don't use inline comments)

DROP TABLE IF EXISTS affiliate_affiliate;
CREATE TABLE affiliate_affiliate (
 affiliate_id int(11) NOT NULL auto_increment,
 affiliate_gender char(1) NOT NULL default '',
 affiliate_firstname varchar(32) NOT NULL default '',
 affiliate_lastname varchar(32) NOT NULL default '',
 affiliate_dob datetime NOT NULL default '0000-00-00 00:00:00',
 affiliate_email_address varchar(96) NOT NULL default '',
 affiliate_telephone varchar(32) NOT NULL default '',
 affiliate_fax varchar(32) NOT NULL default '',
 affiliate_password varchar(40) NOT NULL default '',
 affiliate_homepage varchar(96) NOT NULL default '',
 affiliate_street_address varchar(64) NOT NULL default '',
 affiliate_suburb varchar(64) NOT NULL default '',
 affiliate_city varchar(32) NOT NULL default '',
 affiliate_postcode varchar(10) NOT NULL default '',
 affiliate_state varchar(32) NOT NULL default '',
 affiliate_country_id int(11) NOT NULL default '0',
 affiliate_zone_id int(11) NOT NULL default '0',
 affiliate_agb tinyint(4) NOT NULL default '0',
 affiliate_company varchar(60) NOT NULL default '',
 affiliate_company_taxid varchar(64) NOT NULL default '',
 affiliate_commission_percent DECIMAL(4,2) NOT NULL default '0.00',
 affiliate_payment_check varchar(100) NOT NULL default '',
 affiliate_payment_paypal varchar(64) NOT NULL default '',
 affiliate_payment_bank_name varchar(64) NOT NULL default '',
 affiliate_payment_bank_branch_number varchar(64) NOT NULL default '',
 affiliate_payment_bank_swift_code varchar(64) NOT NULL default '',
 affiliate_payment_bank_account_name varchar(64) NOT NULL default '',
 affiliate_payment_bank_account_number varchar(64) NOT NULL default '',
 affiliate_date_of_last_logon datetime NOT NULL default '0000-00-00 00:00:00',
 affiliate_number_of_logons int(11) NOT NULL default '0',
 affiliate_date_account_created datetime NOT NULL default '0000-00-00 00:00:00',
 affiliate_date_account_last_modified datetime NOT NULL default '0000-00-00 00:00:00',
 affiliate_lft int(11) NOT NULL,
 affiliate_rgt int(11) NOT NULL,
 affiliate_root int(11) NOT NULL,
 affiliate_newsletter char(1) NOT NULL default '1',
 PRIMARY KEY (affiliate_id)
);

DROP TABLE IF EXISTS affiliate_banners;
CREATE TABLE affiliate_banners (
 affiliate_banners_id int(11) NOT NULL auto_increment,
 affiliate_banners_title varchar(64) NOT NULL default '',
 affiliate_products_id int(11) NOT NULL default '0',
 affiliate_banners_image varchar(64) NOT NULL default '',
 affiliate_banners_group varchar(10) NOT NULL default '',
 affiliate_banners_html_text text,
 affiliate_expires_impressions int(7) default '0',
 affiliate_expires_date datetime default NULL,
 affiliate_date_scheduled datetime default NULL,
 affiliate_date_added datetime NOT NULL default '0000-00-00 00:00:00',
 affiliate_date_status_change datetime default NULL,
 affiliate_status int(1) NOT NULL default '1',
 PRIMARY KEY  (affiliate_banners_id)
);

DROP TABLE IF EXISTS affiliate_banners_history;
CREATE TABLE affiliate_banners_history (
 affiliate_banners_history_id int(11) NOT NULL auto_increment,
 affiliate_banners_products_id int(11) NOT NULL default '0',
 affiliate_banners_id int(11) NOT NULL default '0',
 affiliate_banners_affiliate_id int(11) NOT NULL default '0',
 affiliate_banners_shown int(11) NOT NULL default '0',
 affiliate_banners_clicks tinyint(4) NOT NULL default '0',
 affiliate_banners_history_date date NOT NULL default '0000-00-00',
 PRIMARY KEY  (affiliate_banners_history_id,affiliate_banners_products_id)
);

DROP TABLE IF EXISTS affiliate_clickthroughs;
CREATE TABLE affiliate_clickthroughs (
 affiliate_clickthrough_id int(11) NOT NULL auto_increment,
 affiliate_id int(11) NOT NULL default '0',
 affiliate_clientdate datetime NOT NULL default '0000-00-00 00:00:00',
 affiliate_clientbrowser varchar(200) default 'Could Not Find This Data',
 affiliate_clientip varchar(50) default 'Could Not Find This Data',
 affiliate_clientreferer varchar(200) default 'none detected (maybe a direct link)',
 affiliate_products_id int(11) default '0',
 affiliate_banner_id int(11) NOT NULL default '0',
 PRIMARY KEY  (affiliate_clickthrough_id),
 KEY refid (affiliate_id)
);

DROP TABLE IF EXISTS affiliate_news;
CREATE TABLE `affiliate_news` (
 `news_id` int(11) NOT NULL auto_increment,
 `headline` varchar(255) NOT NULL default '',
 `content` text NOT NULL,
 `date_added` datetime NOT NULL default '0000-00-00 00:00:00',
 `STATUS` tinyint(1) NOT NULL default '0',
 PRIMARY KEY  (`news_id`)
) TYPE=MyISAM AUTO_INCREMENT=3;

DROP TABLE IF EXISTS affiliate_newsletters;
CREATE TABLE `affiliate_newsletters` (
 `affiliate_newsletters_id` int(11) NOT NULL auto_increment,
 `title` varchar(255) NOT NULL default '',
 `content` text NOT NULL,
 `module` varchar(255) NOT NULL default '',
 `date_added` datetime NOT NULL default '0000-00-00 00:00:00',
 `date_sent` datetime default NULL,
 `status` int(1) default NULL,
 `locked` int(1) default '0',
 PRIMARY KEY  (`affiliate_newsletters_id`)
) TYPE=MyISAM AUTO_INCREMENT=1;

DROP TABLE IF EXISTS affiliate_payment;
CREATE TABLE affiliate_payment (
 affiliate_payment_id int(11) NOT NULL auto_increment,
 affiliate_id int(11) NOT NULL default '0',
 affiliate_payment decimal(15,2) NOT NULL default '0.00',
 affiliate_payment_tax decimal(15,2) NOT NULL default '0.00',
 affiliate_payment_total decimal(15,2) NOT NULL default '0.00',
 affiliate_payment_date datetime NOT NULL default '0000-00-00 00:00:00',
 affiliate_payment_last_modified datetime NOT NULL default '0000-00-00 00:00:00',
 affiliate_payment_status int(5) NOT NULL default '0',
 affiliate_firstname varchar(32) NOT NULL default '',
 affiliate_lastname varchar(32) NOT NULL default '',
 affiliate_street_address varchar(64) NOT NULL default '',
 affiliate_suburb varchar(64) NOT NULL default '',
 affiliate_city varchar(32) NOT NULL default '',
 affiliate_postcode varchar(10) NOT NULL default '',
 affiliate_country varchar(32) NOT NULL default '0',
 affiliate_company varchar(60) NOT NULL default '',
 affiliate_state varchar(32) NOT NULL default '0',
 affiliate_address_format_id int(5) NOT NULL default '0',
 affiliate_last_modified datetime NOT NULL default '0000-00-00 00:00:00',
 PRIMARY KEY  (affiliate_payment_id)
);

DROP TABLE IF EXISTS affiliate_payment_status;
CREATE TABLE affiliate_payment_status (
 affiliate_payment_status_id int(11) NOT NULL default '0',
 affiliate_language_id int(11) NOT NULL default '1',
 affiliate_payment_status_name varchar(32) NOT NULL default '',
 PRIMARY KEY  (affiliate_payment_status_id,affiliate_language_id),
 KEY idx_affiliate_payment_status_name (affiliate_payment_status_name)
);

DROP TABLE IF EXISTS affiliate_payment_status_history;
CREATE TABLE affiliate_payment_status_history (
 affiliate_status_history_id int(11) NOT NULL auto_increment,
 affiliate_payment_id int(11) NOT NULL default '0',
 affiliate_new_value int(5) NOT NULL default '0',
 affiliate_old_value int(5) default NULL,
 affiliate_date_added datetime NOT NULL default '0000-00-00 00:00:00',
 affiliate_notified int(1) default '0',
 PRIMARY KEY  (affiliate_status_history_id)
);

DROP TABLE IF EXISTS affiliate_sales;
CREATE TABLE affiliate_sales (
 affiliate_id int(11) NOT NULL default '0',
 affiliate_date datetime NOT NULL default '0000-00-00 00:00:00',
 affiliate_browser varchar(100) NOT NULL default '',
 affiliate_ipaddress varchar(20) NOT NULL default '',
 affiliate_orders_id int(11) NOT NULL default '0',
 affiliate_value decimal(15,2) NOT NULL default '0.00',
 affiliate_payment decimal(15,2) NOT NULL default '0.00',
 affiliate_clickthroughs_id int(11) NOT NULL default '0',
 affiliate_billing_status int(5) NOT NULL default '0',
 affiliate_payment_date datetime NOT NULL default '0000-00-00 00:00:00',
 affiliate_payment_id int(11) NOT NULL default '0',
 affiliate_percent  DECIMAL(4,2)  NOT NULL default '0.00',
 affiliate_salesman int(11) NOT NULL default '0',
 PRIMARY KEY  (affiliate_orders_id,affiliate_id)
);

INSERT INTO affiliate_payment_status VALUES (0, 1, 'Pending');
INSERT INTO affiliate_payment_status VALUES (1, 1, 'Paid');


INSERT INTO configuration_group VALUES (900, 'Affiliate Program', 'Options for the Affiliate Program', 50, 1);
INSERT INTO configuration VALUES ('','E-Mail Address', 'AFFILIATE_EMAIL_ADDRESS', '<affiliate@localhost.com>', 'The E Mail Address for the Affiliate Program', 900, 1, NULL, now(), NULL, NULL);
INSERT INTO configuration VALUES ('','Affiliate Pay Per Sale Payment % Rate', 'AFFILIATE_PERCENT', '10.0000', 'Percentage Rate for the Affiliate Program', 900, 2, NULL, now(), NULL, NULL);
INSERT INTO configuration VALUES ('','Payment Threshold', 'AFFILIATE_THRESHOLD', '50.00', 'Payment Threshold for paying affiliates', 900, 3, NULL, now(), NULL, NULL);
INSERT INTO configuration VALUES ('','Cookie Lifetime', 'AFFILIATE_COOKIE_LIFETIME', '7200', 'How long does the click count (seconds) if customer comes back', 900, 4, NULL, now(), NULL, NULL);
INSERT INTO configuration VALUES ('','Billing Time', 'AFFILIATE_BILLING_TIME', '30', 'Orders billed must be at least "30" days old.<br>This is needed if a order is refunded', 900, 5, NULL, now(), NULL, NULL);
INSERT INTO configuration VALUES ('','Order Min Status', 'AFFILIATE_PAYMENT_ORDER_MIN_STATUS', '3', 'The status an order must have at least, to be billed', 900, 6, NULL, now(), NULL, NULL);
INSERT INTO configuration VALUES ('','Pay Affiliates with check', 'AFFILIATE_USE_CHECK', 'true', 'Pay Affiliates with check', 900, 7, NULL, now(), NULL,'tep_cfg_select_option(array(\'true\', \'false\'), ');
INSERT INTO configuration VALUES ('','Pay Affiliates with PayPal', 'AFFILIATE_USE_PAYPAL', 'true', 'Pay Affiliates with PayPal', 900, 8, NULL, now(), NULL,'tep_cfg_select_option(array(\'true\', \'false\'), ');
INSERT INTO configuration VALUES ('','Pay Affiliates by Bank', 'AFFILIATE_USE_BANK', 'true', 'Pay Affiliates by Bank', 900, 9, NULL, now(), NULL,'tep_cfg_select_option(array(\'true\', \'false\'), ');
INSERT INTO configuration VALUES ('','Individual Affiliate Percentage', 'AFFILATE_INDIVIDUAL_PERCENTAGE', 'true', 'Allow per Affiliate provision', 900, 10, NULL, now(), NULL,'tep_cfg_select_option(array(\'true\', \'false\'), ');
INSERT INTO configuration VALUES ('','Use Affiliate-tier' , 'AFFILATE_USE_TIER', 'false', 'Multilevel Affiliate provisions', 900, 11, NULL, now(), NULL,'tep_cfg_select_option(array(\'true\', \'false\'), ');
INSERT INTO configuration VALUES ('','Number of Tierlevels', 'AFFILIATE_TIER_LEVELS', '0', 'Number of Tierlevels', 900, 12, NULL, now(), NULL, NULL);
INSERT INTO configuration VALUES ('','Percentage Rate for the Tierlevels', 'AFFILIATE_TIER_PERCENTAGE', '8.00;5.00;1.00', 'Percent Rates for the tierlevels<br>Example: 8.00;5.00;1.00', 900, 13, NULL, now(), NULL, NULL);
INSERT INTO configuration VALUES ('','Affiliate News', 'MAX_DISPLAY_AFFILIATE_NEWS', '3', 'Maximum number of items to display on the Affiliate News page', 900, 14,  NULL, now(), NULL, NULL);
ALTER TABLE `affiliate_banners` ADD `affiliate_category_id` INT DEFAULT '0' NOT NULL AFTER `affiliate_products_id`;


DROP TABLE IF EXISTS `affiliate_news`;
CREATE TABLE `affiliate_news` (
 `news_id` int(11) NOT NULL auto_increment,
 `date_added` datetime NOT NULL default '0000-00-00 00:00:00',
 `news_status` tinyint(1) NOT NULL default '0',
 PRIMARY KEY  (`news_id`)
) TYPE=MyISAM AUTO_INCREMENT=1;


# Tabellenstruktur f?r Tabelle `affiliate_news_contents`
#

DROP TABLE IF EXISTS `affiliate_news_contents`;
CREATE TABLE `affiliate_news_contents` (
 `affiliate_news_contents_id` int(11) NOT NULL auto_increment,
 `affiliate_news_id` int(11) NOT NULL default '0',
 `affiliate_news_languages_id` int(11) NOT NULL default '0',
 `affiliate_news_headlines` varchar(255) NOT NULL default '',
 `affiliate_news_contents` text NOT NULL,
 PRIMARY KEY  (`affiliate_news_contents_id`),
 KEY `affiliate_news_id` (`affiliate_news_id`),
 KEY `affiliate_news_languages_id` (`affiliate_news_languages_id`)
) TYPE=MyISAM AUTO_INCREMENT=1;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×