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

          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

          常用鏈接

          留言簿(3)

          我參與的團隊

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          <?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
          主站蜘蛛池模板: 武义县| 湖州市| 十堰市| 广灵县| 兴城市| 合江县| 肥城市| 青冈县| 雷州市| 时尚| 双鸭山市| 罗田县| 岳池县| 东源县| 高安市| 寻乌县| 襄垣县| 张家口市| 黔西| 无极县| 江华| 南雄市| 深州市| 措勤县| 沙洋县| 定结县| 克山县| 阳山县| 西城区| 建湖县| 红原县| 法库县| 四川省| 峨山| 芦溪县| 德安县| 鱼台县| 怀集县| 澄迈县| 自治县| 榕江县|