diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57872d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/vendor/ diff --git a/ajaxupload.php b/ajaxupload.php new file mode 100644 index 0000000..83b5849 --- /dev/null +++ b/ajaxupload.php @@ -0,0 +1,284 @@ +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 . "
" . $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/"); +} + + +?> \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..c5517d9 --- /dev/null +++ b/composer.json @@ -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" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..e7361bb --- /dev/null +++ b/composer.lock @@ -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" +} diff --git a/dbconn.php b/dbconn.php new file mode 100644 index 0000000..036ac4e --- /dev/null +++ b/dbconn.php @@ -0,0 +1,15 @@ + diff --git a/image/loading.gif b/image/loading.gif new file mode 100644 index 0000000..b4c6b19 Binary files /dev/null and b/image/loading.gif differ diff --git a/image/pemkot.png b/image/pemkot.png new file mode 100644 index 0000000..a9db090 Binary files /dev/null and b/image/pemkot.png differ diff --git a/index.html b/index.php similarity index 63% rename from index.html rename to index.php index a7f1048..fcd5857 100644 --- a/index.html +++ b/index.php @@ -1,8 +1,24 @@ +build(); + + $_SESSION['phrase'] = $builder->getPhrase(); + + +?> QRCode Generator Asset Diskominsta + + + + + +
@@ -41,24 +60,49 @@
-
- + +
+ +
+
+ +
+
+ + + +
+
+ +
+
+ +
+
+
+ Download template excel + + + + + diff --git a/qraset.sql b/qraset.sql new file mode 100644 index 0000000..c06ea2d --- /dev/null +++ b/qraset.sql @@ -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 */; diff --git a/script.js b/script.js index 3f9ab6e..f549a49 100644 --- a/script.js +++ b/script.js @@ -80,3 +80,117 @@ container.addEventListener( window.onload = () => { 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: '

Proses generate QR code mungkin akan membutuhkan waktu yang cukup lama.

', + 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 !', + }) + } + }); + + + } + + })); + }); diff --git a/tempzip/qraset.zip b/tempzip/qraset.zip new file mode 100644 index 0000000..f385140 Binary files /dev/null and b/tempzip/qraset.zip differ diff --git a/uploads/desktop.ini b/uploads/desktop.ini new file mode 100644 index 0000000..d957fd1 --- /dev/null +++ b/uploads/desktop.ini @@ -0,0 +1,4 @@ +[ViewState] +Mode= +Vid= +FolderType=Generic diff --git a/view/index.php b/view/index.php new file mode 100644 index 0000000..6c114bd --- /dev/null +++ b/view/index.php @@ -0,0 +1,201 @@ +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/"); +} + + +?> + + + + + + + QRCode Generator Asset Diskominsta + + + + + + + + + + +
+
+
+ +
+
+ + Dinas Komunikasi Informatika dan Statistik + + + Kota Magelang + +
+ +
+
DETAIL BARANG
+
+ +
+
+ + + + \ No newline at end of file