Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System
- Imports System.IO
- Imports System.Net
- Imports System.Text
- Public Class loginForm
- Public va_link As String = "http://lufava.hekko24.pl"
- Public p_id As String
- Public p_name As String
- Public p_sname As String
- Public p_code As String
- Public p_rankstring As String
- Public p_rank As String
- Public p_thours As String
- Public p_tflights As String
- Public p_landing As String
- Protected Overrides ReadOnly Property CreateParams() As CreateParams
- Get
- Dim cp As CreateParams = MyBase.CreateParams
- cp.ExStyle = cp.ExStyle Or &H2000000
- Return cp
- End Get
- End Property
- Public Function GenerateSessionId()
- Dim xCharArray() As Char = "0123456789".ToCharArray
- Dim xNoArray() As Char = "0123456789".ToCharArray
- Dim xGenerator As System.Random = New System.Random()
- Dim xStr As String = String.Empty
- While xStr.Length < 16
- If xGenerator.Next(0, 2) = 0 Then
- xStr &= xCharArray(xGenerator.Next(0, xCharArray.Length))
- Else
- xStr &= xNoArray(xGenerator.Next(0, xNoArray.Length))
- End If
- End While
- Return xStr
- End Function
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- My.Settings.sessionid = GenerateSessionId()
- My.Settings.user = id_box.Text
- If CheckBox1.Checked = True Then
- My.Settings.autologin = True
- My.Settings.password = pass_box.Text
- End If
- My.Settings.Save()
- Dim str As String = id_box.Text
- Dim Res As String = Nothing
- For Each c As Char In str
- If IsNumeric(c) Then
- Res = Res & c
- End If
- Next
- Dim idBoxCorr As String = Res
- Dim db_req As String = LoginToSystem(idBoxCorr, pass_box.Text)
- If Not db_req = "AUTH_FAILED CODE 1" Then
- Dim dane As String() = db_req.Split(",")
- p_name = dane(4)
- p_sname = dane(5)
- p_code = dane(1)
- p_id = dane(0)
- p_rank = dane(7)
- Dim db_pilot As String() = GetDB("getpilotcenterdata&dbid=" & p_id).split(",")
- p_thours = db_pilot(0)
- p_tflights = db_pilot(1)
- p_landing = db_pilot(2)
- Form1.Button1.Enabled = True
- Form1.Button2.Enabled = True
- Form1.Button3.Enabled = True
- Form1.Button4.Enabled = True
- Form1.Button5.Enabled = True
- Form1.Button6.Enabled = True
- Form1.Button8.Enabled = True
- GetPlanes()
- Me.Hide()
- Form1.Button1.BackColor = Color.FromArgb(255, 57, 59)
- dashboard.Show()
- Else
- MsgBox("Your login credentials doesn't match!", vbCritical, "Login error!")
- End If
- End Sub
- Function LoginToSystem(userid As String, userpass As String) As String
- Try
- Dim strReq As String
- Dim strData As String
- Dim dataStream As Stream
- Dim reader As StreamReader
- Dim request As WebRequest
- Dim response As WebResponse
- strReq = va_link & "/core/ABCrewCenter/borys.php?action=getlogin&userid=" & userid & "&password=" & userpass
- request = WebRequest.Create(strReq)
- response = request.GetResponse()
- dataStream = response.GetResponseStream()
- reader = New StreamReader(dataStream)
- strData = reader.ReadToEnd()
- reader.Close()
- response.Close()
- Return strData
- Catch ex As Exception
- Return "" & vbNewLine & ex.ToString()
- End Try
- End Function
- Function GetDB(dbevent As String)
- Try
- Dim strReq As String
- Dim strData As String
- Dim dataStream As Stream
- Dim reader As StreamReader
- Dim request As WebRequest
- Dim response As WebResponse
- strReq = va_link & "/core/ABCrewCenter/borys.php?action=" & dbevent
- request = WebRequest.Create(strReq)
- response = request.GetResponse()
- dataStream = response.GetResponseStream()
- reader = New StreamReader(dataStream)
- strData = reader.ReadToEnd()
- reader.Close()
- response.Close()
- Return strData
- Catch ex As Exception
- Return "" & vbNewLine & ex.ToString()
- End Try
- Return 0
- End Function
- Private Sub loginForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- CheckBox1.Checked = My.Settings.autologin
- id_box.Text = My.Settings.user
- pass_box.Text = My.Settings.password
- id_box.Select()
- If My.Settings.sessionid <> "" And My.Settings.user <> "" And My.Settings.password <> "" And CheckBox1.Checked Then
- 'LoginButton.Text = "Logging in..."
- 'Button1.PerformClick()
- End If
- End Sub
- Private Sub BackgroundWorker1_DoWork(sender As Object, e As ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
- End Sub
- Private Sub BackgroundWorker1_Completed(sender As System.Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted
- End Sub
- Public samoloty As New ArrayList
- Function GetPlanes()
- Dim db As String = GetDB("getaircraft")
- Dim output As String() = db.Split(";")
- For n = 0 To output.GetUpperBound(0)
- Dim output2 As String() = output(n).Split(",")
- samoloty.Add(New aircrafts)
- samoloty(n).id = output2(0)
- samoloty(n).full = output2(1)
- samoloty(n).icao = output2(2)
- samoloty(n).reg = output2(3)
- samoloty(n).pax = output2(4)
- samoloty(n).cargo = output2(5)
- samoloty(n).rank = output2(6)
- Return "ok"
- Next
- Return "error"
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement