Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

HELP FATAL ERROR (NOOB)


freta

Recommended Posts

Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in /home/b/u/budgetb/public_html/catalog/includes/functions/compatibility.php:18) in /home/b/u/budgetb/public_html/catalog/includes/functions/compatibility.php on line 18

 

WHAT DO I DO ?

Link to comment
Share on other sites

Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in /home/b/u/budgetb/public_html/catalog/includes/functions/compatibility.php:18) in /home/b/u/budgetb/public_html/catalog/includes/functions/compatibility.php on line 18

 

WHAT DO I DO ?

You have that function in your code twice

download simple search and replace http://www.rjlsoftware.com/software/utility/search/ point it to folder oscommerce is in on your pc

search for do_magic_quotes_gpc and see what other file that function is in compare code with catalog/includes/functions/compatibility.php and remove it from the other file

Link to comment
Share on other sites

Thank you so much for that but i have done so and had no change so here is my full compatibility.php page's script

Please help its bamboozled me lol !

 

Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in /home/b/u/budgetb/public_html/catalog/includes/functions/compatibility.php:18) in /home/b/u/budgetb/public_html/catalog/includes/functions/compatibility.php on line 18

 

PLEASE HELP I HAVE THR WHOLE SITE WORKING APART FROM THE MAIN PAGE AND ITS KILLING ME

----------------------------------------------------------------------------------------------------------------------------------------

 

<?php

/*

$Id: compatibility.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2007 osCommerce

 

Released under the GNU General Public License

*/

 

////

// Recursively handle magic_quotes_gpc turned off.

// This is due to the possibility of have an array in

// $HTTP_xxx_VARS

// Ie, products attributes

function do_magic_quotes_gpc(&$ar) {

if (!is_array($ar)) return false;

 

reset($ar);

while (list($key, $value) = each($ar)) {

if (is_array($ar[$key])) {

do_magic_quotes_gpc($ar[$key]);

} else {

$ar[$key] = addslashes($value);

}

}

reset($ar);

}

 

if (PHP_VERSION >= 4.1) {

$HTTP_GET_VARS =& $_GET;

$HTTP_POST_VARS =& $_POST;

$HTTP_COOKIE_VARS =& $_COOKIE;

$HTTP_SESSION_VARS =& $_SESSION;

$HTTP_POST_FILES =& $_FILES;

$HTTP_SERVER_VARS =& $_SERVER;

} else {

if (!is_array($HTTP_GET_VARS)) $HTTP_GET_VARS = array();

if (!is_array($HTTP_POST_VARS)) $HTTP_POST_VARS = array();

if (!is_array($HTTP_COOKIE_VARS)) $HTTP_COOKIE_VARS = array();

}

 

// handle magic_quotes_gpc turned off.

if (!get_magic_quotes_gpc()) {

do_magic_quotes_gpc($HTTP_GET_VARS);

do_magic_quotes_gpc($HTTP_POST_VARS);

do_magic_quotes_gpc($HTTP_COOKIE_VARS);

}

 

if (!function_exists('array_splice')) {

function array_splice(&$array, $maximum) {

if (sizeof($array) >= $maximum) {

for ($i=0; $i<$maximum; $i++) {

$new_array[$i] = $array[$i];

}

$array = $new_array;

}

}

}

 

if (!function_exists('in_array')) {

function in_array($lookup_value, $lookup_array) {

reset($lookup_array);

while (list($key, $value) = each($lookup_array)) {

if ($value == $lookup_value) return true;

}

 

return false;

}

}

 

if (!function_exists('array_reverse')) {

function array_reverse($array) {

for ($i=0, $n=sizeof($array); $i<$n; $i++) $array_reversed[$i] = $array[($n-$i-1)];

 

return $array_reversed;

}

}

 

if (!function_exists('constant')) {

function constant($constant) {

eval("\$temp=$constant;");

 

return $temp;

}

}

 

if (!function_exists('is_null')) {

function is_null($value) {

if (is_array($value)) {

if (sizeof($value) > 0) {

return false;

} else {

return true;

}

} else {

if (($value != '') && ($value != 'NULL') && (strlen(trim($value)) > 0)) {

return false;

} else {

return true;

}

}

}

}

 

if (!function_exists('array_merge')) {

function array_merge($array1, $array2, $array3 = '') {

if (empty($array3) && !is_array($array3)) $array3 = array();

while (list($key, $val) = each($array1)) $array_merged[$key] = $val;

while (list($key, $val) = each($array2)) $array_merged[$key] = $val;

if (sizeof($array3) > 0) while (list($key, $val) = each($array3)) $array_merged[$key] = $val;

 

return (array) $array_merged;

}

}

 

if (!function_exists('is_numeric')) {

function is_numeric($param) {

return ereg('^[0-9]{1,50}.?[0-9]{0,50}$', $param);

}

}

 

if (!function_exists('array_slice')) {

function array_slice($array, $offset, $length = 0) {

if ($offset < 0 ) {

$offset = sizeof($array) + $offset;

}

$length = ((!$length) ? sizeof($array) : (($length < 0) ? sizeof($array) - $length : $length + $offset));

for ($i = $offset; $i<$length; $i++) {

$tmp[] = $array[$i];

}

 

return $tmp;

}

}

 

if (!function_exists('array_map')) {

function array_map($callback, $array) {

if (is_array($array)) {

$_new_array = array();

reset($array);

while (list($key, $value) = each($array)) {

$_new_array[$key] = array_map($callback, $array[$key]);

}

return $_new_array;

} else {

return $callback($array);

}

}

}

 

if (!function_exists('str_repeat')) {

function str_repeat($string, $number) {

$repeat = '';

 

for ($i=0; $i<$number; $i++) {

$repeat .= $string;

}

 

return $repeat;

}

}

 

if (!function_exists('checkdnsrr')) {

function checkdnsrr($host, $type) {

if(tep_not_null($host) && tep_not_null($type)) {

@exec("nslookup -type=$type $host", $output);

while(list($k, $line) = each($output)) {

if(eregi("^$host", $line)) {

return true;

}

}

}

return false;

}

}

?>

Link to comment
Share on other sites

Help? . . . . .

It's not necessarily in that file. You could be including that one file twice in your index.php file or at least the error is saying that you already have that function established.

Link to comment
Share on other sites

Maybe you did what they did in this thread, except in your case it would be /catalog/includes/languages/english/index.php

 

The index.php in the languages folder should look something like this:

 

<?php
/*
 $Id: index.php 1739 2007-12-20 00:52:16Z hpdl $

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

 Copyright (c) 2007 osCommerce

 Released under the GNU General Public License
*/

define('TEXT_MAIN', '<your custom text here>');
define('TABLE_HEADING_NEW_PRODUCTS', 'New Products For %s');
define('TABLE_HEADING_UPCOMING_PRODUCTS', 'Upcoming Products');
define('TABLE_HEADING_DATE_EXPECTED', 'Date Expected');

if ( ($category_depth == 'products') || (isset($HTTP_GET_VARS['manufacturers_id'])) ) {
 define('HEADING_TITLE', 'Let\'s See What We Have Here');
 define('TABLE_HEADING_IMAGE', '');
 define('TABLE_HEADING_MODEL', 'Model');
 define('TABLE_HEADING_PRODUCTS', 'Product Name');
 define('TABLE_HEADING_MANUFACTURER', 'Manufacturer');
 define('TABLE_HEADING_QUANTITY', 'Quantity');
 define('TABLE_HEADING_PRICE', 'Price');
 define('TABLE_HEADING_WEIGHT', 'Weight');
 define('TABLE_HEADING_BUY_NOW', 'Buy Now');
 define('TEXT_NO_PRODUCTS', 'There are no products to list in this category.');
 define('TEXT_NO_PRODUCTS2', 'There is no product available from this manufacturer.');
 define('TEXT_NUMBER_OF_PRODUCTS', 'Number of Products: ');
 define('TEXT_SHOW', '<b>Show:</b>');
 define('TEXT_BUY', 'Buy 1 \'');
 define('TEXT_NOW', '\' now');
 define('TEXT_ALL_CATEGORIES', 'All Categories');
 define('TEXT_ALL_MANUFACTURERS', 'All Manufacturers');
} elseif ($category_depth == 'top') {
 define('HEADING_TITLE', 'What\'s New Here?');
} elseif ($category_depth == 'nested') {
 define('HEADING_TITLE', 'Categories');
}
?>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Lee,

 

What was your fix? I am experiencing a similar issue.

I am currently just learning osCommerce and PHP, but am always willing to help out.

 

Have successfully installed the following: Discount Coupons, UPS shipping module, Ultimate SEO URL's, Easy Meta Tags for SEO 1.0, Google XML Sitemap SEO v1.3, HTML Editor for Email and Newsletters.

Link to comment
Share on other sites

They uploaded the correct file to the includes/languages/english folder.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

  • 9 months later...

They uploaded the correct file to the includes/languages/english folder.

 

 

Germ,

I am getting the same error, when trying to add a product to the cart.

Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in /home/jscb/public_html/catalog/includes/functions/compatibility.php:18) in /home/jscb/public_html/catalog/includes/functions/compatibility.php on line 30

 

I downloaded simple search, I have found the exact same code in the same file name but the other file is under my admin directory. Which do I change? And do I just simply delete and reupload file? Thanks!

Link to comment
Share on other sites

This is the first 45 lines. Exactly what part do I delete? Thanks!!!

<?php
/*
 $Id: compatibility.php 1739 2007-12-20 00:52:16Z hpdl $

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

 Copyright (c) 2007 osCommerce

 Released under the GNU General Public License
*/

////
// Recursively handle magic_quotes_gpc turned off.
// This is due to the possibility of have an array in
// $HTTP_xxx_VARS
// Ie, products attributes
 function do_magic_quotes_gpc(&$ar) {
   if (!is_array($ar)) return false;

   reset($ar);
   while (list($key, $value) = each($ar)) {
     if (is_array($ar[$key])) {
       do_magic_quotes_gpc($ar[$key]);
     } else {
       $ar[$key] = addslashes($value);
     }
   }
   reset($ar);
 }

 if (PHP_VERSION >= 4.1) {
   $HTTP_GET_VARS =& $_GET;
   $HTTP_POST_VARS =& $_POST;
   $HTTP_COOKIE_VARS =& $_COOKIE;
   $HTTP_SESSION_VARS =& $_SESSION;
   $HTTP_POST_FILES =& $_FILES;
   $HTTP_SERVER_VARS =& $_SERVER;
 } else {
   if (!is_array($HTTP_GET_VARS)) $HTTP_GET_VARS = array();
   if (!is_array($HTTP_POST_VARS)) $HTTP_POST_VARS = array();
   if (!is_array($HTTP_COOKIE_VARS)) $HTTP_COOKIE_VARS = array();
 }

// handle magic_quotes_gpc turned off.
 if (!get_magic_quotes_gpc()) {
   do_magic_quotes_gpc($HTTP_GET_VARS);
   do_magic_quotes_gpc($HTTP_POST_VARS);
   do_magic_quotes_gpc($HTTP_COOKIE_VARS);
 }

Link to comment
Share on other sites

The fix is to upload the correct file to the languages folder, replacing the code you that you mistakenly uploaded there.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

The fix is to upload the correct file to the languages folder, replacing the code you that you mistakenly uploaded there.

 

Which file would that be? Both of the files that have the "magic" code in them are not part of a language folder. FYI: I am dealing with a tempkate site.

Link to comment
Share on other sites

Which file would that be? Both of the files that have the "magic" code in them are not part of a language folder. FYI: I am dealing with a tempkate site.

How should I know?

:unsure:

 

I didn't do it.

>_<

 

Look in all the files in the languages folder.

 

When you find one that has the code below in it, that's the one.

 

  require('includes/application_top.php');

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

How should I know?

:unsure:

 

I didn't do it.

>_<

 

Look in all the files in the languages folder.

 

When you find one that has the code below in it, that's the one.

 

  require('includes/application_top.php');

 

There is nothing in a languages folder found by simple search, but there is 6 different files in my "theme" directory. I think that may be the problem, but Im not sure.

Link to comment
Share on other sites

There is nothing in a languages folder found by simple search, but there is 6 different files in my "theme" directory. I think that may be the problem, but Im not sure.

 

Jim!! you are the man!! Thanks, and i sent you another email.

Link to comment
Share on other sites

Got everything in working order, was testing functionality of checkout.

 

Filled out all of the profile info for checkout, and got the error again.

Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in /home/jscb/public_html/catalog/includes/functions/compatibility.php:18) in /home/jscb/public_html/catalog/includes/functions/compatibility.php on line 30

 

on this page

 

http://www.burgersmarketpc.com/catalog/checkout_payment.php

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...