473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

what is userful for: set_magic_quotes_runtime ?

what is userful for: set_magic_quotes_runtime ?
than you in advance,
Mario.
Mar 13 '06 #1
3 1328

_m********@libero.it wrote:
what is userful for: set_magic_quotes_runtime ?
than you in advance,
Mario.


According to the manual at <http://www.php.net/magic_quotes>, magic
quotes are useful for:

o Beginners
o Convenience

Specifically, for magic_quotes_runtime:

"If enabled, most functions that return data from an external source,
including databases and text files, will have quotes escaped with a
backslash. Can be set at runtime, and defaults to off in PHP."

Mar 13 '06 #2
ZeldorBlat said the following on 13/03/2006 17:50:
_m********@libero.it wrote:
what is userful for: set_magic_quotes_runtime ?
than you in advance,
Mario.


According to the manual at <http://www.php.net/magic_quotes>, magic
quotes are useful for:

o Beginners
o Convenience


Unfortunately, in reality, they're useful for neither of these:

* Magic quotes (addslashes()) don't necessarily create correct escape
sequences for a given DB, e.g. it's incorrect for MS SQL. Therefore,
it's more sensible to use a specific escape function, e.g.
mysql_real_esacpe_string() for MySQL.

* On many servers, magic_quotes settings will be off. Therefore, for
cross-server compatibility, your code will need to detect this situation
and correct for it, which completely negates any "benefits" of magic
quotes, and makes your code longer.

* There are plenty of situations where you will want data in an
unescaped form, so magic_quotes is a pain in the arse.
However, I have no idea what the point of magic_quotes_runtime is.
--
Oli
Mar 13 '06 #3

Oli Filth wrote:
ZeldorBlat said the following on 13/03/2006 17:50:
_m********@libero.it wrote:
what is userful for: set_magic_quotes_runtime ?
than you in advance,
Mario.


According to the manual at <http://www.php.net/magic_quotes>, magic
quotes are useful for:

o Beginners
o Convenience


Unfortunately, in reality, they're useful for neither of these:

* Magic quotes (addslashes()) don't necessarily create correct escape
sequences for a given DB, e.g. it's incorrect for MS SQL. Therefore,
it's more sensible to use a specific escape function, e.g.
mysql_real_esacpe_string() for MySQL.

* On many servers, magic_quotes settings will be off. Therefore, for
cross-server compatibility, your code will need to detect this situation
and correct for it, which completely negates any "benefits" of magic
quotes, and makes your code longer.

* There are plenty of situations where you will want data in an
unescaped form, so magic_quotes is a pain in the arse.
However, I have no idea what the point of magic_quotes_runtime is.
--
Oli


Not sure if it's any help, but on posted data from a form, i use the
following function:

function RawPost( $string )
{
if ( get_magic_quotes_gpc() ) $string = stripslashes( $string );
return $string;
}; // RawPost()

in reality to use $_POST['data'] in a query i'd use it as follows:
mysql_real_escape_string( RawPost( $_POST['data'] ) )

Makes sure you don't end up escaping things multiple times, and keeps
your text clean ...

Frizzle.

Mar 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: J Sharman | last post by:
What is the easiest way to import an XML Datafeed from a URL into a MYSQL Database? Possibly using PHP Regards Joe PS Please answer to group and joe@joesharman.co.uk
8
by: Randell D. | last post by:
I have just recompiled, upgraded to PHP 4.3.4. As an exercise (and curiosity) I've decided to test out PDF functions and got the test in the PHP online manual working. I had one problem whereby...
14
by: Eakin, W | last post by:
Unlike a coding question, which may have a definite answer, this deals more with opinion. As I continue my studies of PHP and MySQL, and get to the point of being able to use them in a work...
3
by: Derek Fountain | last post by:
The documentation says session_destroy() "destroys all of the data associated with the current session". Um, like what? The docs further say that you should remove all information in the _SESSION...
5
by: vishal | last post by:
hello vishal here. i have seen some scripts which includes file like include('time.inc') so can anyone tell me what this file contain. and what is extension
16
by: lkrubner | last post by:
Are there any benchmarks on how much an extra, unneeded VARCHAR, CHAR, INT, BIGINT, TEXT or MEDIUMTEXT slows down a database call with MySql? PostGre info would also be useful. I'm trying to...
2
by: thecrow | last post by:
Alright, what the hell is going on here? In the following code, I expect the printed result to be: DEBUG: frank's last name is burns. Instead, what I get is: DEBUG: frank's last name is...
15
by: Arie Kanarie | last post by:
Hello, I want to start with learning VB for my work. I'm a Industrial Automation engineer and i want to know what the difference is between VB6 and VB.NET. Is VB.NET just an anaother word for...
12
by: Dario | last post by:
The following simple program behaves differently in Windows and Linux . #include <stdexcept> #include <iostream> #include <string> using namespace std; class LogicError : public logic_error {...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.