Esempio n. 1
0
        private string getHTTPDocSource(string url)
        {
            clsWeb web;

            web = new clsWeb(url);
            web.Cookie = clsFunctions.cCookie;
            web.@ref = "http://apps.facebook.com/mousehunt/";
            System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(web.GetUrl));
            thread.Priority = System.Threading.ThreadPriority.Highest;
            thread.Start();
            do
            {
                Application.DoEvents();
            }
            while (thread.IsAlive);

            return web.sData;
        }
Esempio n. 2
0
        public static bool login(string username, string password, TextBox txtStatus)
        {
            int status = 0;
            bool isLogin = false;

            txtStatus.Text = "Connecting to Facebook.";

            do
            {
                Thread thread;
                switch (status)
                {

                    case 0:
                        cWeb = new clsWeb("http://www.facebook.com");
                        thread = new Thread(new ThreadStart(cWeb.GetHTTPCookie));
                        thread.Start();
                        do
                        {
                            Application.DoEvents();
                        }
                        while (thread.IsAlive);
                        cCookie = cWeb.Cookie;
                        txtStatus.Text = "Logging in.";
                        if (txtStatus.Text.Equals("Logging in."))
                        {
                            if (status == 0)
                                status++;
                            break;
                        }
                        else
                        {
                            break;
                        }
                    case 1:
                        cWeb = new clsWeb("https://login.facebook.com/login.php?login_attempt=1");

                        //cWeb.sData = "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&" +
                        //            "version=1.0&return_session=0&session_key_only=0&" +
                        //            "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&" +
                        //            "lsd=XOdHU" + "&" +
                        //            "email=" + username + "&" +
                        //            "pass="******"&" +
                        //            "persistent=1";

                        //cWeb.sData = "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&" +
                        //            "version=1.0&return_session=0&session_key_only=0&" +
                        //            "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&" +
                        //            "lsd=XOdHU" + "&" +
                        //            "email=" + username + "&" +
                        //            "pass="******"&" +
                        //            "persistent=1";

                        cWeb.sData = "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&" +
                                        "return_session=0&" +
                                        "legacy_return=1&" +
                                        "display=&" +
                                        "session_key_only=0&" +
                                        "trynum=1&" +
                                        "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&" +
                                        "lsd=rQ6wM" + "&" +
                                        "email=" + URLEncode(username, true) + "&" +
                                        "pass="******"&" +
                                        "persistent=1&" +
                                        "login=Login";

                        //cWeb.sData = "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&" +
                        //                "locale=en_US&" +
                        //                "email=" + URLEncode(username, true) + "&" +
                        //                "pass="******"&" +
                        //                "persistent=1&" +
                        //                "next=http%3A%2F%2Fapps.facebook.com%2Fmousehunt%2F" + "&" +
                        //                "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&" +
                        //                "lsd=Xh15h";

                        cWeb.Cookie = cCookie;
                        thread = new Thread(new ThreadStart(cWeb.GetCookie));
                        thread.Start();
                        do
                        {
                            Application.DoEvents();
                        }
                        while (thread.IsAlive);
                        cCookie = cWeb.Cookie;
                        if (cCookie == "")
                        {
                            MessageBox.Show(null, "Pikabot was unable to connect to the Internet. Please check your connection and restart Pikabot.", "Login Connection Error.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            //Application.Exit();
                        }
                        txtStatus.Text = "Updating status.";
                        if (txtStatus.Text.Equals("Updating status."))
                        {
                            if (status == 1)
                                status++;
                            break;
                        }
                        else
                        {
                            break;
                        }
                    case 2:
                        cWeb = new clsWeb("http://apps.facebook.com/mousehunt/");
                        //cWeb = new clsWeb("http://www.mousehuntgame.com/canvas/");
                        cWeb.Cookie = cCookie;
                        cWeb.@ref = "http://www.facebook.com/home.php";
                        thread = new Thread(new ThreadStart(cWeb.GetUrl));
                        thread.Start();
                        do
                        {
                            Application.DoEvents();
                        }
                        while (thread.IsAlive);
                        txtStatus.Text = "";

                        if (cWeb.sData.Contains("<title>Hunter&#039;s Camp | MouseHunt on Facebook</title>") ||
                            cWeb.sData.Contains("<title>MouseHunt on Facebook</title>") ||
                            cWeb.sData.Contains("<title>MouseHunt | Hunter&#039;s Camp</title>"))
                        {
                            isLogin = true;
                            HTMLData = cWeb.sData;
                            status = 0;
                            return true;
                        }
                        else
                        {
                            isLogin = false;
                            status = 0;
                            return false;
                        }
                }
            }
            while (!isLogin);

            return isLogin;
        }