| Author |
Topic |
|
Breana
Starting Member
6 Posts |
Posted - 2007-08-18 : 11:52:02
|
Ok, my host is free and for some reason when my users submit there code inside the discreption "textarea" with this (don't) it crashes the form without sending it to the database?But if it is sent like this (dont) its ok!So i am working on replacing the invalid strings so it'll be ok if they forget not to do it. But i am stuck... Function CleanInput(strIn As String) As String ' Replace invalid characters with empty strings. Return Regex.Replace(strIn, "[^\w\.@-]", "") End Function Any help i will love you forever :P |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-18 : 11:55:39
|
| replace one ' with two ' and you'll be ok.' is a text start and end identifier so if you want to have it in text you have to escape it.escaping it is done by doubling it._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
Breana
Starting Member
6 Posts |
Posted - 2007-08-18 : 12:01:22
|
| I have no clue i found this online i just need a simple way so if the form is submited it will remove all the (@ ') bad charecters.I also found this but not shure how to use it...<%NewVal = TRIM(OldVAl)NewVal = Replace(OldVal,"$","")%> |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-18 : 12:11:59
|
| what is your frond end programming language? C#, VB.net, ASP?as i said you just have to replace each single quote to two single quotes in your text.you are using Microsoft SQL Server, right? and not MySql or some other?_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
Breana
Starting Member
6 Posts |
Posted - 2007-08-18 : 12:17:44
|
| Ok the form is with php 4+and it is sending it to MySQL. 5+ i think. |
 |
|
|
Breana
Starting Member
6 Posts |
Posted - 2007-08-18 : 12:44:17
|
| What is the best way to do this simple i hope :) |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-18 : 13:23:45
|
well since you're using MySql you should ask a question at a mysql forum http://forums.mysql.com/very few people here have experience with php and MySql, so you'll get help there faster._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-20 : 01:52:29
|
Well. To give you an example, useselect '@kjhsdf''f' as orginal_str, replace(replace('@kjhsdf''f','@',''),'''','') as valid_stror use the same logic in php to filter and send only valid data to the tableMadhivananFailing to plan is Planning to fail |
 |
|
|
|