adding first code

This commit is contained in:
Janis Steiner
2024-06-17 20:24:20 +01:00
parent 15d13ebd55
commit fe23e852d0
12 changed files with 2250 additions and 0 deletions

View 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);
}
?>