Tuesday, November 25, 2014

Check the username and password while User Login in Phonegap

I am working in phonegap application. we have allow only authenticate user. when user login in my application. I want to check the username and password in sqlite database using jquery.
I have created a login page with username and password and if I click the login button it should check if the entered username and password matches with the database(websql) and if it is successfull should go to the next page
Is this correct or should I use some additional methods or steps
If this is not correct may I have a coding to authenticate username and password in sqlite using Jquery/Javascript
var x="SELECT * FROM login WHERE username='"+user+"' AND password='"+pwd+"' ";    
tx.executeSql(x,[],function(tx,result){
          if (result.rows.length > 0){

            alert("Username : " +  result.rows[0].username);
            alert("Password: " + result.rows[0].password); 
          }else{
            alert("User not found!");
          }
    });

No comments:

Post a Comment