MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //home/jibhires/brightsolutionsindia.com/images/register_machine_process.php
<?php
include 'db_connect.php';
require 'phpqrcode/qrlib.php';  // Include QR code library

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $machine_name = $_POST['machine_name'];

    // Insert machine into the database
    $stmt = $pdo->prepare("INSERT INTO machines (machine_name) VALUES (?)");
    $stmt->execute([$machine_name]);
    $machine_id = $pdo->lastInsertId();

    // Generate the QR code for this machine
    $qr_code = 'QR_' . $machine_id . '.png';
    QRcode::png("Machine ID: $machine_id", "qrcodes/$qr_code");

    // Update machine entry with QR code path
    $stmt = $pdo->prepare("UPDATE machines SET qr_code = ? WHERE id = ?");
    $stmt->execute([$qr_code, $machine_id]);

    echo "Machine registered and QR code generated.";
}
?>