First of all, I understand that magic_quotes causes all kinds of problems and has no place in modern PHP. I'm in a very specific situation where I've upgraded XAMPP from PHP 5 to PHP 7.4 for an intranet site comprised of more than 5000 files. Suddenly, all kinds of SQL INSERT queries are breaking when the user-generated string has single or double quotes in it. It's in no way feasible for me to go through and wrap every variable across these 5000 files with the add_slashes function, so I need to come up with some way to globally apply the same logic that magic_quotes did. Any suggestions?
How can I replicate magic_quotes functionality in a XAMPP PHP7.4 server?
101 Views Asked by kdsprogrammer At
1
There are 1 best solutions below
Related Questions in PHP
- How to add the dynamic new rows from my registration form in my database?
- Issue in payment form gateway
- How to create a facet for WP gridbuilder that displays both parent and child custom fields?
- Function in anonymous Laravel Blade component
- How to change woocomerce or full wordpress currency with value from USD to AUD
- General questions about creating a custom theme Moodle CMS
- How to add logging to an abstract class in php
- error 500 on IIS FastCGI but no clue despite multiple error loggings activated
- Composer installation fails and reverts ./composer.json and ./composer.lock to original content
- How to isolate PHP apps from each other on a local machine(Windows or Linux)?
- Laravel: Using belongsToMany relationship with MongoDB
- window.location.href redirects but is causing problems on the webpage
- Key provided is shorter than 256 bits, only 64 bits provided
- Laravel's whereBetween method not working with two timestamps
- Implementing UUID as primary key in Laravel intermediate table
Related Questions in XAMPP
- How to isolate PHP apps from each other on a local machine(Windows or Linux)?
- 403 Forbidden Error when accessing any file or path
- I cant access file directory with PHP local host on XAMPP. it just shows one of the files I have in my visual studio code
- Is there a solution to this problem in PHP?
- Updating PHP Version in XAMPP on Windows 10 Without Losing Database: Seeking Optimal Solutions
- how to setup php 8.3 with Apache on Loacl machine(in window 10)
- xampp-windows-x64-8.2.12-0-VS16-installer security issues
- XAMPP already installed on the MacBook, MySQL and phpMyAdmin not starting
- Auto redirect 127.0.0.1:8000 to 127.0.0.1:8000/app/
- Localhost Not Working After Creating Virtual Host in XAMPP
- Deploying a Spring Boot and Angular application on XAMPP on a different server
- Running a program on different computers with different users that access a central database simultaneously - VB.NET XAMPP/MySQL
- Access-Control-Allow-Origin error, even though cors is enabled
- laravel bootstrap/cache write permission
- "Setting Up Laravel on Windows with XAMPP and Composer: Best Practices?"
Related Questions in MAGIC-QUOTES
- Wordpress escaping quoting ONLY when inserting into the database
- Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_runtime()
- How can I replicate magic_quotes functionality in a XAMPP PHP7.4 server?
- Fatal error related to magic_quotes in PHP
- Why is my form inserting backslashes before quotes?
- PHP - HTML input string is stored as escape-sequence string in MySQL
- Call to undefined function set_magic_quotes_runtime() in core php
- Wordpress shortcode, backslash added in front of double quotation marks
- Magic Quotes in 5.5
- add_magic_quotes() is not working in wordpress
- Why Magic Quotes has been removed from PHP 5.4?
- Getting by magicquotes that pop up in PHP scripts
- PHP using a variable in a mysql query with magic_quotes
- Fixing magic_quote affected data
- Why should we escape double quotes,single quotes creating queries in PHP
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You really need to update this application How can I prevent SQL injection in PHP?. However, I am pretty sure that's not going to happen. So, in a header file or one that is included before any database operation (auto_prepend_file maybe), just map the superglobals to
addslashes. You can add$_COOKIEif needed:Obviously this won't handle multidimensional arrays so you'll have to use a recursive function: