Results 1 to 4 of 4
- 07-11-2012, 02:48 AM
Thread Author #1
[HTML5] Build my first app, some questions
Hello CrackBerry,
For fews years i'm thinking about building a BlackBerry app.
The reason is because (here in Holland) we use BlackBerry a lot (teenagers)
I want to start building my first app, my idea's are here.
The only problem is how I can do it.
I am a PHP user, MySQL database, and try to avoid javascript as much as possible.
For my new app i need some clearance, what i can do in the app and what i should do remote.
As far as I am thinking:
- Login: how can i write that a user has been logged in (dont logout until the person does), in php you can use cookies and sessions.
Something basic liks if(isset($_SESSION['something'])) can tell you a user has been logged in or not.
Because i cannot use php on the phone, i need to fix it in html/javascript?
Like, post a page direct when you open the app (at the loading screen) that posts lets say:
http://www.mydomain.com/myapp/myvers...er&pass=mypass
When i got a 1 back, it will display the rest of the app.
When i got 0 back, it will display login and register buttons.
Based on this its easy.
But how can i start doing it, and what parts of the app can i do remote and what parts of the app should i do remote?
As far as i tought, open pages like a profile remote, upload, post, update can be in the app i guess?
Anyone has some ideas how to start with this?Hi =) - 07-11-2012, 05:49 AM #2
If you want to use WebWorks, you'll want to invest pretty heavily in javascript. I'd stay away from overweight libraries like jquery or underscore as they come with a pretty big performance cost, do very little to actually speed along your development, and just get in the way while you're trying to learn.
Javascript is pretty painless to learn and use you figure out what to avoid. Even working with the DOM isn't as difficult as everyone makes it sound. To be honest, I don't know how it got such a bad reputation; it's pretty simple stuff. I don't expect that you'll have much trouble with it.
On the DB side, check out the HTML 5 Database documentation in the API reference. That'll get you a local database.
Ideally, you'll want to do as little remote as you possibly can. (Rule of thumb: If you can do it locally, do it locally.) Without knowing more about what kind of app you want to create, I can't really offer anything more specific than that.
If you're out to avoid javascript and plan on doing most of the work on a server, I can't see why you'd bother with an app over just a mobile-friendly website. If it's really important that you have an app, there's a tutorial somewhere on the site that shows you how to package an app that's basically just a portal to a website. People really hate junk apps like that though. - 07-11-2012, 06:22 AM
Thread Author #3
Hi, im building something like a community app for dutch people.
So there is a lot of remote data going on.
Because every thing need to be stored in a remote database so every client can access it all the time.
Thanks for the tipHi =) - 09-02-2012, 03:45 PM #4
I believe you are after somethign like this:
In your php you would run your checks against your MYSQL and then print the result to the browser. 'payload' is the result your php is printing out. So success is in this example what the php printed upon a successful login. YOu could then in your MYSQL track the login, and thus prevent anyone from logging in using that account from a computer. You would need to create a logout function to remove the tracking if you are approaching it with this manner.Code:var xmlhttp = new XMLHttpRequest(); //Recieve response from server function xmlhttp.onreadystatechange = function () { //Verify Response from Server was OK if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { var payload=xmlhttp.responseText; //Check result for successful login if(payload === "success"){ alert("Login Successful"); }else{ //failure alert("Login Failed"); } } }; xmlhttp.open("GET", "http://www.MYWEBSITE.com/SomeScript.php?user=" + uid + "&password=" + password, true); xmlhttp.send();
You can also POST data to your php file aswell. Using POST will allow you to send more data.
If you are trying to request more details from your server you can always print out a JSON string and parse that with javascript to get all your data.Code:var params="user=" + uid + "&password=" + password; sendData.open("POST", "http://www.WEBSITE.com/SCRIPT.php", true); sendData.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); sendData.setRequestHeader("Content-length", params.length); sendData.send(params);
Hope this helps a little bit.
Good Luck
Note: I wrote the javascript inside the reply box and have not tested it. However it should be fine. If it isn't reply back and I'll sort it.
Reply















