Make your own FTP Chat

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
33 posts Page 4 of 4
User avatar
Jg99
VIP - Site Partner
VIP - Site Partner
Posts: 453
Joined: Sun Mar 20, 2011 5:04 am

Re: Make your own FTP Chat
Jg99
I use 000webhost.com for my ftp chat.
and awesome tut
http://www.sctechusa.com SilverCloud Website
User avatar
jake-goldy
Just Registered
Just Registered
Posts: 5
Joined: Mon May 23, 2011 8:27 am

Re: Make your own FTP Chat
jake-goldy
I have a problem: If you distrubite this program then everyone who gets it can read all the chat messages. How do you create a new chat file each time they open the program?
User avatar
astheyfall
VIP - Donator
VIP - Donator
Posts: 160
Joined: Sun Sep 19, 2010 6:13 am

Re: Make your own FTP Chat
astheyfall
rocky4126 wrote:
@justfashion:
Code: Select all
    Dim client As New Net.WebClient
    Dim iscommand As New Boolean
    Dim name1 As New String(My.Settings.nick)
    Dim privs As String
    Dim kick As String
    Dim clear As String
    Dim admin As String
    Dim subrank As String
    Dim rank As System.Drawing.Color
    Public Sub checkcommands(ByVal input As System.String)
        If (input.StartsWith("/")) Then
            iscommand = True
        Else
            iscommand = False
        End If
    End Sub
    Public Sub processcommand(ByVal command As System.String)
        If command.StartsWith("/nick") Then
            Dim oldname As String
            oldname = name1
            My.Settings.nick = command.Substring(6)
            name1 = My.Settings.nick
            Dim users As String
            client.Credentials = New Net.NetworkCredential("root", "***")
            users = client.DownloadString("ftp://127.0.0.1/server.users")
            users = users.Replace(oldname, name1)
            client.UploadString("ftp://127.0.0.1/server.users", users)
            getprivs(name1)
        End If
        If command = "/cls" And clear = "1" Then
            client.Credentials = New Net.NetworkCredential("root", "***")
            client.UploadString("ftp://127.0.0.1/server.messages", name1 + " Cleared the chat log")
            MsgBox("DONE!")
        ElseIf command = "/cls" And clear = "0" Then
            MsgBox("Your not permitted to do this! DEBUG INFO: Required Permission value: 1 | Your Value: " & clear)
        End If
        If command = "/sanick" And admin = "1" Then
            client.Credentials = New Net.NetworkCredential("root", "***")
            Dim oldname As String
            Dim newname As String
            Dim strarray As Array
            strarray = command.Split(" ")
            oldname = strarray.GetValue(0)
            newname = strarray.GetValue(1)
            Dim str As String
            str = client.DownloadString("ftp://127.0.0.1/server.users")
            str = str.Replace(oldname, newname)
            client.UploadString("ftp://127.0.0.1/server.users", str)
        End If
    End Sub
    Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode = Keys.Enter Then
            Button1.PerformClick()
        End If
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        name1 = My.Settings.nick
        checkcommands(TextBox1.Text)
        If iscommand = True Then
            processcommand(TextBox1.Text)
            TextBox1.Clear()
            Exit Sub
        End If
        Try
            client.Credentials = New Net.NetworkCredential("root", "***")
            client.UploadString("ftp://127.0.0.1/server.messages", "[" & TimeOfDay & "] " & name1 & ": " & TextBox1.Text & vbNewLine & RichTextBox2.Text & vbNewLine)
            RichTextBox2.Clear()
        Catch ex As Exception
            MsgBox("Error, this error is being taken care of.", MsgBoxStyle.Critical, "Error!")
        End Try
        Try
            client.Credentials = New Net.NetworkCredential("root", "***")
            RichTextBox2.Text = client.DownloadString("ftp://127.0.0.1/server.messages")
            If RichTextBox2.Text = RichTextBox1.Text Then  Else  : RichTextBox1.Text = RichTextBox2.Text

        Catch ex As Exception
        End Try
        TextBox1.Text = ""
    End Sub
    Sub getprivs(ByVal name As String)
        client.Credentials = New Net.NetworkCredential("root", "***")
        Dim one As String
        Dim onearray As Array
        one = client.DownloadString("ftp://127.0.0.1/server.privs")
        onearray = one.Split(" ")
        For Each one In onearray
            If one.StartsWith(name) Then
                Dim split As Array
                split = one.Split(",")
                kick = split.GetValue(1)
                clear = split.GetValue(2)
                admin = split.GetValue(3)
                subrank = split.GetValue(4)
                Select Case subrank
                    Case 1
                        rank = Color.Red
                    Case 2
                        rank = Color.Blue
                    Case 3
                        rank = Color.Green
                    Case Else
                        rank = Color.Black
                End Select
            End If
        Next

    End Sub
I've thrown a bit of my code in there, hope it helps. goto the sub: processcommands and add the /kick etc in there. I'm still working on that part, but the fact that I'm making it into a server + client app takes priority. I'm also using Multi-Threaded FTP connections if anyone wants to know how to stop the error where it seems to crash when trying to connect (It claims the client is not logged in according to FileZilla)
I know I'm late but, where do you add this?
*EDIT*Nevermind I already did it but, for the FTP server files do I need to add them myself? Like the /server.pliv?

When I try to run the program it gives me a error "Error 1 The item "obj\x86\Debug\Main_Page.VB.Form1.resources" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter."
33 posts Page 4 of 4
Return to “Tutorials”