Solved

Writing code for password and Log on verification

Posted on 2002-03-06
13
374 Views
Last Modified: 2012-06-21
I would like to create code for password and username for system users to log on to the system.This code has to verify and see if the type password or username is in the already created list on the database table for log on.It should check and see if the typed password corresponds to the one on the list else  it displays an error message.
0
Comment
Question by:humbk2002
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +5
13 Comments
 

Author Comment

by:humbk2002
ID: 6843690
Please this code should be in visual basic for applications  for a standalone computer.
0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 6843694
Hi,

What Database are you using?

* And please do to rise some points as 50 pts = easy question :)
0
 
LVL 3

Accepted Solution

by:
Rem earned 6 total points
ID: 6843763
Hi,

While agreeing with ryancys, some code to start with:
You have a form with to fields, username(txtUser) and password(txtMdp), and a button to validate the input.
Private Sub btnValider_Click()
On Error GoTo errhandl

      Dim rstUsers As New ADODB.Recordset
      Dim strSQLUsers As String
      Set rstUsers = Nothing
   
        strSQLUsers = "SELECT * FROM tblUsers WHERE Users = '" & txtUser & "'"
        rstUsers.Open strSQLUsers, cn, adOpenDynamic, adLockOptimistic, adCmdTableDirect
        If rstUsers!mdp = txtMdp Or rstUsers!users = "sa" Then
            usernom = txtUser
            btnStart.Visible = True
            If rstUsers!Edit = False Then
                Dim retmsg
                retmsg = MsgBox("You don't have the right to save records. Contact a sysadmin.", vbInformation, "Attention")
                'code to insert
            End If
        Else
            MsgBox "Who are you...?"
        End If
    Exit Sub
errhandl:
MsgBox "Try another name, one the system recognizes..."
End Sub

ANYWAY, you got to be connected to the database first: so OnLoad of your frmLogin you use the function below.

Public Function Connect()

    On Error GoTo errfind
    Set cn = New ADODB.Connection
    With cn
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=disk:\directory\yourdatabase.mdb"


        .Open
    End With

end function

This is pretty basic stuff. Normally you should encrypt the password and decrypt it on the fly so it won't stay clear in the database.

I could send you code for that for two more points ;-))

Bye

Rem
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:humbk2002
ID: 6843861
We use access for windows 2000 as the database
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 6843959
do you really expect to get a useful answer for ONLY 4 points?  You MUST be kidding.
0
 

Author Comment

by:humbk2002
ID: 6843990
I want a single block of code not separate procedure and a function.You saying I should encrypt the password and decrypt it on the fly so it wont stay clear in the database,you know i use vb 6.0 for application so if you use a text box ,then go to its properties then you have access to enter a password character,thus it can be encrypted.I want a code that contains the loading of the database at the same time with creating verification of passwords.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 6844072
What was meant by "encrypt and de-crypt" is the you DO NOT want to have the Password, as stored in the DATABASE, to be readable - by simply opening the database table.  When you add a PasswordCharacter to a Text box, the password IS NOT encrypted, but rather for each character in the password, as it is entered by the user on that form the entered character is simply replaced, ON THE SCREEN, with the password character.  The value of the TextBox.Text property IS STILL THE PASSWORD, as entered by the user.

If you do not encrypt the password, as stored in the database table itself, then anyone can open the User table and view the Passwords for every user in the system.  That is a MAJOR SECURITY hole.  Not even the System Manager should know what a User's passwrod is.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 6844073
and 6 points is RIDICULOUSLY low.  Be Serious.
0
 
LVL 8

Expert Comment

by:vettranger
ID: 6844366
This looks like yet another case of "Please do my homework for me".
0
 
LVL 3

Expert Comment

by:Rem
ID: 6846852
Humbk2002 seems to be new around here. Suppose he didn't have the time to read the guidelines.

btw Just a remark.
Never put all your code in one block, keep procedures, subs and other functions separated. Creating a public function allows to reuse a block of code instead of having to rewrite it.

Bye

Rem
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7017035
10 open questions, many are far below the minimum for easy questions of 50 points.  The maximum per question is 500 points.  ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101, Netminder or Mindphaser will return to finalize these if they are still open in 7 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20283897.html
http://www.experts-exchange.com/questions/Q.20273817.html
http://www.experts-exchange.com/questions/Q.20274315.html
http://www.experts-exchange.com/questions/Q.20275778.html
http://www.experts-exchange.com/questions/Q.20277334.html
http://www.experts-exchange.com/questions/Q.20278207.html
http://www.experts-exchange.com/questions/Q.20281536.html
http://www.experts-exchange.com/questions/Q.20284857.html
http://www.experts-exchange.com/questions/Q.20285984.html
http://www.experts-exchange.com/questions/Q.20287484.html



*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643 
POINTS FOR EXPERTS awaiting comments are listed in the link below
http://www.experts-exchange.com/commspt/Q.20277028.html
 
Moderators will finalize this question if in @7 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thanks everyone.
Moondancer
Moderator @ Experts Exchange
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7610468
humbk2002, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Accept Rem's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:modulo
ID: 7657276
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA/SQL - Connect to SQL server and pull data 4 150
Add a task in Outlook from access 11 43
Visual Studio 2005 text editor 10 54
Excel Automation VBA 19 115
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question