473,386 Members | 1,835 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,386 software developers and data experts.

What's the difference between these magic_quotes_* directives?

Ok, I'm looking at a function whose purpose is to "prepare" the
contents (usually input by a user) of a variable to be inserted into a
MySQL database. It's pretty simple, really; just check to see if
magic_quotes_* is on and then addslashes() if it's not.

What I'm having trouble wrapping my head around is the difference
between magic_quotes_gpc and magic_quotes_runtime.

The function I'm looking at calls get_magic_quotes_runtime() to decide
whether or not to apply addslashes() to the data, but I can't help but
think that it should be calling get_magic_quotes_gpc() instead,
considering the data is coming from *outside* and going *into* the
database...

Am I misunderstanding something here, or did someone do a no-no with
that function?

- Ryan
Jul 17 '05 #1
2 1916
Ryan Lange wrote:
The function I'm looking at calls get_magic_quotes_runtime() to decide
whether or not to apply addslashes() to the data, but I can't help but
think that it should be calling get_magic_quotes_gpc() instead,
considering the data is coming from *outside* and going *into* the
database...


The get_magic_quotes_gpc function returns the status of the equally named
directive in the php.ini file, which escapes data retrieved from Get, Post
and Cookie operations (gpc). The get_magic_quotes_runtime directive handles
the data returned from functions which query a database, read a file etc.

So, which function to use is depending on where the data originates from.
JW

Jul 17 '05 #2
Janwillem Borleffs wrote:
So, which function to use is depending on where the data originates from.


So, am I correct in thinking that a function which takes user input and
preps it for storage into a database should check against
magic_quotes_gpc() before applying addslashes()?

- Ryan
Jul 17 '05 #3

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

Similar topics

9
by: Mylinux | last post by:
why are these lines marked with # eg panel.h #define LINE_LENGTH 16 I want to define line_length 20
9
by: Qiao Jian | last post by:
I am new to c. Today I just read an h file within which there is statements: #ifndef _RANDOM_H #define _RANDOM_H So what is the meaning or purpose of this statement? When should I use such...
11
by: Pradyut | last post by:
what's the difference between a .h and a .hpp file Also please tell me something about .rh files -- Pradyut http://pradyut.tk http://groups.yahoo.com/group/d_dom/...
126
by: ramyach | last post by:
Hi friends, I need to write a parallel code in 'C' on the server that is running SGI Irix 6.5. This server supports MIPS Pro C compiler. I don't have any idea of parallel C languages. I looked...
3
by: kai | last post by:
Hi, All What is the the difference between If and #If? I read some VB.NET books, sometimes I see #If, but cannot tell why. Please help. Thanks Kai
28
by: john_sips_tea | last post by:
Just tried Ruby over the past two days. I won't bore you with the reasons I didn't like it, however one thing really struck me about it that I think we (the Python community) can learn from. ...
5
by: cody | last post by:
the following leads to an error (note that TEST is not defined): #if TEST string s = @" #"; // <-- the error is "preprocessing directive expected" #endif also, here we get the same error: ...
13
by: rincewind | last post by:
I remember reading an article (was it Herb Sutter's?) that recommended avoiding using directives. While I quite understand this recommendation for headers, what's wrong in using directive in .cpp...
14
by: lagman | last post by:
All, I'm looking for a tool that is able to take my code base (which is full of preprocessor directives) and spit out source code that is "clean" of any preprocessor directives based on the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.