Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

function ereg index


BeckyLiu

Recommended Posts

I'm pretty much a php n00b and have been trying to google/find how to sort out my ereg depreciatation problems but I have no idea what I'm doing. I've uploaded OSC V2.2 RC2a PHP 5.3 compatible files downloaded from the contributions. I have also installed the product listing contribution to make it list the product horizontally.

 

http://shop.beckyliu.com/index.php?cPath=3_10&sort=2a&filter_id=4

 

This is the error I'm getting on that page above

 

Deprecated: Function ereg() is deprecated in /srv/disk3/548372/www/shop.beckyliu.com/index.php on line 195

 

Line 195

 

   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
       if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by pd.products_name";
         break;

 

Really annoyed and worried this is going to keep happening and I'll find more errors. Thanks!

Link to comment
Share on other sites

I'm pretty much a php n00b and have been trying to google/find how to sort out my ereg depreciatation problems but I have no idea what I'm doing. I've uploaded OSC V2.2 RC2a PHP 5.3 compatible files downloaded from the contributions. I have also installed the product listing contribution to make it list the product horizontally.

 

http://shop.beckyliu.com/index.php?cPath=3_10&sort=2a&filter_id=4

 

This is the error I'm getting on that page above

 

Deprecated: Function ereg() is deprecated in /srv/disk3/548372/www/shop.beckyliu.com/index.php on line 195

 

Line 195

 

   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
       if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by pd.products_name";
         break;

 

Really annoyed and worried this is going to keep happening and I'll find more errors. Thanks!

 

Change that piece of code with

 

   if ( (!isset($_GET['sort'])) || (!preg_match('/^[1-8][ad]$/', $_GET['sort'])) || (substr($_GET['sort'], 0, 1) > sizeof($column_list)) ) {
     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
       if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
         $_GET['sort'] = $i+1 . 'a';
         $listing_sql .= " order by pd.products_name";
         break;

Link to comment
Share on other sites

Use the deprecated ereg contribution to look at all of the files that need to be updated.

Is that just for the base osC code, or does that also fix any arbitrary contribution's code? I suspect the former, which means the OP will still have to manually fix any deprecated code found in her added contributions.

 

http://us.php.net/manual/en/migration53.deprecated.php is the full list of PHP calls that may need to be changed, and how to change them.

Edited by MrPhil
Link to comment
Share on other sites

Yeh MrPhil is right. I have already changed all of the files that needed to be updated through this contribution i think the product listing one effed it up a bit.

 

@pdcelec Thank you so much!! It worked!!!!!!

 

Thanks guys for the quick help!

Link to comment
Share on other sites

Visit the link below:

 

How to Secure Your Site

 

Pay close attention to "SECURING THE ADMIN" - Yours is vulnerable.

 

It's easier to do a few security fixes now than to clean up a hacked store later.

 

And if you don't secure the admin your shop will be hacked.

 

It's just a question of when...Today, tomorrow, next week, next month... Take your pick

 

They always are.

:'(

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

Visit the link below:

 

How to Secure Your Site

 

Pay close attention to "SECURING THE ADMIN" - Yours is vulnerable.

 

It's easier to do a few security fixes now than to clean up a hacked store later.

 

And if you don't secure the admin your shop will be hacked.

 

It's just a question of when...Today, tomorrow, next week, next month... Take your pick

 

They always are.

:'(

 

I've secured it as much as I can for now thanks for the help/tips. Am slowly getting there with my shop now!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...