Ereg_replace trong PHP
My web host recommend an upgrade to PHP 7 but my Wordpress theme is using a deprecated ereg expression that is breaking the comments section. Here's the offending code Show
function the_commenter_link() { $commenter = get_comment_author_link(); if ( ereg( ']* class=[^>]+>', $commenter ) ) {$commenter = ereg_replace( '(]* class=[\'"]?)', '\\1url ' , $commenter ); } else { $commenter = ereg_replace( '(, '\\1class="url "' , $commenter );} echo $commenter ; } Reading posts online it seems that ereg needs to be replaced with preg_match and preg_replace. Is it a straight swap like written below or is there more to it than that? function the_commenter_link() { $commenter = get_comment_author_link(); if ( preg_match( ']* class=[^>]+>', $commenter ) ) {$commenter = preg_replace( '(]* class=[\'"]?)', '\\1url ' , $commenter ); } else { $commenter = preg_replace( '(, '\\1class="url "' , $commenter );} echo $commenter ; } Thanks for your help Link to commentShare on other sitesMore sharing options taquitosenseiPosted July 12, 2018 taquitosensei
Posted July 12, 2018 What theme is it. Is there an update to the theme? If that's broken, more likely than not there will be other parts broken as well. If not here's a guide on how to make the switch. https. //docstore. mik. ua/orelly/webprog/pcook/ch13_02. htm Link to commentShare on other sitesMore sharing options thợ cắt tócPosted July 12, 2018 thợ cắt tóc
Posted July 12, 2018 (edited) It's a woo theme that was retired in 2015 so there are no more updates. Everything seemed to work okay with PHP 7 except the comments section. I ran a search through the theme's PHP files and this was the only reference to ereg Just testing my site locally with Wampserver and PHP 5. 3 and I'm getting the following error when viewing a product, product_info. php
Deprecated. Function ereg_replace() is deprecated in C. \wamp\www\includes\functions\general. php on line 61
It's this function
function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }
I Searched and managed to clear a similar error in the classes\language. php. That solution changed ereg to preg_match
I'm also getting the same error displayed on the index. php. Deprecated. Function ereg() is deprecated in C. \wamp\www\index. php on line 196, another ereg statement. It happens when I filter the product listing via the manufacturers drop down, shows results pages 1 to 5 navigation just below
// We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {
Please could someone hold my hand for a while. Any help will be much appreciated
Chúc mừng
Ian Share this postLink to postShare on other sitessharma. atul85 0sharma. atul85 0
Posted July 28, 2009 look yr search for google for this as ereg_replace() is not compatible with latest version of php its there in language. php file where this need to be changed thats what I remember now Share this postLink to postShare on other sites♥ecartz 724ecartz 724
Posted July 28, 2009 Try changing function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); } đến function tep_sanitize_string($string) { $string = preg_replace('{ +}', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); } and see if that does what you want Always back up before making changes Share this postLink to postShare on other sitesianric 1ianric 1
Posted July 29, 2009
Hi Ecartz
Thanks for that. It did the trick
Two down, one to go. Just need to do a bit of reading and try to figure out the same error in index. php
Just one more thing, is changing the ereg to preg_replace backwards compatible?
Thanks again
Ian Share this postLink to postShare on other sites♥ecartz 724ecartz 724
Posted July 29, 2009 Đúng. The preg_replace function has been standard in PHP since 4. 2 (and existed earlier than that). You can read more about it at the documentation for PCRE on the php. net site
In terms of osCommerce, the version that I suggested should be exactly equivalent to the original with ereg. The syntax is different but the functionality should be identical
Some other ereg_replace calls that you might find ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037))) ereg_replace('"', ' ', $pieces[$k]) ereg_replace('(' . implode('|', $from) . ')', $to, $string) ereg_replace('[^0-9]', '', $number) ereg_replace('-language', '-' . $languages[$j]['directory'], $cached_file) ereg_replace('(' . implode('|', $from) . ')', $to, $string) ereg_replace("\r","",$which_text) ereg_replace('-language', '-' . $language, $cache_blocks[$i]['file']) ereg_replace(",\n$", '', $schema) ereg_replace("\n#", "\n".'\#', $row) ereg_replace(', $', '', $schema) would become preg_replace('{2037\z}', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037))) str_replace('"', ' ', $pieces[$k]) preg_replace('{(' . implode('|', $from) . ')}', $to, $string) preg_replace('{\D}', '', $number) str_replace('-language', '-' . $languages[$j]['directory'], $cached_file) str_replace("\r","",$which_text) str_replace('-language', '-' . $language, $cache_blocks[$i]['file']) preg_replace("{,\n\z}", '', $schema) preg_replace("{\n#}", "\n".'\#', $row) preg_replace('{, \z}', '', $schema) Cảnh báo. I haven't tested any of these Always back up before making changes Share this postLink to postShare on other sites♥toyicebear 206toyicebear 206
Posted July 30, 2009 These 3 are also deprecated from PHP5. 3
xem
Nói
eregi_replace Basics for osC 2. 2 Design - Basics for Design V2. 3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud. - MS3 and Team News. - SEO, Meta Tags, SEF Urls and osCommerce - Commercial Support Inquiries - OSC 2. 3+ How To
To see what more i can do for you check out my profile [click here] Share this postLink to postShare on other sitestfoolen 0tfoolen 0
Posted August 11, 2009
to what has the EREG has to be changed. Damned, this XAMPP upgrade (PHP upgrade actually to 5. 3) gives me a hell of a lot of errors (and work) Share this postLink to postShare on other sitesspooks 79spooks 79
Posted August 11, 2009 The list of effected functions is bigger than that, its due to the regex extension being deprecated
ereg_ replace xem eregi_ replace Nói tách ra tách ra sql_ regcase Sâm
Remember, What you think I ment may not be what I thought I ment when I said it
Contributions
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al. Share this postLink to postShare on other sitesspooks 79spooks 79
Posted August 13, 2009 Replacing the deprecated SPLIT function
A question came up asking how to replace the split used in the tep_parse_search_string function (about 594 of general. php)
existing line
function the_commenter_link() { $commenter = get_comment_author_link(); if ( preg_match( ']* class=[^>]+>', $commenter ) ) {$commenter = preg_replace( '(]* class=[\'"]?)', '\\1url ' , $commenter ); } else { $commenter = preg_replace( '(, '\\1class="url "' , $commenter );} echo $commenter ; }0
replace with
function the_commenter_link() { $commenter = get_comment_author_link(); if ( preg_match( ']* class=[^>]+>', $commenter ) ) {$commenter = preg_replace( '(]* class=[\'"]?)', '\\1url ' , $commenter ); } else { $commenter = preg_replace( '(, '\\1class="url "' , $commenter );} echo $commenter ; }1
This new code has the added advantage that it splits on commas too, which would cause failure on old code Sâm
Remember, What you think I ment may not be what I thought I ment when I said it
Contributions
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al. Share this postLink to postShare on other sites♥ecartz 724ecartz 724
Posted August 15, 2009 ereg would go to preg_match or strstr or strpos, e. g. // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {0 would become // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {1 Hoặc // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {2 Hoặc // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {3 For performance reasons, strpos would be preferred in that example. However, it won't always work. I can't find any examples of eregi or eregi_replace in the osCommerce code base, but you can add an i to the PCRE pattern to make it case insensitive, e. g. '{a}i' would match both a and A Always back up before making changes Share this postLink to postShare on other sitesXpajun 119Xpajun 119
Posted August 30, 2009 I'm hoping this may be the official ereg answer post - because it's currently doing my head in. Huh
I only have php5. 3 on my computer and which I use for adding (add-ons etc) and testing my store on
Anyway I've been updating ereg and eregi as they occur - well at some time or other we are going to get php6 on-line and we store owners need to be ready v3 may or may not be ready and even if it is it may or may not have the add-ons I want or accept the tweeks I require
currently I've hit a problem where I can't load to the cart (only on my computer) I'm using the same file as my live shop (with the exception of both configure. php files)
The error I get on clicking add to cart is. Fatal error. Call to undefined function preg() in /Applications/XAMPP/xamppfiles/htdocs/includes/functions/general. php on line 1094 which is // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {4 và đã // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {5 which gave this as an error
Deprecated. Function ereg() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/includes/functions/general. php on line 1094
Deprecated. Function ereg() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/includes/functions/general. php on line 1094
Deprecated. Function ereg() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/includes/functions/general. php on line 1094
Deprecated. Function ereg() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/includes/functions/general. php on line 1094
Deprecated. Function ereg() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/includes/functions/general. php on line 1094
Cảnh báo. Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/includes/functions/general. php. 1094) in /Applications/XAMPP/xamppfiles/htdocs/includes/functions/general. php on line 33
line 33 is // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {6
My question is (apart from help. ) are we able to change the ereg as they crop up or do we have to find them all and change them at once? My store is currently running Phoenix 1. 0. 3. 0 I'm currently working on 1. 0. 7. 2 and hope to get it live before 1. 0. 8. 0 arrives (maybe 🙄 ) I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary Share this postLink to postShare on other sitesspooks 79spooks 79
Posted August 30, 2009 As Matt pointed out, you would replace ereg with preg_match, preg does not exist
Vì thế // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {7 trở thành // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {8
Also as has been pointed out elsewhere, a work around (till v6 at least) is
In includes/application_top. php and admin/includes/application_top. php
tìm thấy
// We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {9
replace with
function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }0 Sâm
Remember, What you think I ment may not be what I thought I ment when I said it
Contributions
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al. Share this postLink to postShare on other sitesXpajun 119Xpajun 119
Posted August 30, 2009 Doh. . đỏ mặt
works now
Thank you spooks
The work around is ok at the moment but is going to pretty useless when php6 comes along which is why I've decided to update them My store is currently running Phoenix 1. 0. 3. 0 I'm currently working on 1. 0. 7. 2 and hope to get it live before 1. 0. 8. 0 arrives (maybe 🙄 ) I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary Share this postLink to postShare on other sitessimas12 0simas12 0
Posted September 3, 2009 Chào
i am new with OS Commerce
i have got this problem
on the top of the page there are Deprecated. Function eregi() is deprecated in C. \Program Files\EasyPHP5. 3. 0\www\catalog\includes\classes\language. php on line 87
What does it mean and How can i solve this problem Cảm ơn bạn Share this postLink to postShare on other sitesXpajun 119Xpajun 119
Posted September 3, 2009 Hi simas12 ,
As you are new to osCommerce your best bet may well be to do the fix Sam has describe here especially if you need to get a store running - it will last you until your server updates to php6 (mine is only running php 5. 2. 9 at the moment)
My store is currently running Phoenix 1. 0. 3. 0 I'm currently working on 1. 0. 7. 2 and hope to get it live before 1. 0. 8. 0 arrives (maybe 🙄 ) I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary Share this postLink to postShare on other sites♥ecartz 724ecartz 724
Posted September 7, 2009 The unix diff from admin/includes/classes/phplot. php function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }3 Note that three of these are examples of times when it is more appropriate not to use a regular expression function at all. For those who are not familiar with unix diff, the lines that start with < are the old lines and the lines that start with > are the replacements. The numbers are line numbers for the lines that follow, e. g. lines 677 and 678 in the original file are replaced by lines 677 and 678 in the new file. The greater than signs should not be pasted into the file Always back up before making changes Share this postLink to postShare on other sitesianric 1ianric 1
Posted October 7, 2009 Xin chào
Thanks to everyone helping me out on this. At first it was very daunting but after reading the manual and Google, it's quite easy. I've decided to add to this thread so that it's all in one place for the future
One edit that has me stumped is this code in admin/server_info. php
function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }4
I can't figure this one out. Even examples I found on the net don't seem to work. If I replace with
function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }5
I get "Warning. preg_match() [function. preg-match]. Unknown modifier 'b' in C. \xampp\Htdocs\admin\server_info. php on line 113"
I've tried. as a different modifer, (Google)?? Escaping the \/body cures the error messages but only the osc. png is displayed, not the whole info pages
The other one is in admin/banner_manager. php
I've updated the file to PHP 5. 3 but I get
"Warning. imagecolorexact(). 66 is not a valid Image resource in C. \xampp\Htdocs\admin\includes\classes\phplot. php on line 1305". The error is repeated 16 times with same and different line numbers. This is the function on line 1305
function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }6
I *think* these are my last fixes so any help would be appreciated
Many thanks again
Ian Share this postLink to postShare on other sites♥ecartz 724ecartz 724
Posted October 7, 2009 Tryfunction tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }5 function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }8 You may only need s or m, but it worked in my test with all of them and it's a Perl Best Practice to use xsm (along with the {} as the regex delimiters). The i covers a possible issue where you might have rather than .
In regards to your banner manager issue, are you using the same code changes that I proposed or different ones? If different ones, could you try the ones that I posted? If that doesn't work, please post what you are trying
Incidentally, Mark Evans was working on a version of 2. 2 without the deprecated functions. You might be able to get that on github Always back up before making changes Share this postLink to postShare on other sites♥ecartz 724ecartz 724
Posted October 12, 2009 The github links
Always back up before making changes Share this postLink to postShare on other sitesjlb922 0jlb922 0
Posted October 22, 2009 Can anyone help me fix this one in headertags. php?
$pageName = ucwords(ereg_replace("[^A-Za-z0-9]", " ", $pageName));
Thanks in advance Share this postLink to postShare on other sitesMrPhil 648MrPhil 648
Posted October 22, 2009 Give this a try function tep_sanitize_string($string) { $string = ereg_replace(' +', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }9 Share this postLink to postShare on other sitessteve_s 5steve_s 5
Posted November 24, 2009
Chào Sam
Shouldn't // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_date_added, p.products_id, p.manufacturers_id, m.manufacturers_name, p.products_price, p.products_media, p.products_label, p.products_catno, p.products_model, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } This is line 196 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; } } } else.. {8
thì là ở function tep_sanitize_string($string) { $string = preg_replace('{ +}', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }3
As i got an error missing delimiter ^
Steve Share this postLink to postShare on other sitessteve_s 5steve_s 5
Posted November 24, 2009
find that line function tep_sanitize_string($string) { $string = preg_replace('{ +}', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }4
replace it with function tep_sanitize_string($string) { $string = preg_replace('{ +}', ' ', trim($string)); return preg_replace("/[<>]/", '_', $string); }5
Steve Share this postLink to postShare on other sitesbrusselart 0brusselart 0
Posted December 10, 2009 Xin chào,
I am new at this forum and have only recently installed OSCommerce. I have followed all installation steps carefully and succeeded in the installation, which is running on localhost on my XP machine I use the following versions OSCommerce 2. 2-RC2 Apache 2. 2. 13 (Win32) PHP5. 3. 0 mysql 5. 1. 37
I also ran into the problems with ereg / eregi etc and used the solution offered here to (for the moment) get rid of the error messages by replacing error_reporting(E_ALL & ~E_NOTICE); in. includes/application_top. php and admin/includes/application_top. php qua. error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); This works. D (well, it gets rid of the error messages)
I have set up the store using the administrator section and I can create a customer account in the shop. However when I try to login using the customer login and password it will just return to the login page and will not login the customer. Nor can I add any product to the shopping cart. Anybody any idea what I overlooked here? |