Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Net
- Imports System.IO
- Imports System.Text
- Module Module1
- Function Token() As String
- Dim tokenid As New WebClient
- Return tokenid.DownloadString("http://192.168.2.7/tokengenerator.php")
- End Function
- End Module
- Public Class Form1
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- TextBox1.Text = Token()
- RichTextBox2.Hide()
- Dim postData = "token=" & TextBox1.Text
- Dim request As WebRequest = WebRequest.Create("http://192.168.2.7/create.php")
- request.Method = "POST"
- Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
- request.ContentType = "application/x-www-form-urlencoded"
- request.ContentLength = byteArray.Length
- Dim dataStream As Stream = request.GetRequestStream()
- dataStream.Write(byteArray, 0, byteArray.Length)
- dataStream.Close()
- Timer1.Start()
- If My.Settings.username = ("") Then
- Else
- TextBox3.Text = My.Settings.username
- End If
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
- Clipboard.SetText(TextBox1.Text)
- End Sub
- Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
- End Sub
- Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
- End Sub
- Private Sub Form1_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
- My.Settings.username = TextBox3.Text
- End Sub
- Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
- End Sub
- Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
- Dim address As String = "http://192.168.2.7/DataENC/" & TextBox1.Text & ".txt"
- Dim client As WebClient = New WebClient()
- Dim reply As String = client.DownloadString(address)
- RichTextBox2.Text = reply
- If RichTextBox2.Text = RichTextBox1.Text Then
- Else
- RichTextBox1.Text = RichTextBox2.Text
- End If
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- TextBox1.Text = TextBox4.Text
- End Sub
- Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
- RichTextBox1.SelectionStart = RichTextBox1.TextLength
- RichTextBox1.ScrollToCaret()
- End Sub
- Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
- TextBox3.ReadOnly = True
- If TextBox2.Text = ("") Then
- Else
- Dim postData = "msg=" & TextBox3.Text & ": " & TextBox2.Text & "&token=" & TextBox1.Text
- Dim request As WebRequest = WebRequest.Create("http://192.168.2.7/msg.php")
- request.Method = "POST"
- Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
- request.ContentType = "application/x-www-form-urlencoded"
- request.ContentLength = byteArray.Length
- Dim dataStream As Stream = request.GetRequestStream()
- dataStream.Write(byteArray, 0, byteArray.Length)
- dataStream.Close()
- TextBox2.Clear()
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement