Skip to content

Commit ea8ce18

Browse files
committed
ui
1 parent 9836e42 commit ea8ce18

File tree

5 files changed

+281
-115
lines changed

5 files changed

+281
-115
lines changed

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/example/sql_inject_demo/DBHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,12 @@ public void addHandler(SQLiteDatabase db, Employee employee)
8383
values.put("PHONE", employee.getPhone());
8484
values.put("SALARY", employee.getSalary());
8585
values.put("ADDRESS", employee.getAddress());
86-
values.put("EMAIL", employee.getSalary());
86+
values.put("EMAIL", employee.getEmail());
8787
values.put("BIRTHDAY", dateFormat.format(employee.getBirthday()));
8888
db.insert(TABLE_NAME, null, values);
8989
}
9090
}
91+
9192
public Employee findHandler(String username, String password)
9293
{
9394
String query = "SELECT * FROM " + TABLE_NAME + " WHERE NAME='" + username + "' AND PASSWORD='" + password+"'";

app/src/main/java/com/example/sql_inject_demo/MainActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public void onClick(DialogInterface dialogInterface, int i)
7474
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
7575
Intent intent = new Intent(MainActivity.this, Result.class);
7676
intent.putExtra("ID",employee.getId());
77+
intent.putExtra("SSN",employee.getSsn());
7778
intent.putExtra("NAME",employee.getName());
7879
intent.putExtra("NICKNAME",employee.getNickname());
7980
intent.putExtra("SALARY",employee.getSalary());

app/src/main/java/com/example/sql_inject_demo/Result.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ public class Result extends AppCompatActivity {
1313

1414

1515
// EditText idInput;
16-
EditText idInput,salaryInput, nicknameInput, addressInput, emailInput, phoneInput;
17-
EditText birthdayInput;
16+
EditText idInput,salaryInput, nicknameInput, addressInput, emailInput, phoneInput,birthdayInput,nameInput,ssnInput,passwordInput;
1817

1918
@Override
2019
protected void onCreate(Bundle savedInstanceState) {
@@ -24,21 +23,33 @@ protected void onCreate(Bundle savedInstanceState) {
2423

2524
if (ab!=null)
2625
{
27-
ab.setTitle(getIntent().getExtras().getString("NAME"));
26+
ab.setTitle("Update Profile");
2827
}
2928
idInput = findViewById(R.id.idInput);
29+
nameInput = findViewById(R.id.nameInput);
3030
salaryInput = findViewById(R.id.salaryInput);
31+
ssnInput = findViewById(R.id.ssnInput);
32+
passwordInput = findViewById(R.id.passwordInput);
3133
nicknameInput = findViewById(R.id.nicknameInput);
3234
addressInput = findViewById(R.id.addressInput);
3335
emailInput = findViewById(R.id.emailInput);
3436
phoneInput = findViewById(R.id.phoneInput);
37+
birthdayInput = findViewById(R.id.birthdayInput);
3538

3639
nicknameInput.setText(getIntent().getStringExtra("NICKNAME"));
3740
addressInput.setText(getIntent().getStringExtra("ADDRESS"));
3841
emailInput.setText(getIntent().getStringExtra("EMAIL"));
3942
phoneInput.setText(getIntent().getStringExtra("PHONE"));
4043
idInput.setText(String.valueOf(getIntent().getIntExtra("ID",0)));
4144
salaryInput.setText(String.valueOf(getIntent().getIntExtra("SALARY",0)));
42-
// birthdayInput.setText(getIntent().getStringExtra("BIRTHDAY"));
45+
nameInput.setText(getIntent().getStringExtra("NAME"));
46+
ssnInput.setText(getIntent().getStringExtra("SSN"));
47+
passwordInput.setText(getIntent().getStringExtra("PASSWORD"));
48+
birthdayInput.setText(getIntent().getStringExtra("BIRTHDAY"));
49+
50+
idInput.setEnabled(false);
51+
salaryInput.setEnabled(false);
52+
ssnInput.setEnabled(false);
53+
nameInput.setEnabled(false);
4354
}
4455
}

0 commit comments

Comments
 (0)