-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
125 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
function show_save_result (data) { | ||
if (data.result == 'ok') { | ||
document.getElementById('save_result').innerText = 'Save Successful'; | ||
} else { | ||
document.getElementById('save_result').innerText = 'Save Failed'; | ||
} | ||
} | ||
|
||
function submit_change(id) { | ||
first_name = document.getElementById('first_name_' + id).value | ||
surname = document.getElementById('surname_' + id).value | ||
|
||
fetch('change_user_details.php', { | ||
method: 'POST', | ||
headers: { | ||
'Accept': 'application/json', | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ 'id': id, 'first_name': first_name, 'surname': surname }) | ||
} | ||
) | ||
.then((response) => response.json()) | ||
.then((data) => show_save_result(data)); | ||
} | ||
|
||
function populate_form() { | ||
var xhr= new XMLHttpRequest(); | ||
xhr.open('GET', 'get_user_data.php', true); | ||
xhr.onreadystatechange= function() { | ||
if (this.readyState!==4) { | ||
return; | ||
} | ||
if (this.status!==200) { | ||
return; | ||
} | ||
const users = JSON.parse (this.responseText); | ||
table_body = document.getElementById('user_table').getElementsByTagName('tbody')[0]; | ||
users.forEach(updateTable); | ||
|
||
function updateTable (user) { | ||
var row = table_body.insertRow(0); | ||
var cell0 = row.insertCell(-1); | ||
cell0.innerHTML = user['user_id'] + '<input type="hidden" id="user_id_' + user['user_id'] + '" name="user_id" value="' + user['user_id'] + '" />'; | ||
var cell1 = row.insertCell(1); | ||
cell1.innerHTML = '<input type="text" id="first_name_' + user['user_id'] + '" name="first_name" value="' + user['first_name'] + '" />'; | ||
var cell2 = row.insertCell(2); | ||
cell2.innerHTML = '<input type="text" id="surname_' + user['user_id'] + '" name="surname" value="' + user['surname'] + '" />'; | ||
var cell3 = row.insertCell(3); | ||
cell3.innerHTML = '<input type="button" value="Update" onclick="submit_change(' + user['user_id'] + ')" />'; | ||
} | ||
}; | ||
xhr.send(); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<?php | ||
/* | ||
Only the admin user is allowed to access this page | ||
*/ | ||
|
||
if (dvwaCurrentUser() != "admin") { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
<?php | ||
/* | ||
Nothing to see here for this vulnerability, have a look | ||
instead at the dvwaHtmlEcho function in: | ||
* dvwa/includes/dvwaPage.inc.php | ||
*/ | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters