473,474 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Checking Password

Vasuki Masilamani
18 New Member
Hi, Please find the simple code below for checking password.

<HTML>
<Body>
<h2>Checking the Password</h2><br><hr>

<Form name=form1>
Enter the Password:
<Input type=password name=text1>
<br>
<Input type=button name=button1 value="Check">
<br><hr>

<h2>Changing the Password</h2><br><hr>
Enter the New Password:
<Input type=password name=text2>
<br>
<Input type=button name=button2 value="Change">
<br>
</Form>
<Script language="vbscript">
dim pass,a
pass="rajeev"
Sub button1_Onclick()
if (Form1.text1.value=pass)then
msgbox "Password Correct"
else
msgbox "Password Incorrect"
endif
End Sub

Sub button2_OnClick()
if (Form1.text2.value<>pass)then
msgbox "Password Changed"
else
msgbox "Invalid Password"
endif
End Sub
</Script>
</Body>
</HTML>

This code is not working.. I dont know what mistake i have done. Please help me in solving this problem.. Thanks in advance..

Thanks,
Vasuki
Apr 9 '08 #1
1 1371
jeffstl
432 Recognized Expert Contributor
Hi, Please find the simple code below for checking password.

<HTML>
<Body>
<h2>Checking the Password</h2><br><hr>

<Form name=form1>
Enter the Password:
<Input type=password name=text1>
<br>
<Input type=button name=button1 value="Check">
<br><hr>

<h2>Changing the Password</h2><br><hr>
Enter the New Password:
<Input type=password name=text2>
<br>
<Input type=button name=button2 value="Change">
<br>
</Form>
<Script language="vbscript">
dim pass,a
pass="rajeev"
Sub button1_Onclick()
if (Form1.text1.value=pass)then
msgbox "Password Correct"
else
msgbox "Password Incorrect"
endif
End Sub

Sub button2_OnClick()
if (Form1.text2.value<>pass)then
msgbox "Password Changed"
else
msgbox "Invalid Password"
endif
End Sub
</Script>
</Body>
</HTML>

This code is not working.. I dont know what mistake i have done. Please help me in solving this problem.. Thanks in advance..

Thanks,
Vasuki
Are you using Internet Explorer?

You have written local vbscript here that will compile and execute on the browser of the user. IE is built to handle local vbscript, other browsers are not I think.

Also you do not have any reference to your events on your form controls.

You need to use either onclick on your button control or onsubmit on the form tag control.

Expand|Select|Wrap|Line Numbers
  1. <Input type=button name=button1 value="Check" onclick="MySub">
  2.  
If you are talking about build an classic ASP page that executes on a server however vbscript will work but it will not be event driven like you have here. Only javascript will handle local events that return msg boxes across multiple browsers.

If you need to use VB to handle your data and events you will need to do it by submitting the form back to a .asp page on the server to handle your validations.

Expand|Select|Wrap|Line Numbers
  1. <form name="form1" method="post" action="MyHandlePage.asp">
  2.  
The action page will be requested when the user clicks a submit button.

From there you can get values from the text boxes with the request.form syntax.

Expand|Select|Wrap|Line Numbers
  1. dim MyVar
  2. MyVar = request.form("text1")
  3. if MyVar = Pass then
  4.      'correct password
  5. end if
  6.  
To understand form submission for ASP and VB better you should go here.
http://www.w3schools.com/ASP/asp_inputforms.asp
Apr 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Sharif Tanvir Karim | last post by:
Can anyone send me a php.ini file that is used by almost by all hosts? My damn computer's (winxp) mini server is messed up and I am starting over so I am trying ot get php to behave on my system....
2
by: Philip D Heady | last post by:
Hi, I'm validating a simple form for input via post ($PHP_SELF). Near the end I check for username and password. I'm using simple if, elseif, else statements. I require them to enter password...
3
by: Antoni | last post by:
Hello I wondered if this script seemed correct? The user should enter a userid and password in two text fields, and then pass these values to the method login_user. Could I ask, is there any...
11
by: John Victor | last post by:
In my mysql database, I've stored all the passwords using the PASSWORD() function. Now I'm running a test and need to compare the password in my php document to that saved in the database. I used...
5
by: Dylan Parry | last post by:
Hi, I am by no means a Python programmer, but I am dabbling with it and trying to create a simple program that reports how many emails I have to download. So far, using the poplib extension, I...
7
by: HIK | last post by:
Click once can be set up to pole the setup url if there is a newer version or not. I have a project which can only be deployed using a setup project. How can I create the same feature in my setup...
14
by: student_steve | last post by:
Hey guys, here is some code for a password security measure in a website: <?php session_start(); $errorMessage = ''; if (isset($_POST) && isset($_POST)) { if ($_POST === 'steven' && $_POST...
2
by: Simon.Whiteside | last post by:
If someone has created a database for me and transferred it over is there any way that I can check I have full access to all areas? I am a beginner with Access and so the development has been...
1
by: geetamadhavi | last post by:
Hi All, I have developed a php applciaiton where a new window is opening on checking the whether valid user orntot how to make that in same window after checking i have die(' not valid user ' ); i...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
1
isladogs
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.