0

hello,
i'm very dull at js, so i hope you guys can help me.
ok, i have create a prompt box that will ask user to enter a password, and this prompt box will take user to secured page.

<script type="text/javascript">
function show_prompt()
{
var name=prompt("Please enter your password","Fill Here");
if (name!=null && name!="")
  {
  location.href="index.php";
  
  }
}


</script>

so, how to create a variable that can take password from mysql using js?

if (password=="password in database")<< how to call password from database?
{
   location.href="index.php";
}

i hope you guys can help me. appreciate it so much.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by McLaren
0

You can use AJAX technology for checking password, but if js says it is correct, don't forget to check it with PHP (server side), we cannot trust javascript.

Easiest way to get data for me is use http://api.jquery.com/jQuery.post/

You could send the password to the PHP, PHP checks the database and if correct then echoes secret content.

Edited by McLaren: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.