Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 4    Views: 59

pazjordi
Code is Art
Profile
Posts: 9
Reg: Mar 09, 2013
Barcelona
890
03/10/13 03:02 PM (12 years ago)

Choose screen depending the php script result.

I am trying to make an app that ask for a login email and password, and depending which user enters show a diferent screen...is possible in any way switch the result of an php script into one screen or another? Thanks
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
03/10/13 04:09 PM (12 years ago)
How are you connecting the login to php?
 
denikov
Lost but trying
Profile
Posts: 46
Reg: Dec 26, 2011
Reno Nevada
10,360
like
03/10/13 04:09 PM (12 years ago)
You can user the custom URLs and load whichever URL you want based on your PHP script. So if a user in your database has permission for a certain screen, use and if statement and redirect "Location: <a href="http://www.someurl.com"" target="_blank" rel="nofollow">http://www.someurl.com/whateverPageYouWant"</a>. I know that's how it works with PHP scripts in a browser...I think that's how it would work within an app. This is just a suggestion...I have not tried redirecting to another page via PHP script. Wait for a more professional answer :) Or just load whatever data your user is qualified for in the second screen...
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/10/13 06:29 PM (12 years ago)
It's not difficult at all... once you wrap your head around the procedures needed... Your login screen, upon 'completion' will use a dataURL to go to your server and call on a php script. Let's call it 'login.php'. In login.php, you'll need to grab the data from the URL String Once you get their data, you'll need to figure out who they are, what they have access to, what screen you want to direct them to, things like that. When you've done that logic (via PHP/MySQL, or whatever your favorite process is), you'll return the data back to the device, calling on the screen they qualify for. You'll send the data back to the device as formatted JSON data, just like anything else in the app. Basically for all intents and purposes, you're using your device as a specialized browser, using BT menus and screens rather than a browser. The device ("BT" browser) queries the server (your php) and your server provides data back to the device (in Json rather than HTML format). It's really not 'that' different, but sometimes it takes folks a bit to catch on. I have 'loadScreenObject' samples in my BT Google Drive. Check it out. If you have questions, I'm happy to help. But ask them here on the forum, so others can benefit from the info. https://docs.google.com/folder/d/0B4dNcn_wVRnsQ1o4Q3BOV2dETWc/edit?usp=sharing Cheers! -- Smug
 
pazjordi
Code is Art
Profile
Posts: 9
Reg: Mar 09, 2013
Barcelona
890
like
03/11/13 03:41 AM (12 years ago)
Thank you for your replays...I am a very beginner with BT and I am not sure to understand that concept... My first screen of the app should be a Custom_URL screen to my php script (login.php) where I will ask for the email&assword of the user..I think I undersatnd the idea of modify the JSON of the screen with the Screen Data URL for modifuing dinamically the screen but there is no Screen Data URL field in the Custom_URL plugin to do it...What JSON should I return in my login.php? I think I am a bit lost... Thanks
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.