Examine the code in each piece of the application for this project. Is there suf
ID: 3878538 • Letter: E
Question
Examine the code in each piece of the application for this project. Is there sufficient documentation for the code? Are there unnecessary error messages or inclusions in the code that reveal too much system information to the user? Correct or document any items you find and explain your modifications in the report for this week.
// This displays the login information on the page
function showlogin() {
var myform = "<form name="login" id="log" method="post" action="" + form_dest + "">";
myform += "<input type=hidden name="tokenid" value="login">";
myform += "Email: <input type=text name="us"><br>";
myform += "Password: <input type=password name="pw"><br>";
myform += "<a class="la" href="#">Login!</a></form>";
this.document.getElementById("mylogin").innerHTML = myform;
}
//Registration script
//Verify on client side and submit if valid.
function verifyreg() {
// test for empty values
// test for required values
// test for variable length
// test for illegal or harmful characters
document.regist.submit();
}
// Login script
//Verify on client side and submit if valid.
function verifylogin() {
// test for empty values
// test for required values
// test for variable length
// test for illegal or harmful characters
document.login.submit();
}
// The following allow navigation - Do not edit!
function link(token, redir) {
//alert(token + " " + redir);
document.sessions.tokenid.value = token;
document.sessions.pagereq.value = redir;
//alert(document.sessions.tokenid.value + " " + document.sessions.pagereq.value);
document.sessions.submit();
//alert(redir);
}
function innerlink(redir) {
document.getElementById("thispage").innerHTML = displayfile(redir);
}
function rescript(redir) {
document.getElementById("thispage").innerHTML = redir;
}
//Logout
function logout() {
document.sessions.tokenid.value = "logout";
document.sessions.pagereq.value = "include/desc.html";
document.sessions.submit();
}
Explanation / Answer
function verifyreg() {
//check if already registered.
}
function verifylogin(){
//limit the attempts for login (can add a variable and limit the no. of attempts of login, this can add security to the login form)
//if username is email-id, it can also be validate, by checking for '@', '.'
//test for sql injection (if the user has entered any sql statement that can delete or expose your database)
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.