mekelle
Posts: 1
|
Posted: 03/17/2009, 11:00 PM |
|
i have the following table:
logintable:
type, username, password, email
the type column has only two values , either "admin" or "user", username and email are unique.
i have a login page that asks username and password so as to login. here is the pretty code:
con = New SqlConnection("server=(local); Data Source=gig;Initial Catalog=dbvacancylist;User ID=sa;Password=test")
str = " select type, username,password from usersinfo"
cmdadapter = New SqlDataAdapter(str, con)
ds = New DataSet cmdadapter.Fill(ds, "usersinfo")
Try con.Open()
For Each dr In ds.Tables(0).Rows
If ((dr(0) = usernametxt.Text And dr(1) = passwordtxt.Text) Then
Session("userloggedin") = usernametxt.Text
Response.Redirect("addvacancy.aspx", False)
temp = True
Else
lbllogin.Text = " Sorry... try again,invalid username or password"
lbllogin.Font.Bold = True
lbllogin.ForeColor = Drawing.Color.Red
End If
Next
Catch ex As Exception
con.Close()
End Try
the above code works fine, for both user and admin clients, but now i want to make it, if any one with type column is "user" and have correct username and password-- then redirects to userpage.aspx,
if any one with type column is "admin" and have correct username and password.. then redirects to adminpage.aspx, else error...
can u do that? off course you can, let me know it so, thanks
|