|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
<?php // -------------------------------------------------- // 分析返回用户操作系统名称 // -------------------------------------------------- function getSystem(){ $sys = $_SERVER['HTTP_USER_AGENT']; if(stripos($sys, "NT 6.1")) $os = "Windows 7"; elseif(stripos($sys, "NT 6.0")) $os = "Windows Vista"; elseif(stripos($sys, "NT 5.1")) $os = "Windows XP"; elseif(stripos($sys, "NT 5.2")) $os = "Windows Server 2003"; elseif(stripos($sys, "NT 5")) $os = "Windows 2000"; elseif(stripos($sys, "NT 4.9")) $os = "Windows ME"; elseif(stripos($sys, "NT 4")) $os = "Windows NT 4.0"; elseif(stripos($sys, "98")) $os = "Windows 98"; elseif(stripos($sys, "95")) $os = "Windows 95"; elseif(stripos($sys, "Mac")) $os = "Mac"; elseif(stripos($sys, "Linux")) $os = "Linux"; elseif(stripos($sys, "Unix")) $os = "Unix"; elseif(stripos($sys, "FreeBSD")) $os = "FreeBSD"; elseif(stripos($sys, "SunOS")) $os = "SunOS"; elseif(stripos($sys, "BeOS")) $os = "BeOS"; elseif(stripos($sys, "OS/2")) $os = "OS/2"; elseif(stripos($sys, "PC")) $os = "Macintosh"; elseif(stripos($sys, "AIX")) $os = "AIX"; else $os = "未知操作系统"; return $os; } // -------------------------------------------------- // 分析返回用户网页浏览器名称 // -------------------------------------------------- function getBrowser(){ $browser = $_SERVER['HTTP_USER_AGENT']; if(strpos(strtolower($browser),"netcaptor")) $exp = "NetCaptor"; elseif(strpos(strtolower($browser),"firefox")){ preg_match("/Firefox\/([^;)]+)+/i", $sys, $b); $exp = "Mozilla Firefox ".$b[1]; }elseif(strpos(strtolower($browser),"maxthon")){ preg_match("/MAXTHON\s+([^;)]+)+/i", $sys, $b); preg_match("/MSIE\s+([^;)]+)+/i", $sys, $ie); $exp = $b[0]." (IE".$ie[1].")"; }elseif(strpos(strtolower($browser),"msie")){ preg_match("/MSIE\s+([^;)]+)+/i", $sys, $ie); $exp = "Internet Explorer ".$ie[1]; }elseif(strpos(strtolower($browser),"netscape")) $exp = "Netscape"; elseif(strpos(strtolower($browser),"opera")) $exp = "Opera"; else $exp = "未知浏览器"; return $exp; } // -------------------------------------------------- // 分析返回用户ip // -------------------------------------------------- function getIp(){ $ip = ''; if ($_SERVER["HTTP_X_FORWARDED_FOR"]){ $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; }elseif ($_SERVER["HTTP_CLIENT_IP"]){ $ip = $_SERVER["HTTP_CLIENT_IP"]; }elseif ($_SERVER["REMOTE_ADDR"]){ $ip = $_SERVER["REMOTE_ADDR"]; }elseif (getenv("HTTP_X_FORWARDED_FOR")){ $ip = getenv("HTTP_X_FORWARDED_FOR"); }elseif (getenv("HTTP_CLIENT_IP")){ $ip = getenv("HTTP_CLIENT_IP"); }elseif (getenv("REMOTE_ADDR")){ $ip = getenv("REMOTE_ADDR"); }else{ $ip = "unknown"; } return $ip; } ?> |
月度归档:2012年04月
如何修改MySQL密码及开启phpMyAdmin 同步功能
修改MySQL密码
进入CMD切换到MySQL 安装目录中
比如安装路径是D:\wamp\bin\mysql\mysql5.1.36\bin
前提:MySQL用户ROOT密码为空。
输入 mysql -u root mysql
mysql> 状态下输入 update user set password=password('新密码') where user='root';
回显
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> 状态下输入 FLUSH PRIVILEGES;
回显
Query OK, 0 rows affected (0.00 sec)
mysql> 状态下输入 exit
退出 sql
重启MySQL
注意每个命令后都要加上一个分号 ";"
MySQL才开始执行该行命令
而第二个指令会让已载入记忆体的 MySQL系统资料库更新
重起 MySQL.
在更新ROOT密码后,以后要与MySQL 连接的方法为:
mysql -u root -p 新密码
如何使用phpMyAdmin管理数据库还要做相应的设置:
修改phpMyAdmin中MySQL ROOT的空改为新密码
例:d:\wamp\apps\phpmyadmin3.0.1.1下的config.inc文件中
$cfg['Servers'][$i]['password'] = ''改为
$cfg['Servers'][$i]['password'] = 'newpassword'
开启phpMyAdmin 同步功能
phpMyAdmin同步功能默认只有localhost,不能修改,这里需要在 config.inc.php里添加一个参数:
|
1 2 |
/* AllowArbitraryServer */ $cfg['AllowArbitraryServer'] = true; |