小鎮樹妖--住在樹上的妖

          To follow the path: look to the master, follow the master, walk with the master, see through the master, become the master.

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            10 Posts :: 50 Stories :: 7 Comments :: 0 Trackbacks

          <?php
          /**
          * 類名: mobile
          * 描述: 手機信息類
          * 其他: 偶然 編寫
          */

          class mobile{
          ?/**
          ?* 函數名稱: getPhoneNumber
          ?* 函數功能: 取手機號
          ?* 輸入參數: none
          ?* 函數返回值: 成功返回號碼,失敗返回false
          ?* 其它說明: 說明
          ?*/
          ?function getPhoneNumber(){
          ??if (isset($_SERVER['HTTP_X_NETWORK_INFO'])){
          ???$str1 = $_SERVER['HTTP_X_NETWORK_INFO'];
          ???$getstr1 = preg_replace('/(.*,)(11[d])(,.*)/i','\2',$str1);
          ???Return $getstr1;
          ??}elseif (isset($_SERVER['HTTP_X_UP_CALLING_LINE_ID'])){
          ???$getstr2 = $_SERVER['HTTP_X_UP_CALLING_LINE_ID'];
          ???Return $getstr2;
          ??}elseif (isset($_SERVER['HTTP_X_UP_SUBNO'])){
          ???$str3 = $_SERVER['HTTP_X_UP_SUBNO'];
          ???$getstr3 = preg_replace('/(.*)(11[d])(.*)/i','\2',$str3);
          ???Return $getstr3;
          ??}elseif (isset($_SERVER['DEVICEID'])){
          ???Return $_SERVER['DEVICEID'];
          ??}else{
          ???Return false;
          ??}
          ?}

          ?/**
          ?* 函數名稱: getHttpHeader
          ?* 函數功能: 取頭信息
          ?* 輸入參數: none
          ?* 函數返回值: 成功返回號碼,失敗返回false
          ?* 其它說明: 說明
          ?*/
          ?function getHttpHeader(){
          ??$str = '';
          ??foreach ($_SERVER as $key=>$val){
          ???$gstr = str_replace("&","&",$val);
          ???$str.= "$key -> ".$gstr."\r\n";
          ??}
          ??Return $str;
          ?}

          ?/**
          ?* 函數名稱: getUA
          ?* 函數功能: 取UA
          ?* 輸入參數: none
          ?* 函數返回值: 成功返回號碼,失敗返回false
          ?* 其它說明: 說明
          ?*/
          ?function getUA(){
          ??if (isset($_SERVER['HTTP_USER_AGENT'])){
          ???Return $_SERVER['HTTP_USER_AGENT'];
          ??}else{
          ???Return false;
          ??}
          ?}

          ?/**
          ?* 函數名稱: getPhoneType
          ?* 函數功能: 取得手機類型
          ?* 輸入參數: none
          ?* 函數返回值: 成功返回string,失敗返回false
          ?* 其它說明: 說明
          ?*/
          ?function getPhoneType(){
          ??$ua = $this->getUA();
          ??if($ua!=false){
          ???$str = explode(' ',$ua);
          ???Return $str[0];
          ??}else{
          ???Return false;
          ??}
          ?}

          ?/**
          ?* 函數名稱: isOpera
          ?* 函數功能: 判斷是否是opera
          ?* 輸入參數: none
          ?* 函數返回值: 成功返回string,失敗返回false
          ?* 其它說明: 說明
          ?*/
          ?function isOpera(){
          ??$uainfo = $this->getUA();
          ??if (preg_match('/.*Opera.*/i',$uainfo)){
          ???Return true;
          ??}else{
          ???Return false;
          ??}
          ?}

          ?/**
          ?* 函數名稱: isM3gate
          ?* 函數功能: 判斷是否是m3gate
          ?* 輸入參數: none
          ?* 函數返回值: 成功返回string,失敗返回false
          ?* 其它說明: 說明
          ?*/
          ?function isM3gate(){
          ??$uainfo = $this->getUA();
          ??if (preg_match('/M3Gate/i',$uainfo)){
          ???Return true;
          ??}else{
          ???Return false;
          ??}
          ?}

          ?/**
          ?* 函數名稱: getHttpAccept
          ?* 函數功能: 取得HA
          ?* 輸入參數: none
          ?* 函數返回值: 成功返回string,失敗返回false
          ?* 其它說明: 說明
          ?*/
          ?function getHttpAccept(){
          ??if (isset($_SERVER['HTTP_ACCEPT'])){
          ???Return $_SERVER['HTTP_ACCEPT'];
          ??}else{
          ???Return false;
          ??}
          ?}

          ?/**
          ?* 函數名稱: getIP
          ?* 函數功能: 取得手機IP
          ?* 輸入參數: none
          ?* 函數返回值: 成功返回string
          ?* 其它說明: 說明
          ?*/
          ?function getIP(){
          ??$ip=getenv('REMOTE_ADDR');
          ??$ip_ = getenv('HTTP_X_FORWARDED_FOR');
          ??if (($ip_ != "") && ($ip_ != "unknown")){
          ???$ip=$ip_;
          ??}
          ??return $ip;
          ?}
          }
          ?>

          posted on 2006-09-06 14:53 jacky wu 閱讀(269) 評論(0)  編輯  收藏 所屬分類: PHP
          主站蜘蛛池模板: 博野县| 怀安县| 江口县| 尼木县| 长岭县| 姜堰市| 连州市| 阿拉善盟| 广饶县| 房山区| 福安市| 廉江市| 电白县| 和政县| 和平区| 通化县| 黄骅市| 翁牛特旗| 阳信县| 兴安县| 靖西县| 宝山区| 海晏县| 开阳县| 南汇区| 安西县| 塔城市| 开封县| 林周县| 扬州市| 青川县| 交口县| 台州市| 霍邱县| 遂溪县| 资阳市| 绿春县| 浪卡子县| 乌恰县| 噶尔县| 姚安县|