inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jan 5, 2011 8:15:41 GMT -8
Yet, combining addslashes() and mysql_real_escape_string() into one function is a little easier.
|
|
inherit
130228
0
Jul 11, 2024 19:19:59 GMT -8
Charles Stover
1,731
August 2008
gamechief
|
Post by Charles Stover on Jan 6, 2011 18:56:51 GMT -8
There is no reason you would need both of them. Ever.
|
|
inherit
*this CT deserves an achievement*
136400
0
Jun 25, 2021 18:23:00 GMT -8
Trill
hola
6,232
January 2009
ghbraingle
|
Post by Trill on Jan 13, 2011 9:12:00 GMT -8
Any update on this, iPokemon?
|
|
inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jan 13, 2011 19:35:44 GMT -8
Any update on this, iPokemon? Way to pick up on name change again lol. I'll see what I can do this weekend.
|
|
inherit
*this CT deserves an achievement*
136400
0
Jun 25, 2021 18:23:00 GMT -8
Trill
hola
6,232
January 2009
ghbraingle
|
Post by Trill on Jan 15, 2011 16:34:58 GMT -8
I'm a ninja with name changes. And thank you!
|
|
inherit
*this CT deserves an achievement*
136400
0
Jun 25, 2021 18:23:00 GMT -8
Trill
hola
6,232
January 2009
ghbraingle
|
Post by Trill on Jan 20, 2011 14:49:00 GMT -8
Bump
|
|
inherit
*this CT deserves an achievement*
136400
0
Jun 25, 2021 18:23:00 GMT -8
Trill
hola
6,232
January 2009
ghbraingle
|
Post by Trill on Jan 22, 2011 7:42:39 GMT -8
|
|
inherit
*this CT deserves an achievement*
136400
0
Jun 25, 2021 18:23:00 GMT -8
Trill
hola
6,232
January 2009
ghbraingle
|
Post by Trill on Jan 30, 2011 21:07:54 GMT -8
Bump
|
|
inherit
77753
0
Jul 18, 2024 12:23:50 GMT -8
Bob
2,623
April 2006
bobbyhensley
|
Post by Bob on Jan 31, 2011 14:00:37 GMT -8
Yet, combining addslashes() and mysql_real_escape_string() into one function is a little easier. You should never be using both. In fact, you should be stripping slashes in the event of Magic Quotes being enabled. Failure to strip the preexisting slashes prior to escaping them with mysql_real_escape_string will lead to contaminating the user's input.
|
|
inherit
*this CT deserves an achievement*
136400
0
Jun 25, 2021 18:23:00 GMT -8
Trill
hola
6,232
January 2009
ghbraingle
|
Post by Trill on Jan 31, 2011 14:36:32 GMT -8
Ruh Roh! That doesn't sound good.
*pretends to know what you're talking about*
|
|
inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jan 31, 2011 14:59:18 GMT -8
Yet, combining addslashes() and mysql_real_escape_string() into one function is a little easier. You should never be using both. In fact, you should be stripping slashes in the event of Magic Quotes being enabled. Failure to strip the preexisting slashes prior to escaping them with mysql_real_escape_string will lead to contaminating the user's input. function EscapeString($unescapedString) { if (get_magic_quotes_gpc()) { $unescapedString = stripslashes($unescapedString); } $semiEscapedString = addcslashes($unescapedString, "%_"); $escapedString = mysql_real_escape_string($semiEscapedString); $finalEscapedString = htmlspecialchars($semiEscapedString); return $finalEscapedString; }
Is my function.
|
|
Former Member
inherit
guest@proboards.com
171777
0
Nov 29, 2024 9:46:54 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on Jan 31, 2011 15:32:28 GMT -8
I have something similar to iDirectory, though, seeing as how PB doesn't have API to do this, I'm not quite sure. XD Unless you have another forum just for the sake of sign-ups (like phpBB) for users to use on the API. The I might be able to help you. I'm not familiar with phpBB's API though, just another forum service. The real one that knows everything about all this is my own coder who built the SQL Database and PHP for iDirectory. Currently, he's having RL issues, and doesn't want to take on any extra projects. But if you need any help, I might possibly be able to help.
|
|
inherit
*this CT deserves an achievement*
136400
0
Jun 25, 2021 18:23:00 GMT -8
Trill
hola
6,232
January 2009
ghbraingle
|
Post by Trill on Feb 5, 2011 12:53:22 GMT -8
Sorry Nick, I really wouldn't want to have the members sign up at another forum service just to have them submit biographies. (bump)
|
|
inherit
*this CT deserves an achievement*
136400
0
Jun 25, 2021 18:23:00 GMT -8
Trill
hola
6,232
January 2009
ghbraingle
|
Post by Trill on Feb 12, 2011 14:16:42 GMT -8
I feel like a noob for bumping.
|
|
inherit
130228
0
Jul 11, 2024 19:19:59 GMT -8
Charles Stover
1,731
August 2008
gamechief
|
Post by Charles Stover on Feb 14, 2011 7:17:46 GMT -8
You shouldn't use htmlspecialchars (you should be using htmlentities, btw) when inserting to the database. You only use that when sending the code to the user. htmlentities (and htmlspecialchars) make the text longer, since single-byte characters such as < become multiple bytes such as <.
Say the user is limited to 255 characters of input (tinytext). If they entered 255 < characters, the data would truncate when being inserted into the database, because the htmlspecialchars/htmlentities string will be longer than 255.
Also, escaping magic quotes should be done globally at start instead of in a function. Your function will cause errors if the string being sent as a parameter isn't $_GET, $_POST, or $_COOKIE or if the variable is set mid-program.
e.g. $_GET["test"] = "ha\\ha"; // set manually echo EscapeString($_GET["test"]); // haha
e.g. $myvar = "ha\\ha"; echo EscapeString($myvar); // haha
Your function will remove slashes that are supposed to be there, because it will assume the slashes were caused by magic quotes (which only affect the $_GET, $_COOKIE, and $_POST data that exists at start) instead of added manually.
Therefore, remove slashes at program start, so it doesn't affect variables that don't exist until mid-program.
|
|