PHP AJAX login, is this method secure?

2019-06-25 11:44发布

问题:

I have just started PHP and MySQL and have created a login form and all works well! Now I am looking to add ajax and the first method I considered is using the jQuery $.post method. I am okay with the code and here is a quick idea of what I will be doing:

function login(){
    $.post('login.php', {
      username:form.username.value,
      password:form.password.value
    })
}

All I need to know is, is this secure and if not what method should I consider?

回答1:

It's as secure as any other method of form submission would be to the same URL.



回答2:

It is never secure to send passwords in plain text. But if this is for a simple application then it would be fine. But if this was for something like a banking application you would need to use a more secure transmission protocol such as SSL.