25 lines
705 B
PHP
25 lines
705 B
PHP
<?php
|
|
require("../../../inc/connect.php");
|
|
require("../../../inc/session.php");
|
|
|
|
$device = $_POST['device'];
|
|
$name = $_POST['name'];
|
|
$location = $_POST['location'];
|
|
$description = $_POST['description'];
|
|
|
|
|
|
//Check if allowed to edit
|
|
$sql = "SELECT `id` FROM `device` WHERE `dev_id`='$device' AND `user`=$userid";
|
|
$query = ExecQuery($mysqli, $sql);
|
|
|
|
if($query->num_rows < 1)
|
|
{
|
|
error("devices", "You are not allowed to edit that device");
|
|
}
|
|
|
|
//Update the device
|
|
$sql = "UPDATE `device` SET `name`='$name', `location`='$location', `description`='$description' WHERE `dev_id`='$device'";
|
|
ExecQuery($mysqli, $sql);
|
|
|
|
success("devices", "The device has been updated");
|
|
?>
|