adding first code
This commit is contained in:
45
sys0-code/api/printer_settings.php
Normal file
45
sys0-code/api/printer_settings.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true || $_SESSION["role"][9]!=="1"){
|
||||
header("location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include "../config/config.php";
|
||||
|
||||
if($_GET['action']=="update_rotation")
|
||||
{
|
||||
$printer_id=htmlspecialchars($_GET['id']);
|
||||
$rotation=htmlspecialchars($_GET["value"]);
|
||||
$sql="update printer set rotation=$rotation where id=$printer_id";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
|
||||
if($_GET["action"]=="update_color")
|
||||
{
|
||||
$printer_id=htmlspecialchars($_GET['id']);
|
||||
$color=htmlspecialchars($_GET["value"]);
|
||||
$sql="update printer set color='$color' where id=$printer_id";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
|
||||
if($_GET["action"]=="update_filament")
|
||||
{
|
||||
$id=htmlspecialchars($_GET['id']);
|
||||
$color=htmlspecialchars($_GET["value"]);
|
||||
$sql="update filament set name='$color' where internal_id=$id";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
if($_GET["action"]=="delete_filament")
|
||||
{
|
||||
$id=htmlspecialchars($_GET['id']);
|
||||
$color=htmlspecialchars($_GET["value"]);
|
||||
$sql="delete from filament where internal_id=$id";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user