Ok so I built a forum many moons ago which I then added my own bespoke recipe section to. This allowed creation of homebrew recipes etc. It took me AGES to figure out how to write it as I don't have any actual background in coding other than being a self taught hobbyist. At the time, I got by quite well and by the end of all the trial and error I got to a decent level of understanding.
FFWD to now and I'm looking at the code feeling like I wrote it drunk. I'm looking at an error glaring back at me with not even the foggiest idea how to solve it.
So... onto the query. I have the following that used to sanitise error messages, I believe it removed any potential SQL injection (I honestly can't be sure).
This shows how long ago I wrote it as I believe it was PHP 5.4. Current versions are just knocking me back as this isn't allowed and I need to use preg_replace_callback instead.
The trouble is that I believe my initial preg_replace is quite "fancy", in that it doesn't easily transpose to the preg_replace_callback function using the brief tutorials that I have found.
Can anyone make sense of what the hell I've written to sort it out for me?
Many thanks
FFWD to now and I'm looking at the code feeling like I wrote it drunk. I'm looking at an error glaring back at me with not even the foggiest idea how to solve it.
So... onto the query. I have the following that used to sanitise error messages, I believe it removed any potential SQL injection (I honestly can't be sure).
Code:
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
This shows how long ago I wrote it as I believe it was PHP 5.4. Current versions are just knocking me back as this isn't allowed and I need to use preg_replace_callback instead.
The trouble is that I believe my initial preg_replace is quite "fancy", in that it doesn't easily transpose to the preg_replace_callback function using the brief tutorials that I have found.
Can anyone make sense of what the hell I've written to sort it out for me?
Many thanks