greetings, fellow internet!

welcome to digitalgangster.com, the coolest community for people who hack the gibson and make bajillions of dollars off of online marketing. please click here to register an account (it's free) and join in on a plethora of discussions with the internet elite.

ASGPHE,
ytcracker, original digital gangster
follow me on twitter
fan me on facebook
Results 1 to 21 of 21

Thread: anybody have a script to redirect mobile traffic AND regular user traffic

  1. #1
    daggy diamonds
    Guest

    Default anybody have a script to redirect mobile traffic AND regular user traffic

    okay so lets say i have 2 offers, one is a mobile offer and the other is a full size page for regular users on their computer

    anybody know of a script that would recognize if the person is on a mobile device and send them to the mobile offer, and if they're on a computer it would send them to the regular full page offer?

    ive been searching around on google and the only thing i've been finding are scripts that just recognize that the user is using a mobile device and sends them to the mobile page of your choice

    i want a script thatll send the users to a regular page/offer if it detects they're not on a mobile device

    i'll send somebody cash munneh if you can tweak one of these simple scripts easily found on google to work this way for me.

  2. #2
    daggy diamonds
    Guest

    Default

    there's a bunch of examples of how it detects if the user is on a mobile device via google, but i need something added to it to send them to another page if they're not on a mobile device

    https://www.google.com/search?sugexp...w=1660&bih=888

  3. #3

    Join Date
    Mar 2010
    Location
    not sure
    Posts
    275

    Default

    <?php
    $iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
    $android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
    $palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
    $berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
    $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");

    if ($iphone || $android || $palmpre || $ipod || $berry == true)
    {
    header('Location: http://mobile.site.com/');
    //OR
    echo "<script>window.location='http://mobile.site.com'</script>";
    }
    else
    {
    header('Location: http://regular.site.com/');
    //OR
    echo "<script>window.location='http://regular.site.com'</script>";
    }
    ?>

  4. #4
    daggy diamonds
    Guest

    Default

    thanks homie

  5. #5
    arpz's Avatar
    Join Date
    Feb 2010
    Location
    England, UK
    Posts
    1,298

    Default

    +rep'd

    ~~jUsT tURnEd ReD mAnDEMz~~

    1DFdpU6nPcMnK8db2SnKPM8HTCXsFThHVz
    i move ecstasy in envelopes, that's what i call e-mail


  6. #6
    Inbox King Moony's Avatar
    Join Date
    Jul 2005
    Posts
    1,796

    Default

    +rep for helping people out. Good to see it still exists on this forum.

  7. #7

    Default

    Quote Originally Posted by Moony View Post
    +rep for helping people out. Good to see it still exists on this forum.
    I was thinking the same thing.

  8. #8

    Join Date
    May 2012
    Location
    Location: Location:
    Posts
    2,114

    Default

    Just an FYI, Google penalizes you for different pages containing duped content (if that matters for your particular usage here). I recommend adding a rel -> nofollow value.

    Alternatively to PHP, you can also do the same in javascript. I use https://github.com/sebarmeli/JS-Redirection-Mobile-Site uploaded elsewhere (for flexibility). In this way you gain portability, a decrease in setup time (same basic template for all of your sites), and lower server / hosting requirements (PHP, or exorbitant numbers of domains on the same host). You do however lose out for those users that don't have JS enabled. Food for thought. The PHP code listed above is very clean, I'm just not privy to your requirements and usage.
    Quote Originally Posted by barack obama View Post
    I'm not as nice as butter

    Quote Originally Posted by Bryce View Post
    it was pythong and I didn't know how to run python on windows

  9. #9
    muffins are tasty's Avatar
    Join Date
    Jan 2009
    Location
    the bank
    Posts
    2,002

    Default

    Quote Originally Posted by deezy128 View Post
    <?php
    $iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
    $android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
    $palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
    $berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
    $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");

    if ($iphone || $android || $palmpre || $ipod || $berry == true)
    {
    header('Location: http://mobile.site.com/');
    //OR
    echo "<script>window.location='http://mobile.site.com'</script>";
    }
    else
    {
    header('Location: http://regular.site.com/');
    //OR
    echo "<script>window.location='http://regular.site.com'</script>";
    }
    ?>
    Your script is bad and you should feel bad.


    Code:
    <?php 
    
    $agent = $_SERVER['HTTP_USER_AGENT'];
    
    $mobileUseragents = array(
                'iPhone',
                'Palm',
                'BlackBerry',
                'Opera Mini',
                'Android',
                'Windows CE',
                'HTC',
                'IEMobile',
                'Phone',
                'Kindle',
                'UP.Browser',
                'MIDP',
                'Symbian',
                'iPod',
                'webOS'
         );
    
    global $mobileUseragents;
    
    foreach($mobileUseragents as $mobileUseragent){
                if(stripos($agent, $mobileUseragent) !== FALSE){
                  $mobile=1;
                }
            }
    
    if($mobile) {
        header("Location: http://mobile-version.com");
    } else {
        header("Location: http://web-version.com");
    }
    
    ?>
    Quote Originally Posted by isoz View Post
    Did muffin said that doctors make more than spammers or was it just me?

  10. #10

    Default

    Quote Originally Posted by muffins are tasty View Post
    Your script is bad and you should feel bad.


    Code:
    <?php 
    
    $agent = $_SERVER['HTTP_USER_AGENT'];
    
    $mobileUseragents = array(
                'iPhone',
                'Palm',
                'BlackBerry',
                'Opera Mini',
                'Android',
                'Windows CE',
                'HTC',
                'IEMobile',
                'Phone',
                'Kindle',
                'UP.Browser',
                'MIDP',
                'Symbian',
                'iPod',
                'webOS'
         );
    
    global $mobileUseragents;
    
    foreach($mobileUseragents as $mobileUseragent){
                if(stripos($agent, $mobileUseragent) !== FALSE){
                  $mobile=1;
                }
            }
    
    if($mobile) {
        header("Location: http://mobile-version.com");
    } else {
        header("Location: http://web-version.com");
    }
    
    ?>
    +rep
    Posting from: Your AP>Attrib /s /d +h +s ME

    All I got is my balls, my words, computer skills & Internet Marketing Black Hat strategies

    WHERE or HAVING clause' injectable
    Quote Originally Posted by pad View Post
    and i'm sure you're smart and creative enough to not have to resort to something so dumb

  11. #11

    Join Date
    Mar 2010
    Location
    not sure
    Posts
    275

    Default

    Quote Originally Posted by muffins are tasty View Post
    Your script is bad and you should feel bad.
    I just grabbed the first one off of google and added the else statement

    +rep cause yes yours is better but you should consider adding the JS alternative since as soon as someone not knowing php grabs yours and leaves some whitespace at the top they are going to be posting that yours dont work due to a header error

    also +reps back to everyone just glad to see something productive here on dg

  12. #12
    lol im band
    Join Date
    Apr 2010
    Posts
    51

    Default

    Deezzzyyy is that dude #trustme

  13. #13

    Join Date
    May 2012
    Location
    Location: Location:
    Posts
    2,114

    Default

    If you intend for 7-10" tablets to also use the mobile offer, you have more to add to either script.
    Quote Originally Posted by barack obama View Post
    I'm not as nice as butter

    Quote Originally Posted by Bryce View Post
    it was pythong and I didn't know how to run python on windows

  14. #14

    Join Date
    Mar 2010
    Location
    not sure
    Posts
    275

    Default

    Quote Originally Posted by ButterOverflow View Post
    If you intend for 7-10" tablets to also use the mobile offer, you have more to add to either script.
    Actually thats what I tested my script with was both of my tablets. They fall in the android UA. Thats where Muffins script is better than mine because it covers the kindle and opera mini so the only one he is missing is the ipad.

  15. #15

    Default

    neither of these codes are working for me.. just goes to a bank page..
    Posting from: Your AP>Attrib /s /d +h +s ME

    All I got is my balls, my words, computer skills & Internet Marketing Black Hat strategies

    WHERE or HAVING clause' injectable
    Quote Originally Posted by pad View Post
    and i'm sure you're smart and creative enough to not have to resort to something so dumb

  16. #16

    Default

    Quote Originally Posted by EXEcuter View Post
    neither of these codes are working for me.. just goes to a bank page..
    oops nvm.. got it
    Posting from: Your AP>Attrib /s /d +h +s ME

    All I got is my balls, my words, computer skills & Internet Marketing Black Hat strategies

    WHERE or HAVING clause' injectable
    Quote Originally Posted by pad View Post
    and i'm sure you're smart and creative enough to not have to resort to something so dumb

  17. #17

    Join Date
    May 2012
    Location
    Location: Location:
    Posts
    2,114

    Default

    Man...
    Bolt
    Firefox Mobile
    iPad
    Blackberry webkit (7.0+)
    Blackberry QNX / PB (Officially will be 10+)
    Quote Originally Posted by barack obama View Post
    I'm not as nice as butter

    Quote Originally Posted by Bryce View Post
    it was pythong and I didn't know how to run python on windows

  18. #18

    Join Date
    Mar 2010
    Location
    not sure
    Posts
    275

    Default

    Quote Originally Posted by ButterOverflow View Post
    Man...
    Bolt
    Firefox Mobile
    iPad
    Blackberry webkit (7.0+)
    Blackberry QNX / PB (Officially will be 10+)

    This is why no one bothers to fucking help on DG, you can you can list a couple of user agents that you found on google but where is your input? A quote from google and something you read about them penalizing you for duplicate content? Good job even though that had absolutely nothing to do with what OP asked, if you had actually read the fucking post you would know that. So I tell you what ... post a script that YOU MADE that covers all the user agents you are trying to bitch about even though you probably don't have a clue whats going on in either script, and before you say it YES, I did get the first one I found on google and made a simple modification , unfortunately for you it seems you can not even manage to do that or instead of copy pasting a couple of user agents you would have just added them to the array on Muffin's script and actually contributed.

  19. #19

    Join Date
    May 2012
    Location
    Location: Location:
    Posts
    2,114

    Default

    Quote Originally Posted by deezy128 View Post
    unfortunately for you it seems you can not even manage to do that or instead of copy pasting a couple of user agents you would have just added them to the array on Muffin's script and actually contributed.
    It's self explanatory. Guess what the user agent for the iPad is? Troll elsewhere, I'm trying to help, often giving extremely solid information. I'm not going to just addon to someone else's script when it's Ctrl-C / Ctrl-V. I don't need Google, as I have had to target those agents for my mobile apps. Thank you for the assumptions though, very cool. Your assumption that Effort =/= talent, is the laughable. I'm not a Tryhard, but if someone dares to learn... "What do you want to know"?
    Quote Originally Posted by barack obama View Post
    I'm not as nice as butter

    Quote Originally Posted by Bryce View Post
    it was pythong and I didn't know how to run python on windows

  20. #20
    daggy diamonds
    Guest

    Default

    Quote Originally Posted by muffins are tasty View Post
    Your script is bad and you should feel bad.


    Code:
    <?php 
    
    $agent = $_SERVER['HTTP_USER_AGENT'];
    
    $mobileUseragents = array(
                'iPhone',
                'Palm',
                'BlackBerry',
                'Opera Mini',
                'Android',
                'Windows CE',
                'HTC',
                'IEMobile',
                'Phone',
                'Kindle',
                'UP.Browser',
                'MIDP',
                'Symbian',
                'iPod',
                'webOS'
         );
    
    global $mobileUseragents;
    
    foreach($mobileUseragents as $mobileUseragent){
                if(stripos($agent, $mobileUseragent) !== FALSE){
                  $mobile=1;
                }
            }
    
    if($mobile) {
        header("Location: http://mobile-version.com");
    } else {
        header("Location: http://web-version.com");
    }
    
    ?>
    thank you

  21. #21

    Default

    big ups to the real DGs doin work

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •