aboutsummaryrefslogtreecommitdiff
path: root/scripts/vendorid/insert_vendors.php
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/vendorid/insert_vendors.php')
-rw-r--r--scripts/vendorid/insert_vendors.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/vendorid/insert_vendors.php b/scripts/vendorid/insert_vendors.php
new file mode 100644
index 0000000..14f2235
--- /dev/null
+++ b/scripts/vendorid/insert_vendors.php
@@ -0,0 +1,24 @@
+#! /usr/bin/php
+<?php
+
+//created by Antonio Gallo (tonicucoz@yahoo.com) and P. J. McDermott
+// this script is in the Public Domain
+
+include("connect.php");
+include("functions.php");
+
+$ids_fp = fopen('pci.ids', 'r');
+
+while (($line = fgets($ids_fp)) !== false) {
+ if (preg_match('/^([0-9a-f]{4})\s+(.*)\s*$/',
+ $line, $matches) == 1) {
+ $vendorid = $matches[1];
+ $full_name = sanitizeDb(decode_soft($matches[2]));
+ $clean_name = sanitizeDb(decode($matches[2]));
+// echo "$vendorid $full_name $clean_name".PHP_EOL;
+ $query = "INSERT INTO vendors (bus,vendorid,clean_name,full_name) VALUES ('pci','$vendorid','$clean_name','$full_name');";
+ DB::$instance->query($query);
+ }
+}
+
+fclose($ids_fp); \ No newline at end of file