蜗牛的壳 - database
type: channel
link: https://snailium.com/tag/database/
items: 自制Mac Vendor数据库（PHP/SQLite3）
items: Getting away from Globat. Not trustable!

自制Mac Vendor数据库（PHP/SQLite3）
type: item
date: 2017-07-23T16:31:00-04:00
description: 制作 SQLite3 数据库 首先，去 IEEE 下载最新的 OUI 数据库。 wget http://standards-oui.ieee.org/oui/oui.txt 然后把数据库转换成 CSV 格式。 grep "(base 16)" oui.txt > oui_base16.txt perl -p -i -e 's/\,/ /gm' oui_base16.txt perl -p -i -e 's/\s+\(base 16\)\s+/,/' oui_base16.txt 打开 SQLite3，导入 CSV，并保存到数据库文件 $ sqlite3 sqlite> create table Lookup(MAC, VENDOR); sqlite> .mode csv sqlite> .import oui_base16.txt Lookup sqlite> .save mac_vendor.sqlite3 sqlite> .quit 让 PHP 读取数据库 首先要确定 PHP 已安装 SQLite3 组件，PHP5 的安装方法是 sudo apt-get install php5-sqlite sudo service apache2 restart 然后，在 PHP 代码里面加载数据库和查询函数 // Load vendor database $mac_vendor_file = "mac_vendor.sqlite3"; $vendor_db = new SQLite3($mac_vendor_file); function get_vendor($db, $mac) { $mac_oui = substr(preg_replace("/\W/", "", $mac), 0, 6); return $db->querySingle("SELECT VENDOR FROM Lookup WHERE MAC=\"${mac_oui}\""); } 要查询制造商，只需要调用函数就可以了 $mac = "70:62:B8:94:11:49"; echo "Vendor of ${mac} is ", get_vendor($vendor_db, $mac); // Vendor of 70:62:B8:94:11:49 is D-Link International

Getting away from Globat. Not trustable!
type: item
date: 2008-03-01T02:14:22-05:00
description: OK, for some reasons, I write this article in English. I bet you Chinese can understand it.The problem was simple. Globat's servers got down on Feb. 21, because of switch problem. Well, that was not the critical impact.On Feb 23 afternoon, I found my database got problem, probably database crashed. I talked to their technical support. They told me they were working on it, and needed sometime. I thought it was acceptable. But then, things got much worse.On Feb 23 evening, the database was still down. Technical support suggested me to issue a ticket. I did. Then, I still hoped it would be better.On Feb 23 night, I got the first (and the only) response to that ticket. It was said they were taking care my issue.On Feb 24, they told me they had fixed the problem. But again, my database was still reporting errors. Then, they changed to another word, saying they were trying to fix the problem.On Feb 25, the problem was still hanging my websites. They were still saying to fix it.On Feb 26, they told me, hopefully, they would fix the problem by both recovering from previous backup and fixing existing database. I got confused and totally lost my patience.On Feb 27, I tried use phpMyAdmin to repair tables, and got all tables recovered except one of them. Finally, I got a happy ending by myself. Definitely, they were still "fixing the problem".As of that time, all my websites have been down for almost a week. Those websites include, snailium.net, blue-dv.net and sdfzlt.cn.I tried to search "Globat problems" in Google. It seems Globat has problem to deal with customers frequently. I have no more passion on a troublesome web server. Therefore, I temporarily moved to Lunarpages, under xiaoqiangnet.com.Further, I will shut down all my websites on Globat and move them all to a new server, although they are still fixing the problem.