Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Imports System.Net
- Imports MySql.Data.MySqlClient
- Module Module1
- Sub Main()
- Dim x() As System.Net.IPAddress = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName())
- Dim timeStamp As String = DateTime.Now.ToString("dd/MM hh:mm:ss")
- Dim weblogs_connection As New MySqlConnection("datasource=yoursite.com;port=3306;username=root;password=root;database=db")
- Dim strIPAddress As String
- Dim strHostName As String
- strHostName = System.Net.Dns.GetHostName()
- strIPAddress = System.Net.Dns.GetHostByName(strHostName).AddressList(0).ToString()
- Dim command As New MySqlCommand("INSERT INTO `website_logs`(`timestamp`, `ipadress`, `visited_page`, `country`,`op_system`) VALUES (@timestamp,@ipadress,@visited_page,@country,@user_os)", weblogs_connection)
- command.Parameters.Add("@timestamp", MySqlDbType.VarChar).Value = getTimestamp()
- command.Parameters.Add("@ipadress", MySqlDbType.VarChar).Value = GetIP()
- command.Parameters.Add("@visited_page", MySqlDbType.VarChar).Value = "loader"
- command.Parameters.Add("@country", MySqlDbType.VarChar).Value = Getcountry()
- command.Parameters.Add("@user_os", MySqlDbType.VarChar).Value = "Windows"
- weblogs_connection.Open()
- If command.ExecuteNonQuery() = 1 Then
- ' do your thing here
- Else
- MsgBox("Error happened!")
- Application.Exit()
- End If
- Try
- Catch ex As MySqlException
- MessageBox.Show(ex.Message)
- Finally
- weblogs_connection.Close()
- End Try
- 'mysql connect
- Dim shit As New MySqlConnection("datasource=yoursite.com;port=3306;username=root;password=root;database=db")
- Dim command_user As New MySqlCommand("INSERT INTO `user_logs`(`username`, `last_known_ip`,`timestamp`) VALUES (@username,@lastknownip,@timestamp)", shit)
- command_user.Parameters.Add("@username", MySqlDbType.VarChar).Value = My.Settings.loggeduser
- command_user.Parameters.Add("@lastknownip", MySqlDbType.VarChar).Value = GetIP()
- command_user.Parameters.Add("@timestamp", MySqlDbType.VarBinary).Value = getTimestamp()
- shit.Open()
- If command_user.ExecuteNonQuery() = 1 Then
- ' do your thing here
- Else
- MsgBox("problem happened")
- End If
- Try
- Catch ex As MySqlException
- MessageBox.Show(ex.Message)
- Finally
- shit.Close()
- End Try
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement