Question: Rewrite the following code to protect against SQL injection and XSS attacks: function validateUname(uname) { var xhttp; if (uname != ) { xhttp = new
Rewrite the following code to protect against SQL injection and XSS attacks:
function validateUname(uname) {
var xhttp;
if (uname != "") {
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var res = this.responseText;
}
};
xhttp.open("GET", "validuname.php?uname=" + uname, true);
xhttp.send();
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
