Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Security - PHP Nuke
Author Message
Rikk03
Worker
Worker



Joined: Feb 16, 2004
Posts: 164

PostPosted: Sat Apr 10, 2004 1:44 am Reply with quote

HI,

For me to post here with a problem - means that im desperate! Im getting firstly redeclare errors for google tap,

Code:
Fatal error: Cannot redeclare replace_for_mod_rewrite() (previously declared in /usr/home/*******/public_html/header.php:44) in /usr/home/*******/public_html/header.php on line 44


- this is because the googletap start is in my header, so i copied and renamed header.php to header2.php removing the google tap start stuff. Subsequently im getting header redeclare header errors. If I try and remove the head() I get all kinds of other errors, if i move the theme stuff i get table errors Crying or Very sad OK im going to post the ORIGINAL header.

Code:
<?php


/************************************************************************/
/* PHP-NUKE: Advanced Content Management System                         */
/* ============================================                         */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (eregi("header.php",$_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}
#Start of Google Tap Header
global $nextgen_name, $prefix, $db;

// Google Tap On or Off, 1=On, 0=Off
$next_gen_ob = 1;

//Used for main module or a module without a name
if ($nextgen_name == "") {
$sql = "SELECT main_module FROM ".$prefix."_main";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$mainmod_name = $row[main_module];
$nextgen_name = $mainmod_name;
}

//Make the path to the GT-NExtGEn Files
$nextgen_path = "GoogleTap/GT-".$nextgen_name.".php";
if ($next_gen_ob == 1) {
   if (file_exists($nextgen_path)) {
   ob_start();
   } else {
   $next_gen_ob = 0;
   }
}

function replace_for_mod_rewrite(&$s, $nextgen_path) {

//Check to see if file exists before continuing
     if (file_exists($nextgen_path)) {
     include($nextgen_path);
     }
     $s = preg_replace($urlin, $urlout, $s);
     return $s;
} #End of Google Tap Header


require_once("mainfile.php");

##################################################
# Include some common header for HTML generation #
##################################################

$header = 1;

function head() {
    global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $artpage, $topic, $hlpfile, $user, $hr, $theme, $cookie, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle;
    $ThemeSel = get_theme();
    include("themes/$ThemeSel/theme.php");
    include("includes/blocker.php"); 
   echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
    echo "<html>\n";
    echo "<head>\n";
    #echo "<title>$sitename $pagetitle</title>\n";
   include("includes/dynamic_titles.php"); 
   #include("includes/blocker.php"); 
    include("includes/meta.php");
    include("includes/javascript.php");
   
    if (file_exists("themes/$ThemeSel/images/favicon.ico")) {
   echo "<link REL=\"shortcut icon\" HREF=\"themes/$ThemeSel/images/favicon.ico\" TYPE=\"image/x-icon\">\n";
    }
       
    echo "<LINK REL=\"StyleSheet\" HREF=\"themes/$ThemeSel/style/style.css\" TYPE=\"text/css\">\n\n\n";
    include("includes/my_header.php");
    echo "\n\n\n</head>\n\n";
    themeheader();
}

online();
head();
$info_box_contents = array();
  $info_box_contents[] = array('text' => BOX_HEADING_LANGUAGES);
  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']));
    }
  }
  ?>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr class="headerNavigation">
     
       <td class="headerNavigation">&nbsp;&nbsp;<?php

echo $breadcrumb->trail(' &raquo; '); ?></td>

    <td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a> &nbsp;|&nbsp; <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> &nbsp;|&nbsp; <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> &nbsp;|&nbsp; <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> &nbsp;&nbsp;</td>
  </tr>
 
</table>
<?php

include("includes/counter.php");
global $home;
if ($home == 1) {
    message_box();
    blocks(Center);
   
}

?>


AND THIS IS THE OTHER FILE

Code:
<?php

/*
  $Id: ask_a_question.php,v 1.42 2003/06/11 17:35:01 hpdl Exp $

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

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/
 if (!eregi("modules.php", $_SERVER['PHP_SELF'])) { die ("You can't access this file directly..."); } $index = 1;
  include("header.php");
  require('config.php');


  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_ASK_A_QUESTION));
    if (!tep_session_is_registered('customer_id') && (ALLOW_GUEST_TO_TELL_A_FRIEND == 'false')) {
    $navigation->set_snapshot();
    tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  }

  $valid_product = false;
  if (isset($HTTP_GET_VARS['products_id'])) {
    $product_info_query = tep_db_query("select pd.products_name, p.products_model,  p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
    if (tep_db_num_rows($product_info_query)) {
      $valid_product = true;

      $product_info = tep_db_fetch_array($product_info_query);
    }
  }

  if ($valid_product == false) {
    tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
  }

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ASK_QUESTION);

  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
    $error = false;

    $to_email_address = tep_db_prepare_input($HTTP_POST_VARS['to_email_address']);
    $to_name = tep_db_prepare_input($HTTP_POST_VARS['to_name']);
    $from_email_address = tep_db_prepare_input($HTTP_POST_VARS['from_email_address']);
    $from_name = tep_db_prepare_input($HTTP_POST_VARS['from_name']);
    $message = tep_db_prepare_input($HTTP_POST_VARS['message']);

    if (empty($from_name)) {
      $error = true;

      $messageStack->add('friend', ERROR_FROM_NAME);
    }

    if (!tep_validate_email($from_email_address)) {
      $error = true;

      $messageStack->add('friend', ERROR_FROM_ADDRESS);
    }

    if (empty($to_name)) {
      $error = true;

      $messageStack->add('friend', ERROR_TO_NAME);
    }

    if (!tep_validate_email($to_email_address)) {
      $error = true;

      $messageStack->add('friend', ERROR_TO_ADDRESS);
    }

    if ($error == false) {
      $email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME);
      $email_body = sprintf(TEXT_EMAIL_INTRO, $to_name, $from_name, $product_info['products_name'], $product_info['products_model'], STORE_NAME) . "\n\n";

      if (tep_not_null($message)) {
        $email_body .= $message . "\n\n";
      }

      $email_body .= sprintf(TEXT_EMAIL_LINK, tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])) . "\n\n" .
                     sprintf(TEXT_EMAIL_SIGNATURE, STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n");

      tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address);

      $messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info['products_name'], tep_output_string_protected($to_name)), 'success');

      tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
    }
  } elseif (tep_session_is_registered('customer_id')) {
    $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
    $account = tep_db_fetch_array($account_query);

    $from_name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
    $from_email_address = $account['customers_email_address'];
  }

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_ASK_QUESTION, 'products_id=' . $HTTP_GET_VARS['products_id']));
?>

<?php  echo '<br>'; opentable(); ?>
<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top">
    <table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->

<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><?php echo tep_draw_form('email_friend', tep_href_link(FILENAME_ASK_QUESTION, 'action=process&products_id=' . $HTTP_GET_VARS['products_id'])); ?>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td>
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo sprintf(HEADING_TITLE, $product_info['products_name']); ?> - (<?php echo $product_info['products_model'] ?>)</td>
            <td class="pageHeading" align="center"><?php echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  if ($messageStack->size('friend') > 0) {
?>
      <tr>
        <td><?php echo $messageStack->output('friend'); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td class="main"><b><?php echo FORM_TITLE_CUSTOMER_DETAILS; ?></b></td>
                <td class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
              <tr class="infoBoxContents">
                <td><table border="0" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="main"><?php echo FORM_FIELD_CUSTOMER_NAME; ?></td>
                    <td class="main"><?php echo tep_draw_input_field('from_name'); ?></td>
                  </tr>
                  <tr>
                    <td class="main"><?php echo FORM_FIELD_CUSTOMER_EMAIL; ?></td>
                    <td class="main"><?php echo tep_draw_input_field('from_email_address'); ?></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
          <tr>
            <td><?php echo tep_draw_hidden_field('to_email_address', STORE_OWNER_EMAIL_ADDRESS) . '&nbsp;<span class="inputRequirement">' . '</span>'; ?><?php echo tep_draw_hidden_field('to_name', STORE_OWNER) . '&nbsp;<span class="inputRequirement">' . '</span>'; ?></td>
          </tr>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
          <tr>
            <td class="main"><b><?php echo FORM_TITLE_FRIEND_MESSAGE; ?></b></td>
          </tr>
          <tr>
            <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
              <tr class="infoBoxContents">
                <td><?php echo tep_draw_textarea_field('message', 'soft', 40, 8); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
                <td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td></form>
<!-- body_text_eof //-->
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->

<!-- right_navigation_eof //-->
    </table></td>
  </tr>
</table>

<?php
echo '<br>'; closetable(); ?>


As you can probably tell this is a very large Tell a friend modification to send an email to the admin from the user to ask a question about a product.

ANY help would be hugely appreciated to: 1. Remove Googletap error (this goes away if i remove from header) 2. Remove header redeclare error (ive tried changing include header to require_once but that didnt improve things).

Richard


Last edited by Rikk03 on Sun Apr 11, 2004 2:21 am; edited 1 time in total 
View user's profile Send private message
sixonetonoffun
Spouse Contemplates Divorce



Joined: Jan 02, 2003
Posts: 2496

PostPosted: Sat Apr 10, 2004 10:21 am Reply with quote

Are you using short urls in your store config? There might be a conflict as the functions are the same. If that is true try shutting them off once.
 
View user's profile Send private message
Rikk03







PostPosted: Sun Apr 11, 2004 2:09 am Reply with quote

No, - short urls are deactivated, - thanks for the response - one more thing checked and removed from the equation.

Code:


Fatal error: Cannot redeclare replace_for_mod_rewrite() (previously declared in /usr/home/*******/public_html/header.php:44) in /usr/home/*******/public_html/header.php on line 44


The replace for mod_rewrite error occurs whether google tap is active or not. When active it works for the whole shopping cart - complete google tap.

Richard
 
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Apr 11, 2004 6:20 am Reply with quote

Rikk03 wrote:
HI,

For me to post here with a problem - means that im desperate! ......

Richard
So, does this mean this is the LAST place you would post otherwise? Laughing

Seriously, were things working (GT) and then they stopped?

When you say
Quote:
THIS IS THE OTHER FILE
what do you mean? Is one replacing the other or is this a file that gets called? Sorry, I'm just confused about what this code is.
 
View user's profile Send private message
Rikk03







PostPosted: Sun Apr 11, 2004 12:47 pm Reply with quote

The other file ask_a_question.php is a file ive added to my catelog that pulls the product information from the database and put it in an email to the site admin, and the user can ask a question. The error arises with the email form - although it works fine. If i create a second header.php - renamed removing the google tap start then the error goes away, but then i get a cannot redeclare header error.

I guess im trying to figure out the best way to fix all the errors arising - i cant figure out - if i try and get rid of the header error then i get a table error ...........I just cant win.

Richard
 
Rikk03







PostPosted: Sun Apr 11, 2004 12:49 pm Reply with quote

Google tap has always worked
 
sixonetonoffun







PostPosted: Sun Apr 11, 2004 8:59 pm Reply with quote

I don't understand why you get the cannot redeclare header when using the header2.php file in ask_a_question.php it seems as though something is calling the standard header.php still? Or at least the header();

I just haven't used GT2 at all.

Is header.php fired by some other piece of GT2 ?

I'd be tempted to put a @ in front of the line and see if it will work when ignoring errors.
@replace_for_mod_rewrite()
Not that this is a real answer because header() must be being called into play someplace.
 
Rikk03







PostPosted: Mon Apr 12, 2004 1:02 am Reply with quote

Will try that - Thankyou.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Security - PHP Nuke

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©