277 lines
15 KiB
VB.net
277 lines
15 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports System.Net
|
|
Imports System.Security.Cryptography
|
|
Imports System.Text
|
|
|
|
Public Class Form186
|
|
Private Sub Form186_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Dim lines4() As String = File.ReadAllLines(théme)
|
|
If lines4(0) = 2 Then
|
|
Me.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label1.BackColor = Color.FromArgb(64, 64, 64)
|
|
TextBox1.BackColor = Color.FromArgb(64, 64, 64)
|
|
ComboBox1.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label2.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label3.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label4.BackColor = Color.FromArgb(64, 64, 64)
|
|
ComboBox2.BackColor = Color.FromArgb(64, 64, 64)
|
|
TextBox2.BackColor = Color.FromArgb(64, 64, 64)
|
|
TextBox3.BackColor = Color.FromArgb(64, 64, 64)
|
|
TextBox4.BackColor = Color.FromArgb(64, 64, 64)
|
|
Label1.ForeColor = Color.White
|
|
TextBox1.ForeColor = Color.White
|
|
ComboBox1.ForeColor = Color.White
|
|
Label2.ForeColor = Color.White
|
|
Label3.ForeColor = Color.White
|
|
Label4.ForeColor = Color.White
|
|
TextBox2.ForeColor = Color.White
|
|
TextBox3.ForeColor = Color.White
|
|
TextBox4.ForeColor = Color.White
|
|
ComboBox2.BackColor = Color.White
|
|
PictureBox1.BackColor = Color.FromArgb(64, 64, 64)
|
|
PictureBox2.BackColor = Color.FromArgb(64, 64, 64)
|
|
PictureBox3.BackColor = Color.FromArgb(64, 64, 64)
|
|
PictureBox4.BackColor = Color.FromArgb(64, 64, 64)
|
|
PictureBox2.Hide()
|
|
PictureBox3.Hide()
|
|
Button1.BackColor = Color.FromArgb(64, 64, 64)
|
|
Button1.ForeColor = Color.White
|
|
ElseIf lines4(0) = 3 Then
|
|
Me.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
TextBox1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
ComboBox1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label2.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label3.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label4.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
ComboBox2.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
TextBox2.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
TextBox3.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
TextBox4.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
TextBox1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
ComboBox1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Label2.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Label3.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Label4.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
TextBox2.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
TextBox3.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
TextBox4.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
ComboBox2.BackColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
PictureBox1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
PictureBox2.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
PictureBox3.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
PictureBox4.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
PictureBox2.Hide()
|
|
PictureBox3.Hide()
|
|
Button1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Button1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
End If
|
|
|
|
Me.Text = "Modification du compte: " & Form3.TextBox7.Text
|
|
ComboBox1.SelectedItem = "@gmail.com"
|
|
ComboBox2.SelectedItem = "@gmail.com"
|
|
End Sub
|
|
|
|
Private Sub Form186_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
|
TextBox1.Text = ""
|
|
TextBox2.Text = ""
|
|
TextBox3.Text = ""
|
|
TextBox4.Text = ""
|
|
Form185.Close()
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
Dim msg = MsgBox("Être vous sur de vouloir enregistrer ? attention une fois validé le code: " & Form185.ComboBox1.SelectedItem & " sera supprimer ", MsgBoxStyle.YesNo)
|
|
If msg = MsgBoxResult.Yes Then
|
|
vérifi()
|
|
Else
|
|
MsgBox("Action annulez", MsgBoxStyle.Information)
|
|
Close()
|
|
Form185.Close()
|
|
End If
|
|
End Sub
|
|
Sub vérifi()
|
|
If TextBox1.Text = "" Then
|
|
MsgBox("Merci d'entrer un mot de passe", MsgBoxStyle.Critical)
|
|
Else
|
|
If TextBox2.Text = "" Then
|
|
MsgBox("Merci confirmer mots de passe", MsgBoxStyle.Critical)
|
|
Else
|
|
If TextBox3.Text = "" Then
|
|
MsgBox("Merci d'entrer une adresse mail", MsgBoxStyle.Critical)
|
|
Else
|
|
If TextBox4.Text = "" Then
|
|
MsgBox("Merci confirmer l'adresse mail", MsgBoxStyle.Critical)
|
|
Else
|
|
If TextBox3.Text.Contains("@") Or TextBox4.Text.Contains("@") Then
|
|
MsgBox("Merci d'entre le début de l'adresse mail", MsgBoxStyle.Critical)
|
|
Else
|
|
If TextBox1.Text = TextBox2.Text Then
|
|
If TextBox3.Text & ComboBox1.SelectedItem = TextBox4.Text & ComboBox2.SelectedItem Then
|
|
dlcozip()
|
|
Else
|
|
MsgBox("Les adresse mail ne correspondent pas", MsgBoxStyle.Critical)
|
|
End If
|
|
Else
|
|
MsgBox("Les mots de passe ne correspondent pas", MsgBoxStyle.Critical)
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
Sub dlcozip()
|
|
Dim texteEnBytes() As Byte = Encoding.UTF8.GetBytes(TextBox1.Text)
|
|
Dim keyBytes() As Byte = Encoding.UTF8.GetBytes("Jj@msms7")
|
|
Dim Crypto As New DESCryptoServiceProvider()
|
|
Crypto.Key = keyBytes
|
|
Crypto.IV = keyBytes
|
|
Dim Icrypto As ICryptoTransform = Crypto.CreateEncryptor
|
|
Dim Resultatbytes() As Byte = Icrypto.TransformFinalBlock(texteEnBytes, 0, texteEnBytes.Length)
|
|
Dim passecrypt = Convert.ToBase64String(Resultatbytes)
|
|
|
|
Dim texteEnBytes2() As Byte = Encoding.UTF8.GetBytes(TextBox3.Text & ComboBox1.Text)
|
|
Dim keyBytes2() As Byte = Encoding.UTF8.GetBytes("Jj@msms7")
|
|
Dim Crypto2 As New DESCryptoServiceProvider()
|
|
Crypto.Key = keyBytes
|
|
Crypto.IV = keyBytes
|
|
Dim Icrypto2 As ICryptoTransform = Crypto.CreateEncryptor
|
|
Dim Resultatbytes2() As Byte = Icrypto.TransformFinalBlock(texteEnBytes2, 0, texteEnBytes2.Length)
|
|
Dim mailcrypte = Convert.ToBase64String(Resultatbytes2)
|
|
|
|
Dim t1 = cozip & "pass.txt"
|
|
Dim sw1 As New StreamWriter(t1)
|
|
sw1.WriteLine(passecrypt)
|
|
sw1.Close()
|
|
|
|
Dim t2 = cozip & "mail.txt"
|
|
Dim sw7 As New StreamWriter(t2)
|
|
sw7.WriteLine(mailcrypte)
|
|
sw7.Close()
|
|
|
|
Try
|
|
My.Computer.Network.UploadFile(cozip & "pass.txt", ipserver & "utilisateur/" & Form3.TextBox7.Text & "/pass.txt")
|
|
My.Computer.Network.UploadFile(cozip & "mail.txt", ipserver & "utilisateur/" & Form3.TextBox7.Text & "/mail.txt")
|
|
File.Delete(cozip & "pass.txt")
|
|
File.Delete(cozip & "mail.txt")
|
|
supprecode()
|
|
Catch ex As Exception
|
|
Timer1.Start()
|
|
End Try
|
|
End Sub
|
|
|
|
Sub supprecode()
|
|
Try
|
|
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Form3.TextBox7.Text & "/" & Form185.ComboBox1.SelectedItem & " " & Form3.TextBox7.Text & ".txt")
|
|
ftreq.Method = WebRequestMethods.Ftp.DeleteFile
|
|
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
|
|
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
|
|
Try
|
|
Dim maj As New WebClient
|
|
Dim vri As String = maj.DownloadString(ipsite & "/newletter/" & Form3.TextBox7.Text & ".txt")
|
|
|
|
Dim texteEnBytes() As Byte = Encoding.UTF8.GetBytes(TextBox3.Text & ComboBox1.Text)
|
|
Dim keyBytes() As Byte = Encoding.UTF8.GetBytes("Jj@msms7")
|
|
Dim Crypto As New DESCryptoServiceProvider()
|
|
Crypto.Key = keyBytes
|
|
Crypto.IV = keyBytes
|
|
Dim Icrypto As ICryptoTransform = Crypto.CreateEncryptor
|
|
Dim Resultatbytes() As Byte = Icrypto.TransformFinalBlock(texteEnBytes, 0, texteEnBytes.Length)
|
|
Dim mailcrypte = Convert.ToBase64String(Resultatbytes)
|
|
|
|
Dim sw1 As New StreamWriter(dosparamètres & "\" & Form3.TextBox7.Text & ".txt")
|
|
sw1.WriteLine(mailcrypte)
|
|
sw1.Close()
|
|
My.Computer.Network.UploadFile(dosparamètres & "\" & Form3.TextBox7.Text & ".txt", ipserver & "/newletter/" & Form3.TextBox7.Text & ".txt")
|
|
File.Delete(dosparamètres & "\" & Form3.TextBox7.Text & ".txt")
|
|
MsgBox("Les modifications ont été enregistrer, vous pouvez maintenant vous connecter", MsgBoxStyle.Information)
|
|
Me.Close()
|
|
Form185.Close()
|
|
Catch ex As Exception
|
|
MsgBox("Les modifications ont été enregistrer, vous pouvez maintenant vous connecter", MsgBoxStyle.Information)
|
|
Me.Close()
|
|
Form185.Close()
|
|
End Try
|
|
Catch ex As Exception
|
|
Timer3.Start()
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
|
|
Timer3.Stop()
|
|
Try
|
|
Dim ftreq As FtpWebRequest = FtpWebRequest.Create(ipserver & "/Utilisateur/" & Form3.TextBox7.Text & "/" & Form185.ComboBox1.SelectedItem & " " & Form3.TextBox7.Text & ".txt")
|
|
ftreq.Method = WebRequestMethods.Ftp.DeleteFile
|
|
ftreq.Credentials = New NetworkCredential("yoannsafe", passftp)
|
|
Dim ftpresp As FtpWebResponse = ftreq.GetResponse
|
|
Try
|
|
Dim maj As New WebClient
|
|
Dim vri As String = maj.DownloadString(ipsite & "/newletter/" & Form3.TextBox7.Text & ".txt")
|
|
|
|
Dim texteEnBytes() As Byte = Encoding.UTF8.GetBytes(TextBox3.Text & ComboBox1.Text)
|
|
Dim keyBytes() As Byte = Encoding.UTF8.GetBytes("Jj@msms7")
|
|
Dim Crypto As New DESCryptoServiceProvider()
|
|
Crypto.Key = keyBytes
|
|
Crypto.IV = keyBytes
|
|
Dim Icrypto As ICryptoTransform = Crypto.CreateEncryptor
|
|
Dim Resultatbytes() As Byte = Icrypto.TransformFinalBlock(texteEnBytes, 0, texteEnBytes.Length)
|
|
Dim mailcrypte = Convert.ToBase64String(Resultatbytes)
|
|
|
|
Dim sw1 As New StreamWriter(dosparamètres & "\" & Form3.TextBox7.Text & ".txt")
|
|
sw1.WriteLine(mailcrypte)
|
|
sw1.Close()
|
|
My.Computer.Network.UploadFile(dosparamètres & "\" & Form3.TextBox7.Text & ".txt", ipserver & "/newletter/" & Form3.TextBox7.Text & ".txt")
|
|
File.Delete(dosparamètres & "\" & Form3.TextBox7.Text & ".txt")
|
|
MsgBox("Les modifications ont été enregistrer, vous pouvez maintenant vous connecter", MsgBoxStyle.Information)
|
|
Me.Close()
|
|
Form185.Close()
|
|
Catch ex As Exception
|
|
MsgBox("Les modifications ont été enregistrer, vous pouvez maintenant vous connecter", MsgBoxStyle.Information)
|
|
Me.Close()
|
|
Form185.Close()
|
|
End Try
|
|
Catch ex As Exception
|
|
Timer3.Start()
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
|
|
PictureBox2.Show()
|
|
PictureBox1.Hide()
|
|
TextBox1.UseSystemPasswordChar = False
|
|
End Sub
|
|
|
|
Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
|
|
PictureBox2.Hide()
|
|
PictureBox1.Show()
|
|
TextBox1.UseSystemPasswordChar = True
|
|
End Sub
|
|
|
|
Private Sub PictureBox3_Click(sender As Object, e As EventArgs) Handles PictureBox3.Click
|
|
PictureBox3.Hide()
|
|
PictureBox4.Show()
|
|
TextBox2.UseSystemPasswordChar = True
|
|
End Sub
|
|
|
|
Private Sub PictureBox4_Click(sender As Object, e As EventArgs) Handles PictureBox4.Click
|
|
PictureBox3.Show()
|
|
PictureBox4.Hide()
|
|
TextBox2.UseSystemPasswordChar = False
|
|
End Sub
|
|
|
|
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
|
|
Timer1.Stop()
|
|
Try
|
|
My.Computer.Network.UploadFile(cozip & "pass.txt", ipserver & "utilisateur/" & Form3.TextBox7.Text & "/pass.txt")
|
|
My.Computer.Network.UploadFile(cozip & "mail.txt", ipserver & "utilisateur/" & Form3.TextBox7.Text & "/mail.txt")
|
|
File.Delete(cozip & "pass.txt")
|
|
File.Delete(cozip & "mail.txt")
|
|
supprecode()
|
|
Catch ex As Exception
|
|
Timer1.Start()
|
|
End Try
|
|
End Sub
|
|
End Class |