*

amare

  • **
  • 71
managenews.php and modifynews.php ERRORS please help
« on: February 26, 2014, 08:15:30 PM »
hi evryonehow are you all i have been playing with the news feed and have been reciving errors
 Deprecated: Function ereg_replace() is deprecated in both the managenews.php and modifynews.php  i have ammended the ereg_replace with preg_replace which worked to a degree however the news managment in admin and on the front page no longer saves or shows the title used.

i would appreciate any help with this or if someone else has solved this problem before could you please give me your solutions

thanks
Paul
Osdate 2.6
php 5
not sure what MSQL

*

CBG

  • *****
  • 673
    • osDate Forum
Re: managenews.php and modifynews.php ERRORS please help
« Reply #1 on: February 26, 2014, 11:16:54 PM »
What changes did you make from ereg_replace to preg_replace.
It maybe easier to zip the files and attach them to the post.

What osDate version?
Maybe a good idea to add osDate, PHP and MySQL version in your sig.
« Last Edit: February 27, 2014, 11:57:04 AM by CBG »
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

*

amare

  • **
  • 71
Re: managenews.php and modifynews.php ERRORS please help
« Reply #2 on: February 27, 2014, 03:23:38 PM »
yes sure i will attach the files here, the only changes i have done was chang the wording from ereg_replace to preg_relplace as mentioned on another php forum.  i like to try and solve my errors before asking for help but with this i am stuck

Paul
Osdate 2.6
php 5
not sure what MSQL

*

CBG

  • *****
  • 673
    • osDate Forum
Re: managenews.php and modifynews.php ERRORS please help
« Reply #3 on: February 27, 2014, 04:17:37 PM »
Try this in modifynews.php

Code: [Select]
$title = preg_replace('~</?[a-z][a-z0-9]*[^<>]*>~i', '', $title );

Let me know if it works.

I could not find eregi in managenews.php or anything that would match and replace
« Last Edit: February 27, 2014, 04:50:34 PM by CBG »
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

*

amare

  • **
  • 71
Re: managenews.php and modifynews.php ERRORS please help
« Reply #4 on: February 27, 2014, 11:00:28 PM »
thanks for that unfortunately it did not work and in my mistake i gave you the wrong file it was in savenews.php line 85 i have attached it to this post if you would be so kind to take a look
thanks

paul
Osdate 2.6
php 5
not sure what MSQL

*

CBG

  • *****
  • 673
    • osDate Forum
Re: managenews.php and modifynews.php ERRORS please help
« Reply #5 on: February 28, 2014, 11:03:02 AM »
Ok give this a try and let me know.

Code: [Select]
$title = preg_replace('/[^a-zA-Z0-9-\s\?]/', '', $title );

It will allow a-z (both cases), 0-9, dashes, spaces and question marks
« Last Edit: March 02, 2014, 02:09:30 PM by CBG »
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

*

CBG

  • *****
  • 673
    • osDate Forum
Re: managenews.php and modifynews.php ERRORS please help
« Reply #6 on: March 01, 2014, 02:04:30 PM »
Did this fix it?
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

*

amare

  • **
  • 71
Re: managenews.php and modifynews.php ERRORS please help
« Reply #7 on: March 02, 2014, 02:07:51 PM »
Hi thanks for having a look at it I appreciate it a lot.  I haven't had a chance to change the code yet as I have been tied up in work,  soon as I get a chance I will put a update here for all to see.
Do I put the second code into modify news.php or save news.php
Again thank you
Osdate 2.6
php 5
not sure what MSQL

*

CBG

  • *****
  • 673
    • osDate Forum
Re: managenews.php and modifynews.php ERRORS please help
« Reply #8 on: March 02, 2014, 02:09:09 PM »
It can go in both
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

*

amare

  • **
  • 71
[fix]. managenews.php and modifynews.php ERRORS please help
« Reply #9 on: March 03, 2014, 01:44:25 PM »
Hi I put the new code in both php files this morning using my iphone and tested it with my Iphone and iPad and I am glad to report that it works fantastic
I can't thank you enough
Osdate 2.6
php 5
not sure what MSQL

*

CBG

  • *****
  • 673
    • osDate Forum
Re: managenews.php and modifynews.php ERRORS please help
« Reply #10 on: March 03, 2014, 01:55:06 PM »
You may find article and story is the same, so would need updating with the same code.
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

*

amare

  • **
  • 71
Re: managenews.php and modifynews.php ERRORS please help
« Reply #11 on: March 03, 2014, 02:24:55 PM »
Ok thanks I will replace them as we'll
Osdate 2.6
php 5
not sure what MSQL

*

CBG

  • *****
  • 673
    • osDate Forum
Re: managenews.php and modifynews.php ERRORS please help
« Reply #12 on: March 03, 2014, 02:32:20 PM »
No worries, and glad I could help.
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll