Blame view

sql_sequrity.go 310 Bytes
ea858b8a7   Marko Tikvić   refactoring
1
  package webutility
5f1346d2d   Marko Tikvić   SQLProtect replac...
2
3
4
5
  
  import (
  	"strings"
  )
ea858b8a7   Marko Tikvić   refactoring
6
  var patern string = "\"';&*<>=\\`:"
e1fbb41f9   Marko Tikvić   added comments
7
8
  // SQLSafeString removes characters from s found in patern and returns new modified string.
  func SQLSafeString(s string) (safe string) {
5f1346d2d   Marko Tikvić   SQLProtect replac...
9
  	for _, c := range patern {
e1fbb41f9   Marko Tikvić   added comments
10
  		safe = strings.Replace(s, string(c), "", -1)
5f1346d2d   Marko Tikvić   SQLProtect replac...
11
  	}
e1fbb41f9   Marko Tikvić   added comments
12
  	return safe
5f1346d2d   Marko Tikvić   SQLProtect replac...
13
  }