Stats: 3,189,880 members, 7,938,615 topics. Date: Tuesday, 03 September 2024 at 09:53 AM |
Nairaland Forum / Science/Technology / Webmasters / What Is The Right Way To Escape User Input And Output Data Against Xss And Sql I (369 Views)
The Right Way To Blog / Please Is This Script Free From Sql Injection And Xss Attacks (2) (3) (4)
(1) (Reply)
What Is The Right Way To Escape User Input And Output Data Against Xss And Sql I by Nobody: 9:57am On Jan 21, 2017 |
What is the right way to escape user input and output data's against xss and sql injection? This is the one i wanted to use, i don't know if it is secured. **This below as input** function check_input($data) { $data = trim($data); $data = strip_tags($data); $data = stripslashes($data); $data = htmlspecialchars($data); $data = filter_var($data, FILTER_SANITIZE_STRING); return $data; } **Then use this below as the output** echo htmlspecialchars($data, ENT_QUOTES, 'UTF-8'); or echo htmlentities($data, ENT_COMPAT, 'UTF-8', false); |
(1) (Reply)
Free Career-development Training Platform In Digital Media Development / Free Websites For Watching Movies And Download, Music, Ebooks Or Games / Pro Writers Needed For Conscious Living Digital Publisher
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 6 |