Web Login || register example
The kitchen sink dosen't have a login example is there any good examples displaying the best practices to use with titanium ?
Is their a really good forum set up for titanium yet, I have found talktitanium but not many registered user yet.
3 Answers
-
There is a login example called "Basic Auth" in the web_view.js… Well, pretty basic and non secure. The other example is "foursquare.js" using XHR for a BASE64 encoded authorization header. If you are looking for TLS Sockets: agreed, there is no example :)
Hth: Lars
-
Javascript base64_decode Example
var postData = "salman"; //postData += "&password=" + password; var xhr1 = Titanium.Network.createHTTPClient(); xhr1.onreadystatechange=function() { user = (this.responseText); Ti.API.info(Ti.Utils.base64_decode(postData)); Ti.API.info(user); }; xhr1.open("POST","http://localhost:8888/get.php?key="+Ti.Utils.md5HexDigest(postData)); xhr1.send();
PHP Script to receive base64_decode
<?php $user = $_GET['key']; $decode = base64_decode($user); echo $decode; ?>
-
Javascript MD5 Example
var postData = "salman"; //postData += "&password=" + password; var xhr1 = Titanium.Network.createHTTPClient(); xhr1.onreadystatechange=function() { user = (this.responseText); Ti.API.info(Ti.Utils.md5HexDigest(postData)); Ti.API.info(user); }; xhr1.open("POST","http://localhost:8888/get.php?key="+Ti.Utils.md5HexDigest(postData)); xhr1.send();
PHP Script to receive md5
<?php $user = $_GET['key']; $key = ($user); echo $key; ?>