How To block pc user to view my site url and view my site Only mobile

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How To block pc user to view my site url and view my site Only mobile

    How To block pc user to view my site url and view my site Only mobile plz help

    Added after 5 minutes:

    Plz guide me the easiest way look it www.wapday.com this site only visible for mobile user but if u browse it on pc it show open it 4m mobile just i want the same thing for my url
    Last edited by kolkatawap; 07.08.11, 17:24.

    #2
    Originally posted by kolkatawap View Post
    How To block pc user to view my site url and view my site Only mobile plz help

    Added after 5 minutes:

    Plz guide me the easiest way look it www.wapday.com this site only visible for mobile user but if u browse it on pc it show open it 4m mobile just i want the same thing for my url

    Add this function to the very top of your index page
    <?php
    //////GYSMS.com Browser Detection

    $mobile_browser = '0';

    if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wa p|phone)/i',
    strtolower($_SERVER['HTTP_USER_AGENT']))){
    $mobile_browser++;
    }

    if((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')>0) or
    ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))){
    $mobile_browser++;
    }

    $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4));
    $mobile_agents = array(
    'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird' ,'blac',
    'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
    'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
    'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
    'newt','noki','oper','palm','pana','pant','phil',' play','port','prox',
    'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
    'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
    'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
    'wapr','webc','winw','winw','xda','xda-');

    if(in_array($mobile_ua,$mobile_agents)){
    $mobile_browser++;
    }
    if (strpos(strtolower($_SERVER['ALL_HTTP']),'OperaMini')>0) {
    $mobile_browser++;
    }
    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows')>0) {
    $mobile_browser=0;
    }


    if($mobile_browser>0){

    header("Location: http://www.yourmobilesite.com");
    }
    else{
    header("Location: http://www.yoursite.com/notphone.php");

    }

    ?>

    Comment


      #3
      Thanks but what is there i just copy and paste the code in top of my index page but what is there yoursite.com/notphone.php is it mysiteurl/notphone.php i have to make
      Originally posted by Anthony View Post
      Add this function to the very top of your index page
      Added after 10 minutes:

      Brother My site name is Index of / may i copy your whole code and paste top of my index page or make a file such.php and include function at top of my index page
      Last edited by kolkatawap; 07.08.11, 18:09.

      Comment


        #4
        Originally posted by kolkatawap View Post
        Thanks but what is there i just copy and paste the code in top of my index page but what is there yoursite.com/notphone.php is it mysiteurl/notphone.php i have to make

        Added after 10 minutes:

        Brother My site name is Index of / may i copy your whole code and paste top of my index page or make a file such.php and include function at top of my index page

        bro where it says
        if($mobile_browser>0){

        header("Location: http://www.yourmobilesite.com");
        }
        else{
        header("Location: http://www.yoursite.com/notphone.php");

        }
        You have to replace with the url of your site


        if($mobile_browser>0){

        header("Location: http://www.willme.in/mobile.php");
        }
        else{
        header("Location: http://www.willme.in/notphone.php");

        }

        You have to create a page where you want to display a message to the web browsers

        Comment


          #5
          Originally posted by kolkatawap View Post
          How To block pc user to view my site url and view my site Only mobile plz help

          Added after 5 minutes:

          Plz guide me the easiest way look it www.wapday.com this site only visible for mobile user but if u browse it on pc it show open it 4m mobile just i want the same thing for my url
          you can't block PC to browse on your site !
          simple as that
          It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
          ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
          ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
          キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

          Comment


            #6
            Originally posted by metulj View Post
            you can't block PC to browse on your site !
            simple as that

            He wants to redirect PC users to a "NOT WELCOME MESSAGE" and Mobile Phones to his mobile site.

            Comment


              #7
              Use this class Detect Mobile Browsers - Mobile User Agent Detection

              Comment


                #8
                Brother i couldn't find the way Plz help i have copy and paste all code u mention here in a notphone.php file and place <?php include("notphone.php")/>;in my main index.php- is it such way i need to do or other way

                Comment


                  #9
                  Originally posted by kolkatawap View Post
                  Brother i couldn't find the way Plz help i have copy and paste all code u mention here in a notphone.php file and place <?php include("notphone.php")/>;in my main index.php- is it such way i need to do or other way
                  Originally posted by kolkatawap
                  Search google best place ever
                  i wonder why you are asking questions here ?
                  It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
                  ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
                  ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
                  キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

                  Comment


                    #10
                    Originally posted by kolkatawap View Post
                    Brother i couldn't find the way Plz help i have copy and paste all code u mention here in a notphone.php file and place <?php include("notphone.php")/>;in my main index.php- is it such way i need to do or other way

                    bro send me a email so i can do this for you since you are having a hard time understanding my previous post : admin[~at~]gysms.com

                    Comment


                      #11
                      Originally posted by metulj View Post
                      you can't block PC to browse on your site !
                      simple as that
                      wrong wml can be seen only by phone and opera , operamini there are redirect codes to send mobile browsers into certain page and pc users to send them into another certain page.

                      Comment


                        #12
                        Originally posted by Framework View Post
                        wrong wml can be seen only by phone and opera , operamini there are redirect codes to send mobile browsers into certain page and pc users to send them into another certain page.
                        what you are babbling about ?
                        It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
                        ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
                        ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
                        キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

                        Comment


                          #13
                          Nice This is Worked in my site but i want to add this code in thead.php how i can set?
                          its mean i want to set or unset from my site admin panel

                          Comment


                            #14
                            pc users cannot be blocked to view ur site.. it can be still viewed by changing user agent.. simple option is make one page for pc and another for mobile

                            Comment

                            Working...
                            X