Skip to content

Commit 7dcad1e

Browse files
stonebuzztrasher
authored andcommitted
secure ajax
1 parent 8f2e8aa commit 7dcad1e

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

ajax/agent.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737

3838
Session::checkLoginUser();
3939

40+
Session::checkRight("inventory", READ);
41+
42+
$computer = new Computer();
43+
$computer->check($_POST['computers_id'], UPDATE);
44+
45+
46+
4047
if (isset($_POST['action']) && isset($_POST['id'])) {
4148
$agent = new Agent();
4249
if (!$agent->getFromDB($_POST['id'])) {

inc/inventoryaction.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public static function postItemForm($item)
190190
type: 'POST',
191191
url: '{$url}',
192192
timeout: 3000, //3 seconds timeout
193-
data: {'action': '{$key}', 'id': '{$agent->fields['id']}'},
193+
data: {'action': '{$key}', 'id': '{$agent->fields['id']}', 'computers_id' : '{$item->fields['id']}'},
194194
success: function(json) {
195195
icon.removeClass('fa-spin');
196196
$('#database_inventory_status').html(json.answer);

0 commit comments

Comments
 (0)