Previous Thread
Next Thread
Print Thread
Rate Thread
#219568 06/21/2002 9:57 PM
Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
I notice that Threads does an addslahes on every text field added/changed in an sql query. Is this something that should always be done? Can someone tell me why or what would cause a query to fail if you didnt include this?

Sponsored Links
gailg #219569 06/22/2002 9:50 PM
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
The default setting of PHP is to add slashes on all info that it recieves from GET or POST (or when read from the database too, I think) which means that you don't have to do addslashes before entering them into the database.

But this means that you have to remember when you have to do addslashes before entering something into the database, since you would have to do it on strings which hasn't had the slashes added automatically.

In threads all slashes are removed after they have been read and therefore addslashes has to be called on every value that is entered into the database. This means that there is less confusion and there won't be a risk of forgetting to do addslashes on something.

gailg #219570 06/24/2002 10:23 AM
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
This is to ensure that special characters that may break the query during storage of the data are properly escaped. Always better safe than sorry.

sjsaunders #219571 06/24/2002 1:06 PM
Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
Okay, I figured out that putting a tick into a field was causing an insert to fail; so clearly I need to have the addslashes... Hopefully I catch them all...


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)