Secure mobile only php/html page via client phone#

1 view
Skip to first unread message

Swodahs via StackOverflow

unread,
Jan 7, 2014, 11:32:13 PM1/7/14
to google-appengin...@googlegroups.com

I was asked the following question by a friend to which I believe the answer will be "no way to do it", but it's possible its just beyond my expertise to accomplish or find a working answer:

If someone wanted to make a web page(s) specifically for mobile devices (smart phones only), is it possible through PHP or other Server Side Language to control the privileges & page(s) access by somehow querying the devices cell phone# or IMEI number or any other ID# that can be queried which is (generally) hard coded to the device?

In the absence of a server side option, what minimum components (App, SSL Certificate, magic token, gift from god....) could be installed with user permission that could control access and permissions granted to a smart phone user visiting the secured page?

(Before finishing the question I called my buddy and asked him to explain in more detail what he is thinking: - He wants to sell a service being sold in the field by sales staff where sales people in the field access a sign up page via smart phones only. Instead of using a user name password system he wants to have the server maintain a list of approved cellular numbers (the employee numbers) that is queried and compared on each visit to web page(s) by mobile devices. Thus if a sales agent is let go or quits the approved cellular number is deleted and thus they no longer have access. Also eliminates need to remember/maintain user name/passwords in his view)

any ideas?



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/20987077/secure-mobile-only-php-html-page-via-client-phone

Brian H. via StackOverflow

unread,
Jan 7, 2014, 11:42:13 PM1/7/14
to google-appengin...@googlegroups.com

You can do that, but not with a simple, browser-based web app. You will need to wrap the web app with some native code and use something like PhoneGap to bridge between the two.

http://phonegap.com



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/20987077/secure-mobile-only-php-html-page-via-client-phone/20987155#20987155

Pjack via StackOverflow

unread,
Jan 8, 2014, 12:32:13 AM1/8/14
to google-appengin...@googlegroups.com

I would use a mobile detection script to do it. It's going to be a bit difficult otherwise. This is the PHP script I use for detection and it works quite well. I've been using it for a couple of years now. Here is sample code showing how you can use it. It should do what you want by limiting it to mobile devices/smart phones. So for example you can allow access if it detects mobile or show an access denied page if not on mobile. Easy to implement this.

http://mobiledetect.net/

// Include and instantiate the class.
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;

// Any mobile device (phones or tablets).
if ( $detect->isMobile() ) {

}

// Any tablet device.
if( $detect->isTablet() ){

}

// Exclude tablets.
if( $detect->isMobile() && !$detect->isTablet() ){

}

// Check for a specific platform with the help of the magic methods:
if( $detect->isiOS() ){

}

if( $detect->isAndroidOS() ){

}

// Alternative method is() for checking specific properties.
// WARNING: this method is in BETA, some keyword properties will change in the future.
$detect->is('Chrome')
$detect->is('iOS')
$detect->is('UC Browser')
// [...]

// Batch mode using setUserAgent():
$userAgents = array(
'Mozilla/5.0 (Linux; Android 4.0.4; Desire HD Build/IMM76D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19',
'BlackBerry7100i/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/103',
// [...]
);
foreach($userAgents as $userAgent){

  $detect->setUserAgent($userAgent);
  $isMobile = $detect->isMobile();
  $isTablet = $detect->isTablet();
  // Use the force however you want.

}

// Get the version() of components.
// WARNING: this method is in BETA, some keyword properties will change in the future.
$detect->version('iPad'); // 4.3 (float)
$detect->version('iPhone') // 3.1 (float)
$detect->version('Android'); // 2.1 (float)
$detect->version('Opera Mini'); // 5.0 (float)
// [...]


Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/20987077/secure-mobile-only-php-html-page-via-client-phone/20987698#20987698
Reply all
Reply to author
Forward
0 new messages