<?php

require_once "../config/database.php";


if (!isset($_GET['printer'])) {

    die("Invalid printer.");

}


$printerCode = $_GET['printer'];


$db = new Database();

$conn = $db->connect();


$stmt = $conn->prepare(
    "SELECT * FROM printers WHERE printer_code = ?"
);

$stmt->execute([$printerCode]);


$printer = $stmt->fetch();


if (!$printer) {

    die("Printer not found.");

}

?>

<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>SmartPrint</title>


<style>

*{
    box-sizing:border-box;
}


body{

    margin:0;

    font-family:
    "Segoe UI",
    Arial,
    sans-serif;

    background:
    linear-gradient(
        135deg,
        #020617,
        #0f172a
    );

    color:#e5e7eb;

}



.container{

    min-height:100vh;

    display:flex;

    justify-content:center;

    align-items:center;

    padding:20px;

}



.card{

    width:100%;

    max-width:420px;

    background:

    rgba(15,23,42,0.95);

    padding:35px;

    border-radius:22px;


    border:1px solid rgba(255,255,255,0.08);


    box-shadow:

    0 20px 50px rgba(0,0,0,0.45);


    text-align:center;

}



.logo{

    width:75px;

    height:75px;

    margin:auto;


    border-radius:22px;


    background:

    linear-gradient(
        135deg,
        #2563eb,
        #06b6d4
    );


    display:flex;

    align-items:center;

    justify-content:center;


    color:white;

    font-size:34px;

    font-weight:700;


    box-shadow:

    0 0 25px rgba(37,99,235,0.5);

}



h1{

    margin-top:22px;

    font-size:28px;

    color:white;

}



p{

    color:#94a3b8;

}



.printer{


    margin-top:25px;


    background:

    rgba(30,41,59,0.8);


    padding:20px;


    border-radius:15px;


    border:

    1px solid rgba(255,255,255,0.06);

}



.printer h3{

    margin:0;

    color:#38bdf8;

    font-size:20px;

}



.location{

    margin-top:10px;

    color:#cbd5e1;

}



button{


    margin-top:30px;


    width:100%;


    padding:16px;


    border:none;


    border-radius:14px;



    background:

    linear-gradient(
        135deg,
        #2563eb,
        #06b6d4
    );


    color:white;


    font-size:17px;


    font-weight:600;


    cursor:pointer;



    box-shadow:

    0 8px 25px rgba(37,99,235,0.35);


    transition:0.3s;


}



button:hover{


    transform:translateY(-2px);


    box-shadow:

    0 12px 30px rgba(6,182,212,0.45);


}



.footer{

    margin-top:25px;

    color:#64748b;

    font-size:13px;

}


</style>


</head>


<body>


<div class="container">


<div class="card">


<div class="logo">

S

</div>


<h1>
SmartPrint
</h1>


<p>
Fast & Secure Printing
</p>



<div class="printer">


<h3>

<?= htmlspecialchars($printer['printer_name']) ?>

</h3>


<div class="location">

📍 <?= htmlspecialchars($printer['location']) ?>

</div>


</div>



<form action="upload.php" method="GET">


<input type="hidden"
name="printer_id"
value="<?= $printer['id'] ?>">



<button>

Start Printing

</button>


</form>



<div class="footer">

Powered by SmartPrint

</div>



</div>


</div>


</body>

</html>