Latest News: (loading..)

Archived

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

newinmn

PHP Fatal Error

10 posts in this topic

PHP Fatal error: Call to undefined function geoip_open() in /home/merchant/public_html/XXXXXX.com/osc/includes/classes/supertracker.php on line 345

 

 

 

}

 

else {

 

//New vistor, so record referrer, etc

 

//Next line defines pages on which a new visitor should definitely not be recorded

 

$prohibited_pages = 'login.php,checkout_shipping.php,checkout_payment.php,checkout_process.php,checkout_confirmation.php,checkout_success.php';

 

$current_page=addslashes(tep_db_input(urldecode($_SERVER['PHP_SELF'])));

 

 

 

if (!strpos($prohibited_pages, $current_page)) {

 

 

Line 345 is: $prohibited_pages = 'login.php,checkout_shipping.php,checkout_payment.php,checkout_process.php,checkout_confirmation.php,checkout_success.php';

 

Any ideas on how to fix this? Thank you.

Share this post


Link to post
Share on other sites

Any help would be greatly appreciated. This is the one error preventing this page from showing up right now. Thanks!

Share this post


Link to post
Share on other sites

?? are you sure this is the code from

/home/merchant/public_html/XXXXXX.com/osc/includes/classes/supertracker.php

 

This doesn't make sense, there should be a statement like

geoip_open(

in the file.

You might want to perform a search to find that statement in your files and proceed from there...

Share this post


Link to post
Share on other sites

?? are you sure this is the code from

/home/merchant/public_html/XXXXXX.com/osc/includes/classes/supertracker.php

 

This doesn't make sense, there should be a statement like

geoip_open(

in the file.

You might want to perform a search to find that statement in your files and proceed from there...

 

Here is more.

 

}

 

else {

 

//New vistor, so record referrer, etc

 

//Next line defines pages on which a new visitor should definitely not be recorded

 

$prohibited_pages = 'login.php,checkout_shipping.php,checkout_payment.php,checkout_process.php,checkout_confirmation.php,checkout_success.php';

 

$current_page=addslashes(tep_db_input(urldecode($_SERVER['PHP_SELF'])));

 

 

 

if (!strpos($prohibited_pages, $current_page)) {

 

$refer_data = addslashes(tep_db_input(urldecode($_SERVER['HTTP_REFERER'])));

 

$refer_data = explode('?', $refer_data);

 

$referrer=$refer_data[0];

 

$query_string=$refer_data[1];

 

 

 

$ip = $_SERVER['REMOTE_ADDR'];

 

$browser_string = addslashes(tep_db_input(urldecode($_SERVER['HTTP_USER_AGENT'])));

 

 

 

include(DIR_WS_INCLUDES . "geoip.inc");

 

$gi = geoip_open(DIR_WS_INCLUDES . "GeoIP.dat",GEOIP_STANDARD);

 

$country_name = geoip_country_name_by_addr($gi, $ip);

 

$country_code = strtolower(geoip_country_code_by_addr($gi, $ip));

 

geoip_close($gi);

 

 

 

 

 

$time_arrived = date('Y-m-d H:i:s');

 

$landing_page = addslashes(tep_db_input(urldecode($_SERVER['REQUEST_URI'])));

 

$query = "INSERT INTO `supertracker` (`ip_address`, `browser_string`, `country_code`, `country_name`, `referrer`,`referrer_query_string`,`landing_page`,`exit_page`,`time_arrived`,`last_click`) VALUES ('" . $ip . "','" . $browser_string . "','" . $country_code . "', '" . $country_name . "', '" . $referrer . "', '" . $query_string . "','" . $landing_page . "','" . $current_page . "','" . $time_arrived . "','" . $time_arrived . "')";

 

tep_db_query($query);

 

 

 

}//end if for prohibited pages

 

}//end else

 

 

Neither myself, or anyone at the hosting company knows how to resolve this. Also, why when I type in domain.com does it redirect to domain.com/osc? When I try and just get to the site I get a white screen. Very frustrating. Things were great before the transfer. Should I delete all file and load a fresh osCommerce then upload all files again? I'm really stuck here without a site. Thanks.

Share this post


Link to post
Share on other sites

Here's the culprit:

include(DIR_WS_INCLUDES . "geoip.inc");

$gi = geoip_open(DIR_WS_INCLUDES . "GeoIP.dat",GEOIP_STANDARD);

 

Checks you should do:

1. are the DIR_WS_INCLUDES . "geoip.inc" (= /includes/geoip.inc) and DIR_WS_INCLUDES . "GeoIP.dat" present? Try changing the command "include(" to "require(", this will give an error when the file is not present (assuming that your server is set up to show errors, otherwise you'll see a blank page).

2. open the file geoip.inc and look if the function "geoip_open(" exists.

 

About the domain root: check your root folder for index.htm(l) files containing a 'meta="refresh" '-statement or a .htaccess file with redirect instructions, like

Redirect 301 / http://www.example.com/osc/

Share this post


Link to post
Share on other sites

1. DIR_WS_INCLUDES . "geoip.inc" (= /includes/geoip.inc) and DIR_WS_INCLUDES . "GeoIP.dat" are present.

 

When I change from include to require I get the following error:

PHP Fatal error: Call to undefined function geoip_open() in /home/merchant/public_html/domain.com/osc/includes/classes/supertracker.php on line 371

 

This line is:

$gi = geoip_open(DIR_WS_INCLUDES . "GeoIP.dat",GEOIP_STANDARD);

 

2. open the file geoip.inc and look if the function "geoip_open(" exists.

It does not. There are things such as the following:

define("GEOIP_COUNTRY_BEGIN", 16776960);

 

define("GEOIP_STATE_BEGIN_REV0", 16700000);

 

but nothing that specifically says that.

 

The heading on this file says:

* 2005-01-13 Andrew Hill, Awarez Ltd. (http://www.awarez.net)

 

* Formatted file according to PEAR library standards.

 

* Moved $GEOIP_COUNTRY_CODE_TO_NUMBER, $GEOIP_COUNTRY_CODES,

 

* $GEOIP_COUNTRY_CODES3 and $GEOIP_COUNTRY_NAMES into the

 

* GeoIP class, so that library will still work even when

 

* not included in the $GLOBAL context.

 

 

As far as the domain root:

This is at the top of the index file:

 

<HTML dir=ltr lang=en><HEAD><TITLE>domain.com</TITLE>

<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type><BASE href="http://www.domain.com/osc/"><LINK rel=stylesheet type=text/css href="stylesheet.css"></HEAD>

Share this post


Link to post
Share on other sites

I've downloaded and checked the contribution and came to the following conclusion:

 

The function geoip_open does exist in geoip.inc, but I think the PHP processor doesn't read it right.

 

Try changing the geoip.inc filename to geoip.inc.php. Don't forget to do a search-and-replace in the including files to change the filename there too...

Share this post


Link to post
Share on other sites

I did this and get the following errors:

 

PHP Warning: Cannot modify header information - headers already sent by (output started at /home/merchant/public_html/domain.com/osc/includes/languages/english.php:597) in /home/merchant/public_html/domain.com/osc/includes/functions/general.php on line 33

 

This is:

 

header('Location: ' . $url);

 

PHP Fatal error: Call to undefined function geoip_open() in /home/merchant/public_html/domain.com/osc/includes/classes/supertracker.php on line 371

 

This is:

 

$gi = geoip_open(DIR_WS_INCLUDES . "GeoIP.dat",GEOIP_STANDARD);

Share this post


Link to post
Share on other sites

Make sure there are no empty lines at the beginning and the end of the geoip.inc.php file (before the <?php and after the ?>), this causes that error msg "headers already sent"...

Share this post


Link to post
Share on other sites

One down, still have the PHP Fatal error: Call to undefined function geoip_open() in /home/merchant/public_html/domain.com/osc/includes/classes/supertracker.php on line 371 problem.

 

Also I changed <META HTTP-EQUIV="refresh" content="0;URL=http://www.domain.com/osc"> to:

 

<META content="0;URL=http://www.domain.com">

 

But, why would they have it set up this way in the first place? Why redirect? There is an oscommerce page I used to login to that would actually allow me to make easy changes and that is not showing up either. Just not sure why it would have been setup for domain.com/osc in the first place.

Share this post


Link to post
Share on other sites