| Author |
Topic Search Topic Options
|
IrishNewbie
Newbie
Joined: 06 November 2003
Status: Offline
Points: 38
|
Post Options
Thanks(0)
Quote Reply
Topic: Login Code Posted: 12 November 2003 at 2:25pm |
Hey,
You know if i want to make a login feature on my site, i need to get the user to enter a ID no and password which are in the DB.
So i set up the connection and what would my query be??
when i say something like, Select Pword From Students Where etc. where does the value of Students.Pword get stored and how can i access it for authenticating the login??
|
 |
MorningZ
Senior Member
Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 November 2003 at 2:28pm |
From this set of tutorials
Comes this section, Security
at some point you are going to have to do some research on your own instead of just leaning on a message board to solve every problem :-/
|
|
Contribute to the working anarchy we fondly call the Internet
|
 |
Diep-Vriezer
Senior Member
Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 November 2003 at 2:37pm |
I agree with MorningZ, but I've made something like this anyway, so here it is
Alright, you'll have to create a connection, a command, and a reader, like this.
Imports System.Data.OleDb
Public Function Login(UserId As String)
Dim DbConnection As New OleDbConnection, DbCommand As New OleDbCommand, DbReader As OleDbDataReader, LoginSucces As Boolean
With DbConnection
'The connection string .ConnectionString = "" 'Open the connection .Open()
End With
'Initialize the database command With DbCommand
.CommandText = "SELECT Pword FROM tblStudent WHERE UserId = '" & UserId & "'"
End With
Try
DbReader = DbCommand.ExecuteReader() While DbReader.Read
LoginSucces = True
End While DbReader.Close
Catch
LoginSucces = False
End Try
DbConnection.Close()
End Function
|
BTW, you're starting to look like mZeb, which is not a compliment. Please try it yourself first, and don't private message AND post a topic.
|
|
Gone..
|
 |
IrishNewbie
Newbie
Joined: 06 November 2003
Status: Offline
Points: 38
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 November 2003 at 2:57pm |
For your information I have tried it myself and cant solve the problem of figuring out away of using the value returned when i search for the pword in the table.
And morning Z ive looked at those tutorials and they gave me some of the ideas im using.
|
 |
Diep-Vriezer
Senior Member
Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 November 2003 at 3:00pm |
|
BTW, it isn't really safe, by just validating on one id without a password.
|
|
Gone..
|
 |
IrishNewbie
Newbie
Joined: 06 November 2003
Status: Offline
Points: 38
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 November 2003 at 3:02pm |
|
what do you mean??
|
 |
Diep-Vriezer
Senior Member
Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 November 2003 at 3:06pm |
What I mean is, when you login, you'll have to find a combination between an user name and a password. That'll be harder then just guessing an user ID, which is probably a logic ID (so all the students have the same kind of id, but are slightly different).
That way it isn't really a 'Login', since you can just guess what kind of ID someone else has, and enter that.
|
|
Gone..
|
 |
IrishNewbie
Newbie
Joined: 06 November 2003
Status: Offline
Points: 38
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 November 2003 at 3:12pm |
|
its my intention to use a Username/Password algorithm not just asking the student for their ID number.
|
 |