php - Will these functions protect me from XSS and SQL injections? -


i'm having query;

$sql = "insert statusups (pid, text) values ('{$_session['sess_id']}', '{$_post['appendedinputbutton']}')";

and i'm processing variable $_post['appendedinputbutton'] this;

$_post['appendedinputbutton'] = $purifier->purify($_post['appendedinputbutton']); $_post['appendedinputbutton'] = strip_tags($_post['appendedinputbutton']); $_post['appendedinputbutton'] = trim($_post['appendedinputbutton']); 

does protect me xss , sql injections? i've looked mysqli , prepared statements , looks takes code simple thing. if protects me sql injections , xss love keep method or should upgrade mysqli?

the function $purifier->purify comes plugin htmlpurifier

a cross site scripting attack allows attacker execute code hosted on server on webpage. stripping tags , running through purifier start long aren't whitelisting way attacker can't link or embed code using inline javascript.

i @ framework codeignitor handle of xss , sql injection automatically.

remember while may seem lot of code, should able write type of function (or use existing framework) make future projects faster code , more secure.

to answer question, it's start xss attacker may still able insert sql injection plugin using not mention anti-sql injection.


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -