security - PHP - Final input-validate -
I validate three types of input (string, email, url):
string -Valid:
if ($ _POST ['string']! = "") {$ String = filter_var ($ _ POST ['string'], FILTER_SANITIZE_STRING); If ($ string! = "") {// valid} other {// not valid}} other {// blank}
Email validation:
if ($ _POST ['email']! = "") {$ Email = filter_var ($ _ POST ['email'], FILTER_SANITIZE_EMAIL); If (filter_var ($ email, FILTER_VALIDATE_EMAIL)) {// valid} other {// valid not} other {// blank}
URL-validation:
if ($ _POST ['url']! = "") {$ Url = filter_var ($ _ POST ['url'], FILTER_SANITIZE_URL); If (filter_var ($ url, FILTER_VALIDATE_URL)) {// valid} else {// not valid}} else {// blank}
after checking this I use the PDO Am I ready to make a statement
Do you think it is quite safe or have I missed some points?
Hope for your reply, thanks and greetings!
Comments
Post a Comment