منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
تعديل هذا الكود - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : تعديل هذا الكود (/showthread.php?tid=8339)



تعديل هذا الكود - مبتدئ - 05-04-13

كود :
Imports System.Web
Imports System.Net
Imports System.IO
Imports System.Text

Public Class Form1
    Sub login(ByVal email As String, ByVal password As String)
        If txtUserName.Text = String.Empty AndAlso txtPass.Text = String.Empty Then
            MsgBox("Put your email & password", 0, "Input data")
        Else
            Dim postData As String = "email=" & email & "&pass=" & password & ""
            Dim tempcookies As New CookieContainer
            Dim encoding As New UTF8Encoding
            Dim byteData As Byte() = encoding.GetBytes(postData)
            Dim postreq As HttpWebRequest = DirectCast(HttpWebRequest.Create("http://login.uid.me/?site=2newsyu&ref=http://newsyu.at.ua/"), HttpWebRequest)
            postreq.Method = "POST"
            postreq.KeepAlive = True
            postreq.CookieContainer = tempcookies
            postreq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b6pre) Gecko/20100903 Firefox/4.0b6pre"
            postreq.ContentType = "application/x-www-form-urlencoded"
            postreq.Referer = "http://login.uid.me/?site=2newsyu&ref=http://newsyu.at.ua/"
            postreq.ContentLength = byteData.Length
            Dim postreqstream As Stream = postreq.GetRequestStream()
            postreqstream.Write(byteData, 0, byteData.Length)
            postreqstream.Close()
            Dim postresponse As HttpWebResponse
            postresponse = DirectCast(postreq.GetResponse, HttpWebResponse)
            tempcookies.Add(postresponse.Cookies)
            Dim logincookie
            logincookie = tempcookies
            Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
            Dim thepage As String = postreqreader.ReadToEnd
            If thepage.Contains("Incorrect email/password combination") = True Then
                MsgBox("Incorrect email/password combination", 0, "Login error!")
            Else
                MsgBox("Logged in", 0, "Success!")
            End If
            If thepage.Contains("You have exceeded the number of invalid login attempts that we allow for your account") = True Then
                MsgBox("You have exceeded the number of invalid login attempts", 0, "Max number of wrong logins")
            End If
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        login(txtUserName.Text, "12312332112123")
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        login(txtUserName.Text, txtPass.Text)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Start()
    End Sub
End Class
المشكلة اذا كان الاميل خطأ بيظهر رسالة Login اريد اذا كان الاميل ليس متسجل فى الموقع يظهر خطأ اما اذا كان متسجل يظهر تم بنجاح تسجيل الدخول شكرآ هذا هو الموقع
http://newsyu.at.ua/