So I have a log in page and three users all the three users have a primary ID - name, email, username, password and all the data is already entered for this.
- Patient - folder pages - Information.aspx ordermed.aspx
- Doctor - folder pages - Patientinfo.aspx Patientsorders.aspx
- Pharmacy - folder pages -Pharmacyinfo.aspx prescriptionorders.aspx
The patient orders from a range of their medications on the link table (patient ID and Med ID)
the order gets sent through to the doctor who approves or disapproves
and the pharmacy can see the approved orders from the order table.
What I want to do is only allow the doctor/patient/pharmacy to access their pages with corresponding information
I have set a session variable the provides a change to a label that says approved when an approved user logs in:
Imports System.Data.SqlClient
Imports System.Data
Partial Class Pages_Login
Inherits System.Web.UI.Page
Protected Sub btnlogin_Click(sender As Object, e As EventArgs) Handles btnlogin.Click
Dim patientNo As String
Dim password As String
Dim bAuthethicated As Boolean
patientNo = txtuser.Text
password = txtpassword.Text
bAuthethicated = CheckUser(patientNo, password)
If bAuthethicated Then
lblresult.Text() = "Login details are correct"
Else
lblresult.Text() = "Incorrect Student Number and/or Password"
End If
End Sub
Public Function CheckUser(patientNo As String, password As String) As Integer
Dim cmdstring As String = "SELECT * FROM Patient Where Username=@PATIENTNO AND Password=@PASSWORD"
Dim found = 0
Using conn As New SqlConnection("Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\Laura\Final_proj\App_Data\surgerydb.mdf;Integrated Security=True;Connect Timeout=30")
Dim cmd = New SqlCommand(cmdstring, conn)
cmd.Parameters.Add("@PATIENTNO", SqlDbType.NChar).Value = patientNo
cmd.Parameters.Add("@PASSWORD", SqlDbType.NChar).Value = password
conn.Open()
Dim reader = cmd.ExecuteReader()
While reader.Read()
Session("PatientId") = CInt(reader.Item("PatientId"))
found = CInt(reader.Item("PatientId"))
End While
reader.Close()
End Using
Return (found)
End Function
End Class
however I want to restrict the others from seeing the other pages, I a logged in patient to gain access to their own individual Information. Can someone please help I have been trying to get this to work all weekend. Kind regards
Laura
however I want to restrict the others from seeing the other pages, I a logged in patient to gain access to their own individual Information