Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7081581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:56:19+00:00 2026-05-28T06:56:19+00:00

I have a mobile script from detectmobilebrowsers.com that will redirect the user to my

  • 0

I have a mobile script from detectmobilebrowsers.com that will redirect the user to my mobile site however I also wish that when the URL “http://example.com/?mobile=no” is entered a session will be created that won’t redirect the user on every page of my site…

$mobile=$_GET['mobile'];

if(isset($_SESSION['mobile'])){
    if($_SESSION['mobile']==="no"){
        complete();
    }
    else{
        $_SESSION['mobile']="no";
        complete();
    }
}
elseif($mobile==="no"){
    $_SESSION['mobile']="no";
    complete();
}
elseif($_SESSION['mobile']!="no"){
    checkMobile();
}
function checkMobile(){
    // Mobile Detection Code taken out to save space.
    gotoMobile();
}
function gotoMobile(){
    echo "<script>window.location='http://m.MySite.org/';</script>";
}
function complete(){
    return false;
}

Sorry if I seem confusing but in short terms: Mobile Detection (which is set)… make session mobile=no if user does wishes to view full site and when that session is created it is checked on everypage (same php script) and if I set my session for no mobile I want that to stay on everypage… In my case the only thing that happens is the first page is not redirected but when I go to another page it won’t display it unless I add the ?mobile=no but the whole point of the sessions here is so this only needs to be done once.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:56:19+00:00Added an answer on May 28, 2026 at 6:56 am

    Before you can begin storing user information in your PHP session, you must first start the session:

    session_start();
    

    There must be no markup ouputted before session_start(), not even whitespace! (unless output buffering is used).

    See http://php.net/manual/en/function.session-start.php.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mobile site and I'd like to redirect users to the domain.mobi
Has anyone ran into this issue? We have a mobile site that can't use
While I have a successful method of getting users from our mobile site to
I have a script that pulls an image from SQL Server and displays it
i have to check in my script for user agent for mobile. i have
I have a script that detects whether you're an iPhone user or not and
I'm currently using the excellent mobile detection script from: detectmobilebrowsers.mobi This works really well
I have a POSH script that sets a user's access to a specific folder
I have a script that grabs data from a MySQL database table and creates
I have a mobile platform that I am trying to write some communications code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.