Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Present a page (start.html) to the user. This page should have a form with 2

ID: 3749108 • Letter: 1

Question

1) Present a page (start.html) to the user. This page should have a form with 2 fields, login name and password. Hide the text for the password. There should be a button to login. There should also be a separate link to create an account. The login button should connect to login.php 2) When the user clicks on the create account button, they should go to "createAccount.html. This page should have a form with 2 fields, login name and password. Hide the text for the password. There should be a button to submit. This submit button should connect to createAccount.php createAccount.php should read in the list of current users from the file "pass.txt". If the user name already exists, inform the user that they can not use the name that they chose and present them with a link back to createAccount.html. If the user name did not already exist, add this account to the pass.txt file. 3) a. pass.txt should have the format "username:SHA-1(password) Do not save plain text passwords, you must store the Hash of the password. 4) accessData.html should have two buttons (no input) -use 2 forms. The first button connects to 5) addRecord.html should present a form with 3 inputs, first name, last name, and phone number b. c. After the new account has been created, present a link to a file accessData.html addRecord.html. The second button connects to searchRecords.html. There should be a submit button and a clear button. The submit button should connect to a file addRecord.php addRecord.php should open a file "employees.txt" for append mode. It should add the employee record to the end of the file in the format "Lastname:Firstname:Phone". A message should be displayed that indicates success. Also a link should be provided back to accessData.html 6)

Explanation / Answer

//Sample code here for understanding, as it is complete project discussion required

//Registeration page

using System;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Data.SqlClient;

using System.Drawing;

public partial class _Default : System.Web.UI.Page

{

protected void TextBox1_TextChanged(object sender, EventArgs e)

{

//create a connection with data base

SqlConnection con = new SqlConnection(@"Data Source=.;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=True;");

//open connection

con.Open();

//specify sql command

SqlCommand cmd = new SqlCommand("select*from regform where username='" + TextBox1.Text + "'", con);

//Sends the CommandText to the Connection and builds a SqlDataReader

SqlDataReader dr = cmd.ExecuteReader();

//validate user exists

if (dr.Read())

{

Label1.Text = "User Name is Already Exist";

this.Label1.ForeColor = Color.Red;

}

else

{

Label1.Text = "UserName is Available";

this.Label1.ForeColor = Color.Red;

}

con.Close();

}

protected void Button1_Click(object sender, EventArgs e)

{

captcha1.ValidateCaptcha(TextBox6.Text.Trim());

if (captcha1.UserValidated)

{

//using captcha from data base

SqlConnection con = new SqlConnection(@"Data Source=.;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=True;");

con.Open();

SqlCommand cmd = new SqlCommand("insert into regform values(@a,@b,@c,@d)",con);

cmd.Parameters.AddWithValue("a", TextBox1.Text);

cmd.Parameters.AddWithValue("b", TextBox2.Text);

cmd.Parameters.AddWithValue("c", TextBox4.Text);

cmd.Parameters.AddWithValue("d", TextBox5.Text);

cmd.ExecuteNonQuery();

Session["name"] = TextBox1.Text;

Response.Redirect("default.aspx");

con.Close();

}

else

{

Label2.ForeColor = System.Drawing.Color.Red;

Label2.Text = "You have Entered InValid Captcha Characters please Enter again";

}

}

}

//Login page

using System;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

05

using System.Data.SqlClient;

using System.Drawing;

public partial class login : System.Web.UI.Page

{

protected void Button1_Click(object sender, EventArgs e)

{

//connection to data base

SqlConnection con = new SqlConnection(@"Data Source=.;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=True;");

//open connection

con.Open();

SqlCommand cmd = new SqlCommand("select COUNT(*)FROM regform WHERE username='"+ TextBox1.Text + "' and password='" + TextBox2.Text + "'");

cmd.Connection = con;

int OBJ = Convert.ToInt(cmd.ExecuteScalar());

//validation of username password

if (OBJ > 0)

{

Session["name"] = TextBox1.Text;

Response.Redirect("default.aspx");

}

else

{

Label1.Text = "Invalid username or password";

this.Label1.ForeColor = Color.Red;

}

}

protected void LinkButton2_Click(object sender, EventArgs e)

{

Response.Redirect("Registration.aspx");

}

}