Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Update Exchange Rate "Depricated"


Psytanium

Recommended Posts

Posted

Hello, when i try to Update exchange rate, the page throw the following error

 

Deprecated: Function ereg() is deprecated in /home/****/public_html/admin/includes/functions/localization.php on line 48

 

Deprecated: Function ereg() is deprecated in /home/****/public_html/admin/includes/functions/localization.php on line 49

 

I researched about it and found that it is related to a PHP upgrade issue.

 

This is the code found in localization.php

 

ereg("currency='([[:alpha:]]+)'",$line,$gota);
if (ereg("rate='([[:graph:]]+)'",$line,$gotb)) {

 

Can someone help ?

 

thx

Posted

@@Psytanium

 

That isn't standard osCommerce code. Here is the code for /admin/includes/functions/localization.php

 

<?php  function quote_oanda_currency($code, $base = DEFAULT_CURRENCY) {
   $page = file('http://www.oanda.com/convert/fxdaily?value=1&redirected=1&exch=' . $code .  '&format=CSV&dest=Get+Table&sel_list=' . $base);
   $match = array();
   preg_match('/(.+),(\w{3}),([0-9.]+),([0-9.]+)/i', implode('', $page), $match);
   if (sizeof($match) > 0) {
  return $match[3];
   } else {
  return false;
   }
 }
 function quote_xe_currency($to, $from = DEFAULT_CURRENCY) {
   $page = file('http://www.xe.net/ucc/convert.cgi?Amount=1&From=' . $from . '&To=' . $to);
   $match = array();
   preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', implode('', $page), $match);
   if (sizeof($match) > 0) {
  return $match[1];
   } else {
  return false;
   }
 }
?>

 

 

I suggest you replace your code with this.

 

 

 

Chris

Posted

thank you Chris! i was relating to ecbank, now i changed this from the application_top.php tp oanda.

then i placed the code you gave me in localization.php

Posted

@@Psytanium

 

You can use the email link in my profile. I don't have PM's on the forum.

 

 

 

Chris

Archived

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

×
×
  • Create New...