Forums
This topic is locked
Login and '
Posted 14 Dec 2001 23:38:08
1
has voted
14 Dec 2001 23:38:08 Kevin Coster posted:
Still using Drumbeat for a project and have just noticed when logging in a user with a ' in their name (i.e. O'Brien) can't log in it seems that the ' mucks up the connection sting to the database. I found this article www.macromedia.com/support/ultradev/ts/documents/login_sb_security.htm and it seems like this is my problem. However the code is very different and am confused, how can I fix this:var filter_string = [UserNameColumn] + "= '" + String(Request("[userbox]"
[source].Filter(filter_string);
Any ideas, thanks ?
Edited by - kcoster on 14 Dec 2001 23:40:07
Replies
Replied 15 Dec 2001 14:41:58
15 Dec 2001 14:41:58 Joel Martinez replied:
<assming you are using ASP>
You should be able to modify that to look like this:
var filter_string = [UserNameColumn] + "= '" + String(<b>replace(</b>Request("[userbox]"
<b>,"'","''"
</b>
+ "' AND " + [PasswordColumn] + " = '" + String(<b>replace(</b>Request("[passbox]"
<b>,"'","''"
</b>
+ "'";
as long as you replace single quotes with two single quotes, you are OK
</assuming you are using ASP>
Joel Martinez [ ]
----------
E-Commerce Concepts with Ultradev...pre-order yours at
www.basic-ultradev.com/ecomm_concepts/
You should be able to modify that to look like this:
var filter_string = [UserNameColumn] + "= '" + String(<b>replace(</b>Request("[userbox]"
as long as you replace single quotes with two single quotes, you are OK
</assuming you are using ASP>
Joel Martinez [ ]
----------
E-Commerce Concepts with Ultradev...pre-order yours at
www.basic-ultradev.com/ecomm_concepts/
Replied 15 Dec 2001 15:16:11
15 Dec 2001 15:16:11 Kevin Coster replied:
Thats just what i needed thanks - I'll give it a try <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 16 Dec 2001 19:58:04
16 Dec 2001 19:58:04 Kevin Coster replied:
I'm actually using JavaScript so I had to use .replace(/'/g, "''"
in the end but the principle, replacing ' with '' was the same so thanks again. Now all I have to do is go and correct the pages where I filter on a username !
Thanks again <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Thanks again <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
