qr asset upload

main
wahyu-kurniawan 2023-03-21 09:21:44 +07:00
parent d72c1ea77e
commit f675d17ed9
13 changed files with 1754 additions and 2 deletions

1
.gitignore vendored 100644
View File

@ -0,0 +1 @@
/vendor/

284
ajaxupload.php 100644
View File

@ -0,0 +1,284 @@
<?php
session_start();
require 'vendor/autoload.php';
include "vendor/phpqrcode/qrlib.php";
use Gregwar\Captcha\CaptchaBuilder;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
include 'dbconn.php';
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
// ajax request
$key = 'e188ff584c43eb3d7c4e10b4b8d3cc77';
if($_POST['capcay']!==$_SESSION['phrase']){
$builder = new CaptchaBuilder;
$builder->build();
$_SESSION['phrase'] = $builder->getPhrase();
echo 'capcay';
} else {
if(md5(htmlspecialchars($_POST['key'])) !== $key) {
$builder = new CaptchaBuilder;
$builder->build();
$_SESSION['phrase'] = $builder->getPhrase();
echo 'key';
} else {
session_destroy();
$valid_extensions = array('xls', 'xlsx'); // valid extensions
$path = 'uploads/'; // upload directory
$penyimpanan = "tempqr/";
$penyimpanan_label = "templb/";
$penyimpanan_zip = "tempzip/";
if (!file_exists($penyimpanan))
mkdir($penyimpanan);
if (!file_exists($penyimpanan_label))
mkdir($penyimpanan_label);
$url = "http://localhost/qr-aset/view/?aset=";
chmod($path,0777);
if($_FILES['file'])
{
$fname = $_FILES['file']['name'];
$tmp = $_FILES['file']['tmp_name'];
// get uploaded file's extension
$ext = strtolower(pathinfo($fname, PATHINFO_EXTENSION));
// can upload same image using rand function
$final_image = rand(1000,1000000).$fname;
// check's valid format
if(in_array($ext, $valid_extensions))
{
$uniquename = md5(microtime());
// $path = $path.$uniquename.'.'.$ext;
$path = $path.$uniquename;
if(move_uploaded_file($tmp,$path))
{
$Reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$spreadSheet = $Reader->load($path);
$excelSheet = $spreadSheet->getActiveSheet();
$spreadSheetAry = $excelSheet->toArray();
$sheetCount = count($spreadSheetAry);
for ($i = 13; $i <= ($sheetCount-9); $i ++) {
$kode = "";
if (isset($spreadSheetAry[$i][1])) {
$kode = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][1]));
}
$nama = "";
if (isset($spreadSheetAry[$i][2])) {
$nama = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][2]));
}
$reg = "";
if (isset($spreadSheetAry[$i][3])) {
$reg = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][3]));
}
$merk = "";
if (isset($spreadSheetAry[$i][4])) {
$merk = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][4]));
}
$ukuran = "";
if (isset($spreadSheetAry[$i][5])) {
$ukuran = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][5]));
}
$bahan = "";
if (isset($spreadSheetAry[$i][6])) {
$bahan = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][6]));
}
$warna = "";
if (isset($spreadSheetAry[$i][7])) {
$warna = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][7]));
}
$tahun = "0";
if (isset($spreadSheetAry[$i][8])) {
$tahun = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][8]));
}
$pabrik = "";
if (isset($spreadSheetAry[$i][9])) {
$pabrik = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][9]));
}
$rangka = "";
if (isset($spreadSheetAry[$i][10])) {
$rangka = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][10]));
}
$mesin = "";
if (isset($spreadSheetAry[$i][11])) {
$mesin = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][11]));
}
$polisi = "";
if (isset($spreadSheetAry[$i][12])) {
$polisi = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][12]));
}
$bpkb = "";
if (isset($spreadSheetAry[$i][13])) {
$bpkb = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][13]));
}
$asal = "";
if (isset($spreadSheetAry[$i][14])) {
$asal = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][14]));
}
$harga = "0";
if (isset($spreadSheetAry[$i][15])) {
$harga = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][15]));
}
$keterangan = "";
if (isset($spreadSheetAry[$i][16])) {
$keterangan = htmlspecialchars(mysqli_real_escape_string($conn, $spreadSheetAry[$i][16]));
}
if($kode !=''){
$sql = "INSERT INTO aset (kode, nama, reg, merk, ukuran, bahan, warna, tahun, pabrik, rangka, mesin, polisi, bpkb, asal, harga, keterangan) VALUES ('$kode', '$nama', '$reg', '$merk', '$ukuran', '$bahan','$warna', '$tahun', '$pabrik', '$rangka', '$mesin', '$polisi', '$bpkb', '$asal', '$harga', '$keterangan')";
if ($conn->query($sql) === TRUE) {
$last_id = $conn->insert_id;
QRcode::png($url.base64_encode($last_id), $penyimpanan.base64_encode($last_id).".png");
$qr = imagecreatefrompng($penyimpanan.base64_encode($last_id).".png");
$pemkot = imagecreatefrompng("image/pemkot.png");
// Create the image
$gmb = imagecreatetruecolor(720, 120);
// Create some colors
$bg = imagecolorallocate($gmb, 255, 255, 255);
$txt = imagecolorallocate($gmb, 0, 0, 0);
imagefilledrectangle($gmb, 0, 0, 720, 120, $bg);
// The text to draw
imagestring( $gmb, 5, 120, 25, "ASET DISKOMINSTA", $txt );
imagesetthickness( $gmb, 10 );
// The text to draw
imagestring( $gmb, 5, 120, 50, $kode, $txt );
imagesetthickness( $gmb, 10 );
// The text to draw
imagestring( $gmb, 5, 120, 75, "No. Reg : ".$reg." Tahun :".$tahun, $txt );
imagesetthickness( $gmb, 10 );
imagecopyresampled($gmb, $qr, 620, 10, 0, 0, 100, 100, 123, 123);
imagecopyresampled($gmb, $pemkot, 5, 10, 0, 0, 100, 100, 123, 123);
imagepng($gmb,$penyimpanan_label.$kode." - ".$reg.".png");
imagedestroy($gmb);
unlink($penyimpanan.base64_encode($last_id).".png");
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
}
// Get real path for our folder
$rootPath = realpath('templb');
// Initialize archive object
$zip = new ZipArchive();
$zipname = 'qraset.zip';
$zip->open($penyimpanan_zip.$zipname, ZipArchive::CREATE | ZipArchive::OVERWRITE);
// Initialize empty "delete list"
$filesToDelete = array();
// Create recursive directory iterator
/** @var SplFileInfo[] $files */
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($rootPath),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $name => $file)
{
// Skip directories (they would be added automatically)
if (!$file->isDir())
{
// Get real and relative path for current file
$filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen($rootPath) + 1);
// Add current file to archive
$zip->addFile($filePath, $relativePath);
// Add current file to "delete list"
// delete it later cause ZipArchive create archive only after calling close function and ZipArchive lock files until archive created)
$filesToDelete[] = $filePath;
}
}
// Zip archive will be created only after closing object
$zip->close();
// Delete all files from "delete list"
foreach ($filesToDelete as $file)
{
unlink($file);
}
unlink($path);
// var_dump($spreadSheetAry);die();
}
}
else
{
echo 'invalid';
}
}
}
}
} else {
// not an ajax request
header("Location: http://localhost/qr-aset/");
}
?>

18
composer.json 100644
View File

@ -0,0 +1,18 @@
{
"name": "msi/qr-aset",
"autoload": {
"psr-4": {
"Msi\\QrAset\\": "src/"
}
},
"authors": [
{
"name": "v3n0s0undsyst3m",
"email": "veno.soundsystem@gmail.com"
}
],
"require": {
"phpoffice/phpspreadsheet": "^1.28",
"gregwar/captcha": "^1.1"
}
}

997
composer.lock generated 100644
View File

@ -0,0 +1,997 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "4fe3ea6cf5798180e07f4a087cd3e175",
"packages": [
{
"name": "ezyang/htmlpurifier",
"version": "v4.16.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/523407fb06eb9e5f3d59889b3978d5bfe94299c8",
"reference": "523407fb06eb9e5f3d59889b3978d5bfe94299c8",
"shasum": ""
},
"require": {
"php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0"
},
"require-dev": {
"cerdic/css-tidy": "^1.7 || ^2.0",
"simpletest/simpletest": "dev-master"
},
"suggest": {
"cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.",
"ext-bcmath": "Used for unit conversion and imagecrash protection",
"ext-iconv": "Converts text to and from non-UTF-8 encodings",
"ext-tidy": "Used for pretty-printing HTML"
},
"type": "library",
"autoload": {
"files": [
"library/HTMLPurifier.composer.php"
],
"psr-0": {
"HTMLPurifier": "library/"
},
"exclude-from-classmap": [
"/library/HTMLPurifier/Language/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "Edward Z. Yang",
"email": "admin@htmlpurifier.org",
"homepage": "http://ezyang.com"
}
],
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
],
"support": {
"issues": "https://github.com/ezyang/htmlpurifier/issues",
"source": "https://github.com/ezyang/htmlpurifier/tree/v4.16.0"
},
"time": "2022-09-18T07:06:19+00:00"
},
{
"name": "gregwar/captcha",
"version": "v1.1.9",
"source": {
"type": "git",
"url": "https://github.com/Gregwar/Captcha.git",
"reference": "4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Gregwar/Captcha/zipball/4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5",
"reference": "4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5",
"shasum": ""
},
"require": {
"ext-gd": "*",
"ext-mbstring": "*",
"php": ">=5.3.0",
"symfony/finder": "*"
},
"require-dev": {
"phpunit/phpunit": "^6.4"
},
"type": "captcha",
"autoload": {
"psr-4": {
"Gregwar\\": "src/Gregwar"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Grégoire Passault",
"email": "g.passault@gmail.com",
"homepage": "http://www.gregwar.com/"
},
{
"name": "Jeremy Livingston",
"email": "jeremy.j.livingston@gmail.com"
}
],
"description": "Captcha generator",
"homepage": "https://github.com/Gregwar/Captcha",
"keywords": [
"bot",
"captcha",
"spam"
],
"support": {
"issues": "https://github.com/Gregwar/Captcha/issues",
"source": "https://github.com/Gregwar/Captcha/tree/master"
},
"time": "2020-03-24T14:39:05+00:00"
},
{
"name": "maennchen/zipstream-php",
"version": "2.2.6",
"source": {
"type": "git",
"url": "https://github.com/maennchen/ZipStream-PHP.git",
"reference": "30ad6f93cf3efe4192bc7a4c9cad11ff8f4f237f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/30ad6f93cf3efe4192bc7a4c9cad11ff8f4f237f",
"reference": "30ad6f93cf3efe4192bc7a4c9cad11ff8f4f237f",
"shasum": ""
},
"require": {
"myclabs/php-enum": "^1.5",
"php": "^7.4 || ^8.0",
"psr/http-message": "^1.0",
"symfony/polyfill-mbstring": "^1.0"
},
"require-dev": {
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.9",
"guzzlehttp/guzzle": "^6.5.3 || ^7.2.0",
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.4",
"phpunit/phpunit": "^8.5.8 || ^9.4.2",
"vimeo/psalm": "^4.1"
},
"type": "library",
"autoload": {
"psr-4": {
"ZipStream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paul Duncan",
"email": "pabs@pablotron.org"
},
{
"name": "Jonatan Männchen",
"email": "jonatan@maennchen.ch"
},
{
"name": "Jesse Donat",
"email": "donatj@gmail.com"
},
{
"name": "András Kolesár",
"email": "kolesar@kolesar.hu"
}
],
"description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.",
"keywords": [
"stream",
"zip"
],
"support": {
"issues": "https://github.com/maennchen/ZipStream-PHP/issues",
"source": "https://github.com/maennchen/ZipStream-PHP/tree/2.2.6"
},
"funding": [
{
"url": "https://github.com/maennchen",
"type": "github"
},
{
"url": "https://opencollective.com/zipstream",
"type": "open_collective"
}
],
"time": "2022-11-25T18:57:19+00:00"
},
{
"name": "markbaker/complex",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPComplex.git",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Complex\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@lange.demon.co.uk"
}
],
"description": "PHP Class for working with complex numbers",
"homepage": "https://github.com/MarkBaker/PHPComplex",
"keywords": [
"complex",
"mathematics"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPComplex/issues",
"source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2"
},
"time": "2022-12-06T16:21:08+00:00"
},
{
"name": "markbaker/matrix",
"version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPMatrix.git",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpdocumentor/phpdocumentor": "2.*",
"phploc/phploc": "^4.0",
"phpmd/phpmd": "2.*",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"sebastian/phpcpd": "^4.0",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Matrix\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@demon-angel.eu"
}
],
"description": "PHP Class for working with matrices",
"homepage": "https://github.com/MarkBaker/PHPMatrix",
"keywords": [
"mathematics",
"matrix",
"vector"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPMatrix/issues",
"source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1"
},
"time": "2022-12-02T22:17:43+00:00"
},
{
"name": "myclabs/php-enum",
"version": "1.8.4",
"source": {
"type": "git",
"url": "https://github.com/myclabs/php-enum.git",
"reference": "a867478eae49c9f59ece437ae7f9506bfaa27483"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/a867478eae49c9f59ece437ae7f9506bfaa27483",
"reference": "a867478eae49c9f59ece437ae7f9506bfaa27483",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^7.3 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "1.*",
"vimeo/psalm": "^4.6.2"
},
"type": "library",
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
},
"classmap": [
"stubs/Stringable.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP Enum contributors",
"homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
}
],
"description": "PHP Enum implementation",
"homepage": "http://github.com/myclabs/php-enum",
"keywords": [
"enum"
],
"support": {
"issues": "https://github.com/myclabs/php-enum/issues",
"source": "https://github.com/myclabs/php-enum/tree/1.8.4"
},
"funding": [
{
"url": "https://github.com/mnapoli",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum",
"type": "tidelift"
}
],
"time": "2022-08-04T09:53:51+00:00"
},
{
"name": "phpoffice/phpspreadsheet",
"version": "1.28.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "6e81cf39bbd93ebc3a4e8150444c41e8aa9b769a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/6e81cf39bbd93ebc3a4e8150444c41e8aa9b769a",
"reference": "6e81cf39bbd93ebc3a4e8150444c41e8aa9b769a",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
"ext-zip": "*",
"ext-zlib": "*",
"ezyang/htmlpurifier": "^4.15",
"maennchen/zipstream-php": "^2.1",
"markbaker/complex": "^3.0",
"markbaker/matrix": "^3.0",
"php": "^7.4 || ^8.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-main",
"dompdf/dompdf": "^1.0 || ^2.0",
"friendsofphp/php-cs-fixer": "^3.2",
"mitoteam/jpgraph": "^10.2.4",
"mpdf/mpdf": "^8.1.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.0",
"squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5"
},
"suggest": {
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
"ext-intl": "PHP Internationalization Functions",
"mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
"tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "https://blog.maartenballiauw.be"
},
{
"name": "Mark Baker",
"homepage": "https://markbakeruk.net"
},
{
"name": "Franck Lefevre",
"homepage": "https://rootslabs.net"
},
{
"name": "Erik Tilt"
},
{
"name": "Adrien Crivelli"
}
],
"description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
"keywords": [
"OpenXML",
"excel",
"gnumeric",
"ods",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.28.0"
},
"time": "2023-02-25T12:24:49+00:00"
},
{
"name": "psr/http-client",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client/tree/master"
},
"time": "2020-06-29T06:28:15+00:00"
},
{
"name": "psr/http-factory",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/master"
},
"time": "2019-04-30T12:38:16+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/master"
},
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "psr/simple-cache",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/simple-cache.git",
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\SimpleCache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for simple caching",
"keywords": [
"cache",
"caching",
"psr",
"psr-16",
"simple-cache"
],
"support": {
"source": "https://github.com/php-fig/simple-cache/tree/master"
},
"time": "2017-10-23T01:57:42+00:00"
},
{
"name": "symfony/deprecation-contracts",
"version": "v2.5.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"files": [
"function.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-01-02T09:53:40+00:00"
},
{
"name": "symfony/finder",
"version": "v5.4.21",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "078e9a5e1871fcfe6a5ce421b539344c21afef19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/078e9a5e1871fcfe6a5ce421b539344c21afef19",
"reference": "078e9a5e1871fcfe6a5ce421b539344c21afef19",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-php80": "^1.16"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Finder\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v5.4.21"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2023-02-16T09:33:00+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.27.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
"reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-mbstring": "*"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-11-03T14:55:06+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.27.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
"reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.27-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2022-11-03T14:55:06+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.3.0"
}

15
dbconn.php 100644
View File

@ -0,0 +1,15 @@
<?php
// Database configuration variables
$dbHost = 'localhost';
$dbUsername = 'root';
$dbPassword = '';
$dbName = 'qraset';
// Establishing a new database connection using mysqli()
$conn = mysqli_connect($dbHost, $dbUsername, $dbPassword, $dbName);
// Checking for connection errors
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
?>

BIN
image/loading.gif 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
image/pemkot.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -1,8 +1,24 @@
<?php
session_start();
require_once __DIR__.'/vendor/autoload.php';
use Gregwar\Captcha\CaptchaBuilder;
$builder = new CaptchaBuilder;
$builder->build();
$_SESSION['phrase'] = $builder->getPhrase();
?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>QRCode Generator Asset Diskominsta</title> <title>QRCode Generator Asset Diskominsta</title>
<link rel="icon" type="image/x-icon" href="https://magelangkota.go.id/logomagelang.ico">
<!-- Font Awesome Icons --> <!-- Font Awesome Icons -->
<link <link
rel="stylesheet" rel="stylesheet"
@ -19,6 +35,9 @@
/> />
<!-- Stylesheet --> <!-- Stylesheet -->
<link rel="stylesheet" href="style.css" /> <link rel="stylesheet" href="style.css" />
<!-- Sweet Alert -->
<link href="https://cdn.jsdelivr.net/npm/sweetalert2@11.7.3/dist/sweetalert2.min.css" rel="stylesheet">
</head> </head>
<body> <body>
<div class="container mx-auto h-screen"> <div class="container mx-auto h-screen">
@ -41,24 +60,49 @@
</div> </div>
<form enctype="multipart/form-data" class="w-1/2 flex flex-col"> <form enctype="multipart/form-data" class="w-1/2 flex flex-col" id="form">
<input type="file" id="upload-button" multiple accept=".xlsx, .xls, .csv" /> <input type="file" name="file" id="upload-button" accept=".xlsx, .xls"/>
<label for="upload-button" class="flex flex-col items-center justify-center w-full h-60 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600"> <label for="upload-button" class="flex flex-col items-center justify-center w-full h-60 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600">
<div class="flex flex-col items-center justify-center pt-5 pb-6"> <div class="flex flex-col items-center justify-center pt-5 pb-6">
<svg aria-hidden="true" class="w-10 h-10 mb-3 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"></path></svg> <svg aria-hidden="true" class="w-10 h-10 mb-3 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"></path></svg>
<p class="mb-2 text-sm text-gray-500 dark:text-gray-400"><span class="font-semibold">Klik untuk unggah</span> atau tarik file</p> <p class="mb-2 text-sm text-gray-500 dark:text-gray-400"><span class="font-semibold">Klik untuk unggah</span> atau tarik file</p>
<p class="text-xs text-gray-500 dark:text-gray-400">excel file (MAX. 5Mb)</p> <p class="text-xs text-gray-500 dark:text-gray-400">excel file (MAX. 5Mb)</p>
<p class="text-xs text-gray-500 dark:text-gray-400">*file yang diizinkan hanya .xls dan .xlsx</p>
</div> </div>
</label> </label>
<div id="error"></div> <div id="error"></div>
<div id="file-display"></div> <div id="file-display"></div>
<div class="grid grid-cols-1 gap-4 mt-2 mb-2">
<div>
<input type="password" maxlength="128" minlength="128" size="128" class="w-full bg-gray-200 rounded-lg py-2 px-4 focus:outline-none focus:bg-white transition duration-150 ease-in-out" name="key" aria-describedby="key" placeholder="input key" required>
</div>
</div>
<div class="grid grid-cols-2 gap-4 mt-2">
<div>
<input type="text" maxlength="5" minlength="5" size="5" class="w-full bg-gray-200 rounded-lg py-2 px-4 focus:outline-none focus:bg-white transition duration-150 ease-in-out" name="capcay" aria-describedby="code" placeholder="Masukan Kode Captcha" required>
</div>
<div>
<img width="100%" class="img-fluid img-thumbnail" src="<?php echo $builder->inline(); ?>" />
</div>
</div>
<button type="submit" class="text-white bg-gray-800 hover:bg-gray-900 focus:outline-none focus:ring-4 focus:ring-gray-300 font-medium rounded-lg text-sm md:px-5 px-3 md:py-2.5 py-2 mr-2 mb-2 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:border-gray-700 mt-8">Unggah File</button> <button type="submit" class="text-white bg-gray-800 hover:bg-gray-900 focus:outline-none focus:ring-4 focus:ring-gray-300 font-medium rounded-lg text-sm md:px-5 px-3 md:py-2.5 py-2 mr-2 mb-2 dark:bg-gray-800 dark:hover:bg-gray-700 dark:focus:ring-gray-700 dark:border-gray-700 mt-8">Unggah File</button>
</form> </form>
<a class="mt-2 text-blue-500 underline" href="template/template.xlsx" download>Download template excel</a>
</div> </div>
</div> </div>
<!-- Script --> <!-- Script -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.7.3/dist/sweetalert2.all.min.js"></script>
<script src="script.js"></script> <script src="script.js"></script>
</body> </body>
</html> </html>

74
qraset.sql 100644
View File

@ -0,0 +1,74 @@
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 21, 2023 at 03:14 AM
-- Server version: 10.4.27-MariaDB
-- PHP Version: 7.4.33
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `qraset`
--
-- --------------------------------------------------------
--
-- Table structure for table `aset`
--
CREATE TABLE `aset` (
`id` bigint(20) NOT NULL,
`kode` varchar(200) NOT NULL,
`nama` varchar(100) NOT NULL,
`reg` varchar(20) NOT NULL,
`merk` varchar(100) NOT NULL,
`ukuran` varchar(100) NOT NULL,
`bahan` varchar(100) NOT NULL,
`warna` varchar(50) DEFAULT NULL,
`tahun` varchar(100) NOT NULL,
`pabrik` varchar(100) DEFAULT NULL,
`rangka` varchar(100) DEFAULT NULL,
`mesin` varchar(100) DEFAULT NULL,
`polisi` varchar(100) DEFAULT NULL,
`bpkb` varchar(100) DEFAULT NULL,
`asal` varchar(100) NOT NULL,
`harga` varchar(100) NOT NULL,
`keterangan` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `aset`
--
ALTER TABLE `aset`
ADD PRIMARY KEY (`id`),
ADD KEY `kode` (`kode`,`nama`,`merk`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `aset`
--
ALTER TABLE `aset`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

114
script.js
View File

@ -80,3 +80,117 @@ container.addEventListener(
window.onload = () => { window.onload = () => {
error.innerText = ""; error.innerText = "";
}; };
$(document).ready(function (e) {
$("#form").on('submit',(function(e) {
e.preventDefault();
if(document.getElementById("upload-button").files.length == 0 ){
Swal.fire({
icon: 'error',
title: 'Gagal',
text: 'Tidak ada file yang akan diupload !',
})
} else {
Swal.fire({
icon: 'info',
title: 'Proses Upload',
html: '<p align="center">Proses generate QR code mungkin akan membutuhkan waktu yang cukup lama.<br><img style="text-align:center;" src="image/loading.gif"></p>',
showConfirmButton: false,
allowOutsideClick: false,
backdrop: `
rgba(0,0,0,0.7)
`
});
$.ajax({
url: "ajaxupload.php",
type: "POST",
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
success: function(data)
{
if(data=='invalid')
{
Swal.fire({
icon: 'error',
title: 'Gagal',
text: 'Terjadi kesalahan !',
})
}
else if(data=='capcay'){
Swal.fire({
icon: 'error',
title: 'Gagal',
text: 'Kode Captcha salah !',
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
window.location.replace("http://localhost/qr-aset");
}
})
}
else if(data=='key'){
Swal.fire({
icon: 'error',
title: 'Gagal',
text: 'key yang anda gunakan ditolak !',
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
window.location.replace("http://localhost/qr-aset");
}
})
}
else
{
Swal.fire({
icon: 'success',
title: 'Berhasil',
text: 'Upload file berhasil. silahkan download file qr code.',
confirmButtonText: 'Download',
allowOutsideClick: false,
}).then((result) => {
/* Read more about isConfirmed, isDenied below */
if (result.isConfirmed) {
$("#file-display" ).hide();
$('#form').trigger("reset");
window.location.replace("http://localhost/qr-aset/tempzip/qraset.zip");
}
});
}
},
error: function(e)
{
Swal.fire({
icon: 'error',
title: 'Gagal',
text: 'Terjadi kesalahan !',
})
}
});
}
}));
});

BIN
tempzip/qraset.zip 100644

Binary file not shown.

View File

@ -0,0 +1,4 @@
[ViewState]
Mode=
Vid=
FolderType=Generic

201
view/index.php 100644
View File

@ -0,0 +1,201 @@
<?php
if(!(isset($_GET['aset']))) {
header("Location: http://localhost/qr-aset/");
} else {
$aset = base64_decode($_GET['aset']);
}
include '../dbconn.php';
$sql = "SELECT * FROM aset WHERE `id`='$aset' LIMIT 1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$kode = $row["kode"];
$nama = $row["nama"];
$reg = $row["reg"];
$merk = $row["merk"];
$ukuran = $row["ukuran"];
$bahan = $row["bahan"];
$warna = $row["warna"];
$tahun = $row["tahun"];
$pabrik = $row["pabrik"];
$rangka = $row["rangka"];
$mesin = $row["mesin"];
$polisi = $row["polisi"];
$bpkb = $row["bpkb"];
$asal = $row["asal"];
$harga =$row["harga"];
$keterangan = $row["keterangan"];
}
} else {
header("Location: http://localhost/qr-aset/");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QRCode Generator Asset Diskominsta</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css"
/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.6.4/flowbite.min.css" rel="stylesheet" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@200;400;500;600;700&display=swap" rel="stylesheet">
<!-- Google Font -->
<link
href="https://fonts.googleapis.com/css2?family=Poppins&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div class="flex flex-col justify-center items-center w-full h-full px-1">
<div class="flex flex-col justify-center items-center mt-10">
<div class="w-14 md:w-20 mb-5">
<img src="../image/magelang.svg" class="w-full h-full">
</div>
<div class="text-sm md:text-xl lg:text-2xl flex flex-col items-center font-medium">
<span class="py-2">
Dinas Komunikasi Informatika dan Statistik
</span>
<span>
Kota Magelang
</span>
</div>
</div>
<div class="text-xl font-semibold mt-10">DETAIL BARANG</div>
<div class="w-full p-4 bg-white border border-gray-200 rounded-lg shadow sm:p-6 dark:bg-gray-800 dark:border-gray-700 my-6 max-w-xl">
<ul class="my-4 space-y-3">
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Kode Barang : </span>
<span class="flex-2 ml-1"><?= $kode ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Jenis / Nama Barang : </span>
<span class="flex-2 ml-3"><?= $nama ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Reg : </span>
<span class="flex-2 ml-3"><?= $reg ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Merk Type : </span>
<span class="flex-2 ml-3"><?= $merk ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Ukuran : </span>
<span class="flex-2 ml-3"><?= $ukuran ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Bahan : </span>
<span class="flex-2 ml-3"><?= $bahan ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Warna : </span>
<span class="flex-2 ml-3"><?= $warna ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Tahun Pembelian : </span>
<span class="flex-2 ml-3"><?= $tahun ?>
</span>
</div>
</li>
<li>
<div hunf="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Pabrik : </span>
<span class="flex-2 ml-3"><?= $pabrik ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Rangka : </span>
<span class="flex-2 ml-3"><?= $rangka ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Mesin : </span>
<span class="flex-2 ml-3"><?= $mesin ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Polisi : </span>
<span class="flex-2 ml-3"><?= $polisi ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">BPKB : </span>
<span class="flex-2 ml-3"><?= $bpkb ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Asal Usul : </span>
<span class="flex-2 ml-3"><?= $asal ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Harga : </span>
<span class="flex-2 ml-3"> <?= "Rp. ".$harga ?>
</span>
</div>
</li>
<li>
<div href="#" class="flex items-center p-3 text-sm font-bold text-gray-900 rounded-lg bg-gray-50 hover:bg-gray-100 group hover:shadow dark:bg-gray-600 dark:hover:bg-gray-500 dark:text-white">
<span class="flex-2 ml-3">Keterangan : </span>
<span class="flex-2 ml-3"><?= $keterangan ?>
</span>
</div>
</li>
</ul>
</div>
</div>
</body>
</html>