hi all,
i wanted to check whether the password entered matches with the confirm password.either through javascript or through php.i have enclosed my code somebody help on this -
<html>
-
-
<?include 'menu.php'?>
-
<head>
-
<script type="text/javascript">
-
function checkform()
-
{
-
var cfname,cstatus,cuname,cpwd,cconfirmpwd;
-
with(window.document.createuserform)
-
{
-
-
cfname=fname;
-
cstatus=status;
-
cuname=uname;
-
cpwd=pwd;
-
cconfirmpwd=confirmpwd;
-
-
}
-
-
-
if(trim(cfname.value)=="")
-
{
-
alert("please enter the first name");
-
cfname.focus();
-
return false;
-
}
-
-
else if(trim(cstatus.value)=="")
-
{
-
alert("please enter the status");
-
cstatus.focus();
-
return false;
-
}
-
-
else if(trim(cuname.value)=="")
-
{
-
alert("please enter the user name");
-
cuname.focus();
-
return false;
-
}
-
-
else if(trim(cpwd.value)=="")
-
{
-
alert("please enter the password");
-
cpwd.focus();
-
return false;
-
}
-
-
else if(trim(cconfirmpwd.value)=="")
-
{
-
alert("confirm the password");
-
cconfirmpwd.focus();
-
return false;
-
}
-
-
-
else
-
{
-
-
cfname.value=trim(cfname.value);
-
cstatus.value=trim(cstatus.value);
-
cuname.value=trim(cuname.value);
-
cpwd.value=trim(cpwd.value);
-
cconfirmpwd.value=trim(cconfirmpwd.value);
-
-
-
}
-
-
-
function trim(str)
-
{
-
-
return str.replace(/^\s+|\s+$/g,'');
-
-
}
-
-
-
-
}
-
-
-
-
</script>
-
-
5 41811
It is normal practice to store user log-in details in a database.
Where at least the password is encrypted.
But this is not much use with Javascript.
Are you asking how to do this in php?
You will need some understanding of php to attempt this.
hi code green
yes tell me with php itself.
if it is easy to do it from client side(validation) tell me in javascript.i have enclosed my database coding that is the insertion of fields of the user(insertuser.php).the previous code was the form where the user registers himself(createuser.php).kindly check out and resolve in this very simple manner as i m a beginner for php.and the username should not be repeated. -
-
<?php
-
include 'menu.php';
-
include 'connect.php';
-
?>
-
<table border="0" cellpadding="0" cellspacing="0">
-
-
<tr>
-
<td>
-
<table border="0" cellpadding="0" cellspacing="0">
-
<tr>
-
<td style="padding-left:20px;padding-bottom:20px;"><a href="createuser.php" style="text-decoration:none"><input type="button" name="new" value="CREATE USER" style="width:170px;background-image:url(pink.gif)"></a></td>
-
</tr>
-
-
<tr>
-
<td style="padding-left:20px;padding-bottom:20px;"><a href="users.php" style="text-decoration:none"><input type="button" name="new" value="USERS" style="width:170px;background-image:url(pink.gif)"></a></td>
-
</tr>
-
-
<tr>
-
<td style="padding-left:20px;"><a href="reassignrecords.php" style="text-decoration:none"> <input type="button" name="new" value="REASSIGN RECORDS" style="width:170px;background-image:url(pink.gif)"></a></td>
-
</tr>
-
-
-
</table>
-
<br/>
-
<br/>
-
-
<?
-
-
-
-
/*
-
$sql="create table createuser
-
(
-
uid int(4) ,
-
fname varchar(20),
-
lname varchar(20),
-
status varchar(20),
-
uname varchar(20) primary key,
-
pwd varchar(20),
-
confirmpwd varchar(20),
-
title varchar(20),
-
dept varchar(20),
-
phone bigint,
-
address varchar(20),
-
city varchar(20),
-
pin bigint
-
-
-
)";
-
-
if(mysql_query($sql,$con))
-
{
-
echo "table created";
-
}
-
-
if(!sql)
-
{
-
die(' table already exists'.mysql_error());
-
}
-
*/
-
$ins="insert into createuser(uid,fname,lname,status,uname,pwd,confirmpwd,title,dept,phone,address,city,pin)values('$_POST[uid]','$_POST[fname]','$_POST[lname]','$_POST[status]','$_POST[uname]','$_POST[pwd]','$_POST[confirmpwd]','$_POST[title]','$_POST[dept]','$_POST[phone]','$_POST[address]','$_POST[city]','$_POST[pin]')";
-
$res=mysql_query($ins);
-
-
/*if(!$res)
-
{
-
mysql_error();
-
}
-
*/
-
-
-
if((!$res)&&(mysql_errno()==1062))
-
{
-
-
-
print' <b>.<font color="red" size="5">."Try another user name.This User Name already exists !!!".</font>.</b>';?>
-
<a href="createuser.php"> BACK </a>
-
<?php
-
// echo mysql_error();
-
-
}
-
else
-
{
-
-
echo '<h1>'. 'A new user is created successfully'.'</h1>';
-
-
-
}
-
-
-
?>
-
-
-
-
-
-
-
I can't write your code for you.
But the general idea is to collect all user log in details from a HTML form.
Then query the database to find a matching username and password.
If the query returns a record then the login is successful.
Otherwise report a problem to the user.
This is pretty basic SQL/PHP but cannot be done in Javascript.
Atli 5,058
Expert 4TB
If I'm understanding the OP correctly, he is looking for a way to match the password and the confirmation password, not to actually log the user in.
Am I right?
If so, all you would have to do is add a extra else if statement to your existing if statements in the JavaScript you posted, to match the "cconfirmpwd" variable to the "cpwd" variable, and return false if they don't match.
And to compare the values, it's as simple as -
if ( $val1 === $val2 )
-
{
-
// They match.
-
}
-
else
-
{
-
// The don't.
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bright |
last post by:
Dear All
I'm after a multi-User password database so that I can centrally store
system passwords and give granular access to individuals based on
their own unique authentication (possibly a...
|
by: rodchar |
last post by:
hey all,
in my page load i'm attaching a javascript confirm message to my save
button. my problem is i have some client side validation which uses a Custom
Validator web control and when i make...
|
by: Nerrad |
last post by:
Hi, i am currently working on a project which requires me to create a
form to allow the user to change their password.
I know there is a user-level security login which is easier and safer
but...
|
by: znadeem |
last post by:
Hi, I am new to JavaScript and I am trying to control New Password fields. These fields are not allowed to except any symbols, especially @ / \. The current code I've is not working at all. Could...
|
by: Head In A Pan |
last post by:
Hello again... so soon too.
I had great success (nor a novice) yesterday getting my flash form & PHP to populate my database...
Now I've been asked to generate a password & then send a...
|
by: =?ISO-8859-1?Q?Andr=E9?= Wyrwa |
last post by:
Hei,
I know this kind of stuff has probably been asked a couple of times
already, and did quite a bit of googling about it, but the answers i
found were either unsatisfying or not specific...
|
by: =?Utf-8?B?UmFq?= |
last post by:
In Create User Wizard, if password and confirm passowrd does not match....we
get an error msg, once you set the confirm password right and without moving
cursor out of the confirm password box...
|
by: ammoos |
last post by:
Hi Friends
I have to install the SQL Server 2005 Express in my machine using the install shield. So I need a command line option to set the password as ‘password’. I tried to specify the password...
|
by: raj200809 |
last post by:
Hi,
I m trying update password in database using asp.net with c#.
I have three text box in my aspx page
Old password
New password
confirm password
i m using following code but its not...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |