473,545 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
+ 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="vbscr ipt">
dim pass,a
pass="rajeev"
Sub button1_Onclick ()
if (Form1.text1.va lue=pass)then
msgbox "Password Correct"
else
msgbox "Password Incorrect"
endif
End Sub

Sub button2_OnClick ()
if (Form1.text2.va lue<>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 1375
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="vbscr ipt">
dim pass,a
pass="rajeev"
Sub button1_Onclick ()
if (Form1.text1.va lue=pass)then
msgbox "Password Correct"
else
msgbox "Password Incorrect"
endif
End Sub

Sub button2_OnClick ()
if (Form1.text2.va lue<>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
3073
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. SO please, if you can, please send me the php.ini file used by most hosts. -- Sharif Tanvir Karim http://www.onlyonxbox.net
2
2632
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 twice and check that they match. Problem is script doesn't valide past username input and I dont know why!! If you don't enter a password it doesn't...
3
3219
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 approach to, once the user clicks the submit button to test the userid and password has been entered, and the text fields are not empty.
11
3689
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 the string "Select name From users Where password = PASSWORD('$testPass')" and ran mysql_query() using the string. But nothing was returned. ...
5
1812
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 have got: def checkEmail(): email = poplib.POP3('mail.mydomain.ext') email.user('user') email.pass_('password')
7
4130
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 project, so the client will automatically check if there is a newer version or not? haim
14
3187
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 === 'crocker') { $_SESSION = true;
2
2094
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 done by a temporary employee who has now handed the database over to me. Not that I think he is an untrustworthy character but I would sleep easier at...
1
1997
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 even tried with echo also how to solve this the message should come under in the same window only see my code it is program ---- <?php //...
0
7479
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7926
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7773
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4962
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3468
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
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 we have to send another system
1
1028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.