数据库设计
create table crawler ( crawler_ID bigint() unsigned not null auto_increment primary key, crawler_category varchar() not null, crawler_date datetime not null default '-- ::', crawler_url varchar() not null, crawler_IP varchar() not null )default charset=utf;
php代码
-)
{
$Bot = "Other Crawler";
}
if (strpos($agent,"googlebot")>-)
{
$Bot = "Google";
}
if (strpos($agent,"mediapartners-google")>-)
{
$Bot = "Google Adsense";
}
if (strpos($agent,"baiduspider")>-)
{
$Bot = "Baidu";
}
if (strpos($agent,"sogou spider")>-)
{
$Bot = "Sogou";
}
if (strpos($agent,"yahoo")>-)
{
$Bot = "Yahoo!";
}
if (strpos($agent,"msn")>-)
{
$Bot = "MSN";
}
if (strpos($agent,"ia_archiver")>-)
{
$Bot = "Alexa";
}
if (strpos($agent,"iaarchiver")>-)
{
$Bot = "Alexa";
}
if (strpos($agent,"sohu")>-)
{
$Bot = "Sohu";
}
if (strpos($agent,"sqworm")>-)
{
$Bot = "AOL";
}
if (strpos($agent,"yodaoBot")>-)
{
$Bot = "Yodao";
}
if (strpos($agent,"iaskspider")>-)
{
$Bot = "Iask";
}
require("./dbinfo.php");
date_default_timezone_set('PRC');
$shijian=date("Y-m-d h:i:s", time());
// 连接到 MySQL 服务器
$connection = mysql_connect ($host, $username, $password);
if (!$connection)
{
die('Not connected : ' . mysql_error());
}
// 设置活动的 MySQL 数据库
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected)
{
die ('Can\'t use db : ' . mysql_error());
}
// 向数据库插入数据
$query = "insert into crawler (crawler_category, crawler_date, crawler_url, crawler_IP) values ('$Bot','$shijian','$GetLocationURL','$serverip')";
$result = mysql_query($query);
if (!$result)
{
die('Invalid query: ' . mysql_error());
}
?>html展示
51shop 由 PHP 语言开发, 使用快速的 MySQL 数据库保存数据 ,为中小型网站实现网上电子商务提供一个完美的解决方案.一、用户模块1. 用户注册:用户信息包括:用户ID、用户名、用户密码、性别、邮箱、省份、城市、 联系电话等信息,用户注册后不能立即使用,需由管理员激活账号,才可使用(此功能管理员可设置)2. 登录功能3. 资料修改:用户可修改除账号以后的所有资料4. 忘记密码:要求用
num_rows($mysql -> query("select * from crawler"));
$pages = new PageClass($count,,$_GET['page'],$_SERVER['PHP_SELF'].'?page={page}');
$sql = "select * from crawler order by ";
$sql .= "crawler_date desc limit ".$pages -> page_limit.",".$pages -> myde_size;
$result = $mysql -> query($sql);
?>
| 爬虫访问时间 | 爬虫分类 | 爬虫IP | 爬虫访问的URL | |
![]() |
echo $myrow["crawler_date"] ?> | echo $myrow["crawler_category"] ?> | echo $myrow["crawler_IP"] ?> | echo $myrow["crawler_url"] ?> |











