Store in GIT
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require("../../inc/connect.php");
|
||||
require("../session.php");
|
||||
|
||||
$session = $_GET['session'];
|
||||
$dev_id = $_GET['device'];
|
||||
|
||||
if($session == "")
|
||||
{
|
||||
JError("session not set");
|
||||
}
|
||||
if($dev_id == "")
|
||||
{
|
||||
JError("device not set");
|
||||
}
|
||||
|
||||
$name = $_GET['name'];
|
||||
$location = $_GET['location'];
|
||||
$description = $_GET['description'];
|
||||
|
||||
//check session
|
||||
verify_session($mysqli, $session);
|
||||
|
||||
//Check if you own the device
|
||||
$sql = "SELECT `id` FROM `device` WHERE `dev_id`='$dev_id' AND `user`=$user";
|
||||
$query = ExecQuery($mysqli, $sql);
|
||||
|
||||
if($query->num_rows < 1)
|
||||
{
|
||||
JError("you cannot edit that device");
|
||||
}
|
||||
|
||||
//update
|
||||
$sql = "UPDATE `device` SET `name`='$name', `location`='$location', `description`='$description' WHERE `dev_id`='$dev_id'";
|
||||
ExecQuery($mysqli, $sql);
|
||||
|
||||
JSuccess("true");
|
||||
?>
|
||||
Reference in New Issue
Block a user