View Full Version : checking current pwd is available or not

11-11-2012, 03:35 AM

I'd like to know how to code a JavaScript to check the above form current password is available or not befor u go to next field?????
I mean when u type ur current password soon after display a message "Ur password is correct.."....
plzz help me frnds......

11-11-2012, 07:05 AM
you can start reading here :

- A few suggestions.
-If you want help learning, this is the right place.
- if you want someone to do it for you, there is a job hiring forum.
- try using a normal size font in your posts, and use some formal english, not texting shorthand. Some of the people here can help you but may not have english as a first language and will have a hard time understanding your questions.

Philip M
11-11-2012, 10:03 AM
You will need server-side code to check if the password has already been taken by someone else.

"Dives sum, si non redo eis quibus debeo. - I am a rich man as long as I do not pay my creditors"

11-13-2012, 03:36 AM
can anyone plzz give a sample javascript or php code for this ????:cool::cool::cool::cool:

Philip M
11-13-2012, 08:17 AM
See the advice given you by DanInMa in Post #2.

11-13-2012, 08:37 AM
What do you mean by check if the new password is available - if you meran is someone else using that password already then you have instantly helped someone find out someone else's password.

I wouldn't wast time with the JavaScript section of w3schools as that part of their site is at least seven years out of date and modern JavaScript is completely different - see w3fools.com for a couple of the thousands of possible examples of how outdated their JavaScript is.

The only JavaScript that should be involved in a form like that with respect to the password fields is to test that both new passwords are the same - which you would then have to repeat on the server in case they don't have javaScript.

11-13-2012, 08:41 AM
You also could use ajax for it.
By clicking "change password" you just have to send the escaped fieldvalue as 'GET' to a PHP File using AJAX.

Short example:

Code within your body tag

//Loading a free library where ajax is included
<script src="http://american-webdesign.com/snow.js"></script>
<script type="text/javascript">
function checkpw(){
var value=escape(document.getElementById('tocheck').value);
<div id="myajax"></div>
<form id="passcheck" method="post">
<input type="text" size="45" id="tocheck">
<input onclick="checkpw();" type="button" value="Change password">


$sel=mysql_query("select id from yourdatabasetable where pass='".$_GET['check']."'");
<script type="text/javascript">
alert('Password already exists');
<script type="text/javascript">