initial commit
This commit is contained in:
136
ArinLogin/Class1.vb
Normal file
136
ArinLogin/Class1.vb
Normal file
@@ -0,0 +1,136 @@
|
||||
Public Class ArinLOgin
|
||||
|
||||
Public Structure User_Info
|
||||
Dim id As String
|
||||
Dim name As String
|
||||
Dim Pass As String
|
||||
Dim authip As String
|
||||
Dim authmac As String
|
||||
Dim authtype As String
|
||||
Dim Exist As Boolean
|
||||
End Structure
|
||||
|
||||
Public Structure sVersionInfo
|
||||
Dim Ver As String '//버젼
|
||||
Dim Desc As String '//버젼설명
|
||||
Dim Link As String '//링크주소
|
||||
End Structure
|
||||
|
||||
Dim CSFile As String
|
||||
|
||||
''' <summary>
|
||||
''' 연결문자열이들어있는 파일명을 입력하세요
|
||||
''' </summary>
|
||||
''' <param name="p_file"></param>
|
||||
''' <remarks></remarks>
|
||||
Public Sub New(ByVal p_file As String)
|
||||
CSFile = p_file
|
||||
End Sub
|
||||
|
||||
Public Sub New()
|
||||
CSFile = My.Application.Info.DirectoryPath & "\login.dat"
|
||||
End Sub
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' 검색테이블,id,암호를 입력한후 부울값을 반환받는다 True 라면 존재한다
|
||||
''' </summary>
|
||||
''' <param name="Table_Name"></param>
|
||||
''' <param name="userid"></param>
|
||||
''' <param name="userpass"></param>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function Check_user(ByVal Table_Name As String, ByVal userid As String, ByVal userpass As String) As User_Info
|
||||
Dim Cs As String = ReadCString()
|
||||
|
||||
Dim Cn As New SqlClient.SqlConnection(Cs)
|
||||
Dim Cmd As New SqlClient.SqlCommand("select isnull(username,'') ,isnull(authip,''),isnull(authmac,''),isnull(authtype,'') from " & Table_Name & " where userid=@id and userpass=@pass", Cn)
|
||||
Cmd.Parameters.Add("id", SqlDbType.VarChar).Value = userid
|
||||
Cmd.Parameters.Add("pass", SqlDbType.VarChar).Value = userpass
|
||||
|
||||
Dim Retval As New User_Info
|
||||
Retval.id = userid
|
||||
Retval.Pass = userpass
|
||||
Retval.Exist = False
|
||||
|
||||
If Cn.State <> ConnectionState.Open Then Cn.Open()
|
||||
Dim Da As SqlClient.SqlDataReader = Cmd.ExecuteReader
|
||||
While Da.Read
|
||||
Retval.name = Da(0)
|
||||
Retval.authip = Da(1)
|
||||
Retval.authmac = Da(2)
|
||||
Retval.authtype = Da(3)
|
||||
End While
|
||||
Da.Close()
|
||||
Cmd.Dispose()
|
||||
Cn.Close()
|
||||
Return Retval
|
||||
End Function
|
||||
|
||||
'//게스트체크
|
||||
Public Function Check_guest() As String
|
||||
Dim ok As String = ""
|
||||
Try
|
||||
Dim Cs As String = ReadCString()
|
||||
Dim Cn As New SqlClient.SqlConnection(Cs)
|
||||
Dim Cmd As New SqlClient.SqlCommand("select isnull(ok,'') from tbl_guest", Cn)
|
||||
If Cn.State <> ConnectionState.Open Then Cn.Open()
|
||||
Dim Da As SqlClient.SqlDataReader = Cmd.ExecuteReader
|
||||
While Da.Read
|
||||
ok = Da(0).ToString
|
||||
End While
|
||||
Da.Close()
|
||||
Cmd.Dispose()
|
||||
Cn.Close()
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
Return ok
|
||||
End Function
|
||||
|
||||
Public Function Get_LastVersion(ByVal gubun As String) As sVersionInfo
|
||||
Dim Cs As String = ReadCString()
|
||||
|
||||
Dim Cn As New SqlClient.SqlConnection(Cs)
|
||||
Dim Cmd As New SqlClient.SqlCommand("select isnull(max(version),'0') from eco_version where gubun ='" & gubun & "'", Cn)
|
||||
|
||||
|
||||
Dim Retval As New sVersionInfo
|
||||
|
||||
If Cn.State <> ConnectionState.Open Then Cn.Open()
|
||||
Retval.Ver = Cmd.ExecuteScalar
|
||||
Retval.Desc = ""
|
||||
Retval.Link = ""
|
||||
If Retval.Ver <> "0" Then
|
||||
Cmd.CommandText = "select isnull(bigo,''),isnull(link,'') from eco_version where version='" & Retval.Ver & "' and gubun='" & gubun & "'"
|
||||
Dim Da As SqlClient.SqlDataReader = Cmd.ExecuteReader
|
||||
While Da.Read
|
||||
Retval.Desc = Da(0)
|
||||
Retval.Link = Da(1)
|
||||
End While
|
||||
Da.Close()
|
||||
End If
|
||||
Cmd.Dispose()
|
||||
Cn.Close()
|
||||
Return Retval
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 폴더내의 연결문자열 정보를 가지고 연결한다
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
''' <remarks></remarks>
|
||||
Public Function ReadCString() As String
|
||||
Dim A As New EnDec("ENDECPASSWORDKEY")
|
||||
Dim Cs As String = ""
|
||||
If System.IO.File.Exists(CSFile) = False Then
|
||||
MsgBox("연결파일이 존재하지않습니다" & vbCrLf & "로그인기능을 이용할 수 없습니다", MsgBoxStyle.Critical, "확인")
|
||||
Return ""
|
||||
End If
|
||||
' Cs = A.Read_STring(CSFile)
|
||||
Return A.Read_STring(CSFile)
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user