السلام عليكم ورحمة الله وبركاته
يا شباب انا صممت موقع وكل شي
وبقت لي شغله بسيطة
سويت login
وكل شي بس مو عارف كيف اخلي الموقع لما يدخله احد ما يسمح لشخص ثاني بنفس اليوزر نيم يدخل في نفس الوقت وهذا الكود باحطه لكم
Imports System.Data.OleDb
Partial Class Login
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
If Request.Cookies("users") Is Nothing And Session.Count = 0 Then
tbl.Visible = True
Else
tbl.Visible = False
End If
End If
End Sub
Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim cnn As New OleDbConnection
Dim sqlcommand As New OleDbCommand("select * from accaunt where [user name]='" & txtUserName.Text & "' and password='" & txtPassword.Text & "' and [note for user]='T' ", cnn)
Dim sqlreader As OleDbDataReader
cnn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & Request.MapPath("تحليل.mdb") & " "
cnn.Open()
sqlcommand.Connection = cnn
sqlreader = sqlcommand.ExecuteReader()
' If the user name and password is correct then seesion created
If sqlreader.Read() Then
Dim myCookie As HttpCookie = New HttpCookie("Users")
myCookie("user") = txtUserName.Text
myCookie.Expires = Now.AddHours(1)
Response.Cookies.Add(myCookie)
Session.Item(txtUserName.Text) = txtUserName.Text
Response.Redirect("default.aspx")
Else
' if seesion exist the read session
End If
sqlreader.Close()
cnn.Close()
cnn.Dispose()
End Sub
End Class
ممكن احد يساعدني والله ضروري ولكم الف شكر على مجهودكم