|
|
@@ -131,6 +131,7 @@ class User extends Controller
|
|
|
'message_status' => 0,
|
|
|
'add_time' => time()
|
|
|
];
|
|
|
+
|
|
|
$info = array();
|
|
|
if(!empty($nick_name)){
|
|
|
$param['nick_name'] = $nick_name;
|
|
|
@@ -199,52 +200,225 @@ class User extends Controller
|
|
|
* 获得访客操作系统
|
|
|
* @return string
|
|
|
*/
|
|
|
- public static function get_os(){
|
|
|
- if (!empty($_SESSION['userAgent'])) {
|
|
|
- $os = $_SESSION['userAgent'];
|
|
|
- if (preg_match('/win/i', $os)) {
|
|
|
- $os = 'Windows';
|
|
|
- } else if (preg_match('/mac/i', $os)) {
|
|
|
- $os = 'MAC';
|
|
|
- } else if (preg_match('/linux/i', $os)) {
|
|
|
- $os = 'Linux';
|
|
|
- } else if (preg_match('/unix/i', $os)) {
|
|
|
- $os = 'Unix';
|
|
|
- } else if (preg_match('/bsd/i', $os)) {
|
|
|
- $os = 'BSD';
|
|
|
- } else {
|
|
|
- $os = 'Other';
|
|
|
- }
|
|
|
- return $os;
|
|
|
- } else {
|
|
|
- return 'unknow';
|
|
|
+// public static function get_os(){
|
|
|
+// if (!empty($_SESSION['userAgent'])) {
|
|
|
+// $os = $_SESSION['userAgent'];
|
|
|
+// if (preg_match('/win/i', $os)) {
|
|
|
+// $os = 'Windows';
|
|
|
+// } else if (preg_match('/mac/i', $os)) {
|
|
|
+// $os = 'MAC';
|
|
|
+// } else if (preg_match('/linux/i', $os)) {
|
|
|
+// $os = 'Linux';
|
|
|
+// } else if (preg_match('/unix/i', $os)) {
|
|
|
+// $os = 'Unix';
|
|
|
+// } else if (preg_match('/bsd/i', $os)) {
|
|
|
+// $os = 'BSD';
|
|
|
+// } else {
|
|
|
+// $os = 'Other';
|
|
|
+// }
|
|
|
+// return $os;
|
|
|
+// } else {
|
|
|
+// return 'unknow';
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ function get_os() {
|
|
|
+ $agent = $_SERVER['HTTP_USER_AGENT'];
|
|
|
+ $os = false;
|
|
|
+ if (stristr($agent,'win')) {
|
|
|
+ $os = 'Windows';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'win') && stristr($agent, '95')) {
|
|
|
+ $os = 'Windows 95';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'win 9x') && stristr($agent, '4.90')) {
|
|
|
+ $os = 'Windows ME';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'win') && stristr($agent,'98')) {
|
|
|
+ $os = 'Windows 98';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'win') && stristr($agent,'nt 5.1')) {
|
|
|
+ $os = 'Windows XP';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'win') && stristr($agent,'nt 5')) {
|
|
|
+ $os = 'Windows 2000';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'win') && stristr($agent,'nt')) {
|
|
|
+ $os = 'Windows NT';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'win') && stristr($agent,'32')) {
|
|
|
+ $os = 'Windows 32';
|
|
|
+ } else if (stristr($agent,'linux')) {
|
|
|
+ $os = 'Linux';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'unix')) {
|
|
|
+ $os = 'Unix';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'sun') && stristr($agent,'os')) {
|
|
|
+ $os = 'SunOS';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'ibm') && stristr($agent,'os')) {
|
|
|
+ $os = 'IBM OS/2';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'Mac')) {
|
|
|
+ $os = 'Mac OS X';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'PowerPC')) {
|
|
|
+ $os = 'PowerPC';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'AIX')) {
|
|
|
+ $os = 'AIX';
|
|
|
}
|
|
|
+ else if (stristr($agent,'HPUX')) {
|
|
|
+ $os = 'HPUX';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'NetBSD')) {
|
|
|
+ $os = 'NetBSD';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'BSD')) {
|
|
|
+ $os = 'BSD';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'OSF1')) {
|
|
|
+ $os = 'OSF1';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'IRIX')) {
|
|
|
+ $os = 'IRIX';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'FreeBSD')) {
|
|
|
+ $os = 'FreeBSD';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'teleport')) {
|
|
|
+ $os = 'teleport';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'flashget')) {
|
|
|
+ $os = 'flashget';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'webzip')) {
|
|
|
+ $os = 'webzip';
|
|
|
+ }
|
|
|
+ else if (stristr($agent,'offline')) {
|
|
|
+ $os = 'offline';
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ $os = '';
|
|
|
+ }
|
|
|
+ return $os;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得访问者浏览器
|
|
|
* @return string
|
|
|
*/
|
|
|
- public static function browse_info(){
|
|
|
- if (!empty($_SESSION['userAgent'])) {
|
|
|
- $br = $_SESSION['userAgent'];
|
|
|
- if (preg_match('/MSIE/i', $br)) {
|
|
|
- $br = 'MSIE';
|
|
|
- } else if (preg_match('/Firefox/i', $br)) {
|
|
|
- $br = 'Firefox';
|
|
|
- } else if (preg_match('/Chrome/i', $br)) {
|
|
|
- $br = 'Chrome';
|
|
|
- } else if (preg_match('/Safari/i', $br)) {
|
|
|
- $br = 'Safari';
|
|
|
- } else if (preg_match('/Opera/i', $br)) {
|
|
|
- $br = 'Opera';
|
|
|
- } else {
|
|
|
- $br = 'Other';
|
|
|
- }
|
|
|
- return $br;
|
|
|
- } else {
|
|
|
- return 'unknow';
|
|
|
+// public static function browse_info(){
|
|
|
+// if (!empty($_SESSION['userAgent'])) {
|
|
|
+// $br = $_SESSION['userAgent'];
|
|
|
+// if (preg_match('/MSIE/i', $br)) {
|
|
|
+// $br = 'MSIE';
|
|
|
+// } else if (preg_match('/Firefox/i', $br)) {
|
|
|
+// $br = 'Firefox';
|
|
|
+// } else if (preg_match('/Chrome/i', $br)) {
|
|
|
+// $br = 'Chrome';
|
|
|
+// } else if (preg_match('/Safari/i', $br)) {
|
|
|
+// $br = 'Safari';
|
|
|
+// } else if (preg_match('/Opera/i', $br)) {
|
|
|
+// $br = 'Opera';
|
|
|
+// } else {
|
|
|
+// $br = 'Other';
|
|
|
+// }
|
|
|
+// return $br;
|
|
|
+// } else {
|
|
|
+// return 'unknow';
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ public function browse_info(){
|
|
|
+ $sys = $_SERVER['HTTP_USER_AGENT']; //获取用户代理字符串
|
|
|
+ if (stripos($sys, "Firefox/") > 0) {
|
|
|
+ preg_match("/Firefox/([^;)]+)+/i", $sys, $b);
|
|
|
+ $exp[0] = "Firefox";
|
|
|
+ $exp[1] = $b[1]; //获取火狐浏览器的版本号
|
|
|
+ } elseif (stripos($sys, "Maxthon") > 0) {
|
|
|
+ preg_match("/Maxthon/([d.]+)/", $sys, $aoyou);
|
|
|
+ $exp[0] = "傲游";
|
|
|
+ $exp[1] = $aoyou[1];
|
|
|
+ } elseif (stripos($sys, "Baiduspider") > 0) {
|
|
|
+ $exp[0] = "百度";
|
|
|
+ $exp[1] = '蜘蛛';
|
|
|
+ }elseif (stripos($sys, "YisouSpider") > 0) {
|
|
|
+ $exp[0] = "一搜";
|
|
|
+ $exp[1] = '蜘蛛';
|
|
|
+ }elseif (stripos($sys, "Googlebot") > 0) {
|
|
|
+ $exp[0] = "谷歌";
|
|
|
+ $exp[1] = '蜘蛛';
|
|
|
+ }elseif (stripos($sys, "Android 4.3") > 0) {
|
|
|
+ $exp[0] = "安卓";
|
|
|
+ $exp[1] = '4.3';
|
|
|
+ }
|
|
|
+ elseif (stripos($sys, "MSIE") > 0) {
|
|
|
+ preg_match("/MSIEs+([^;)]+)+/i", $sys, $ie);
|
|
|
+ $exp[0] = "IE";
|
|
|
+ $exp[1] = $ie[1]; //获取IE的版本号
|
|
|
+ } elseif (stripos($sys, "OPR") > 0) {
|
|
|
+ preg_match("/OPR/([d.]+)/", $sys, $opera);
|
|
|
+ $exp[0] = "Opera";
|
|
|
+ $exp[1] = $opera[1];
|
|
|
+ } elseif(stripos($sys, "Edge") > 0) {
|
|
|
+ //win10 Edge浏览器 添加了chrome内核标记 在判断Chrome之前匹配
|
|
|
+ preg_match("/Edge/([d.]+)/", $sys, $Edge);
|
|
|
+ $exp[0] = "Edge";
|
|
|
+ $exp[1] = $Edge[1];
|
|
|
+ } elseif (stripos($sys, "Chrome") > 0) {
|
|
|
+ preg_match("/Chrome/([d.]+)/", $sys, $google);
|
|
|
+ $exp[0] = "Chrome";
|
|
|
+ $exp[1] = $google[1]; //获取google chrome的版本号
|
|
|
+ } elseif(stripos($sys,'rv:')>0 && stripos($sys,'Gecko')>0){
|
|
|
+ preg_match("/rv:([d.]+)/", $sys, $IE);
|
|
|
+ $exp[0] = "IE";
|
|
|
+ $exp[1] = $IE[1];
|
|
|
+ }else if(stripos($sys,'AhrefsBot')>0){
|
|
|
+ $exp[0] = "AhrefsBot";
|
|
|
+ $exp[1] = '蜘蛛';
|
|
|
+ }else if(stripos($sys,'Safari')>0){
|
|
|
+ preg_match("/([d.]+)/", $sys, $safari);
|
|
|
+ $exp[0] = "Safari";
|
|
|
+ $exp[1] = $safari[1];
|
|
|
+ }else if(stripos($sys,'bingbot')>0){
|
|
|
+ $exp[0] = "必应";
|
|
|
+ $exp[1] = '蜘蛛';
|
|
|
+ }else if(stripos($sys,'WinHttp')>0){
|
|
|
+ $exp[0] = "windows";
|
|
|
+ $exp[1] = 'WinHttp 请求接口工具';
|
|
|
+ }else if(stripos($sys,'iPhone OS 10')>0){
|
|
|
+ $exp[0] = "iPhone";
|
|
|
+ $exp[1] = 'OS 10';
|
|
|
+ }else if(stripos($sys,'Sogou')>0){
|
|
|
+ $exp[0] = "搜狗";
|
|
|
+ $exp[1] = '蜘蛛';
|
|
|
+ }else if(stripos($sys,'HUAWEIM')>0){
|
|
|
+ $exp[0] = "华为";
|
|
|
+ $exp[1] = '手机端';
|
|
|
+ }else if(stripos($sys,'Dalvik')>0){
|
|
|
+ $exp[0] = "安卓";
|
|
|
+ $exp[1] = 'Dalvik虚拟机';
|
|
|
+ }else if(stripos($sys,'Mac OS X 10')>0){
|
|
|
+ $exp[0] = "MAC";
|
|
|
+ $exp[1] = 'OS X10';
|
|
|
+ }else if(stripos($sys,'Opera/9.8')>0){
|
|
|
+ $exp[0] = "Opera";
|
|
|
+ $exp[1] = '9.8';
|
|
|
+ }else if(stripos($sys,'JikeSpider')>0){
|
|
|
+ $exp[0] = "即刻";
|
|
|
+ $exp[1] = '蜘蛛';
|
|
|
+ }else if(stripos($sys,'Baiduspider')>0){
|
|
|
+ $exp[0] = "百度";
|
|
|
+ $exp[1] = '蜘蛛';
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $exp[0] = "";
|
|
|
+ $exp[1] = "";
|
|
|
}
|
|
|
+// return $exp[0].' '.$exp[1];
|
|
|
+ return $exp[0];
|
|
|
}
|
|
|
|
|
|
|