Files
InternetRadio-Website/android/device/edit.php
T
2026-06-17 15:46:26 +02:00

39 lines
891 B
PHP

<?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");
?>