Logging into a Forum Using C# Code.!

Discussion in 'C#' started by liveuploader, Jul 10, 2010.

  1. liveuploader

    liveuploader New Member

    Joined:
    Jul 10, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi ,

    I'm live.. new to the coding field. So, yes i'm a noob and i need a bit more explanation in all :P

    Well..

    My Project: Making an Automatic topic/Thread poster in forums such Vbulletin,PHPBB,SMF,IPB etc.,

    My login code is more clumsy...

    Code:
    
    #region Login Button Click
            private void login_Click(object sender, EventArgs e)
            {
                {
                    login.Enabled = false;
                    username2.Enabled = false;
                    password2.Enabled = false;
    
                    Cursor.Current = Cursors.WaitCursor;
                    try
                    {
                        Thread.Sleep(5000); //Hangs the Cursor for a while
                    }
                    finally
                    {
                        Cursor.Current = Cursors.Default;
                    }
            #endregion
                    #region Login Information
                    {
                        var username = "username";
                        var password = "password";
                        var forum = DefaultSiteTypes.ByName("vBulletin 3.x.x").CreateInstance();
                        //Site URL
                        forum.BaseUrl = "ht tp://yoursite.com/forum_path";
                        //Attach Event Handeler
                        forum.Login += (_sender, _e) =>
                            {
                                if (_e.LoggedIn)
                                {
                                    logon logon1 = new logon();
                                    logon1.ShowDialog();
                                    //Yay it Worked
                                }
                                else
                                {
                                    //Fail :(
                                }
                            };
                        //Login
                        forum.LoginUser(username, password);
                        login.Enabled = true;
                        username2.Enabled = true;
                        password2.Enabled = true;
                    }
                }
            }
            private void CreateInstance()
            {
                throw new NotImplementedException();
            }
        }
    }
    
    #endregion
    
    
    But is not working... Need your help.. Thanks...
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice