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

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (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=36547)



اريد شرح مبسط - عمور2016 - 28-09-20

PHP كود :
   Private Sub BtnaLogen_Click(sender As ObjectAs EventArgsHandles BtnaLogen.Click
        If txtUserName
.Text "" Then
            MessageBox
.Show("من فضلك ادخل اليوزر نيم""تاكيد"MessageBoxButtons.OKMessageBoxIcon.[Error])
 
           txtUserName.Focus()
 
           Return
        End 
If
 
       If txtPassword.Text "" Then
            MessageBox
.Show("من فضلك ادخل الباسوورد""تاكيد"MessageBoxButtons.OKMessageBoxIcon.[Error])
 
           txtPassword.Focus()
 
           Return
        End 
If
 
       myconn.tbl.Clear()
 
       If rbtnManager.Checked True Then
            myconn
.tbl myconn.readData("select * from Users where User_Name='" txtUserName.Text "' and User_Password='" txtPassword.Text "' and Type='مدير'""")
 
       ElseIf rbtnEmp.Checked True Then
            myconn
.tbl myconn.readData("select * from Users where User_Name='" txtUserName.Text "' and User_Password='" txtPassword.Text "' and Type='مستخدم عادى'""")
 
       End If
 
       myconn.tbl myconn.readData("Select * from Users""")
 
       If myconn.tbl.Rows.Count <= 0 Then
            myconn
.exceuteData("insert into Users values (1,'admin','admin','مدير')"""              '"?????????????????//??????????????????????????
            myconn.exceuteData("insert into Users_Edit Values (1 , 1,1,1,1,1)", "")                     '"?????????????????//??????????????????????????
            myconn.exceuteData("
insert into Users_seting Values (1,1,1,1)", "")                      '"?????????????????//??????????????????????????
 
           myconn.exceuteData("insert into Usres_Add Values (1 , 1,1,1,1)"""                       '"?????????????????//??????????????????????????
            myconn.exceuteData("insert into Usres_Prent Values (1 , 1,1,1,1,1,1)", "")                     '"?????????????????//??????????????????????????
            myconn.exceuteData("
insert into Usres_Restor Values (1,1)", "")                            '"?????????????????//??????????????????????????
 
           myconn.exceuteData("insert into Usres_Sresh Values (1 , 1,1,1,1,1)"""                        '"?????????????????//??????????????????????????
            myconn.tbl.Clear()
        End If
        If rbtnManager.Checked = True Then
            myconn.tbl = myconn.readData("select * from Users where User_Name='" + txtUserName.Text + "' and User_Password='" + txtPassword.Text + "' and Type='
مدير'", "")
        ElseIf rbtnEmp.Checked = True Then
            myconn.tbl = myconn.readData("select * from Users where User_Name='" + txtUserName.Text + "' and User_Password='" + txtPassword.Text + "' and Type='
مستخدم عادى'", "")
        End If
        If myconn.tbl.Rows.Count >= 1 Then
            My.Settings.USERNAME = txtUserName.Text
            My.Settings.Save()
            FrmMain.Show()
            Close()
        Else
            MessageBox.Show("كلمة السر او اسم المستخدم  خطا", "تاكيد", MessageBoxButtons.OK, MessageBoxIcon.[Error])
            Return
        End If

    End Sub 
ارجو  شرح مبسط   على السطر عليه  علامة استفهام؟

PHP كود :
    If rbtnManager.Checked True Then
            myconn
.tbl myconn.readData("select * from Table_1 where usernamez='" txtUserName.Text "' and passwordz='" txtPassword.Text "' and Type='مدير'""")
 
       ElseIf rbtnEmp.Checked True Then
            myconn
.tbl myconn.readData("select * from Table_1 where usernamez='" txtUserName.Text "' and passwordz='" txtPassword.Text "' and Type='مستخدم عادى'""")
 
       End If 



ايضا كرما شرح هذي السطرين


RE: اريد شرح مبسط - Anas Mahmoud - 28-09-20

تحتاج لان تخبرنا myConn هذا من اي كلاس ؟؟؟

ولكن على العموم هو يضيف بيانات الادمن وصلاحياته ، ليس بافضل طريقة ربما

السطرين الاخيرين يقوم فيهما باختبار تسجيل الدخول ، اذا كان اسم المستخدم وكلمة السر مطابقة للموجودة في جدول المستخدمين فان الاستعلام سيعود بشيء والا لن يعود بشيء

وليس هي الطريقة الصحيحة ابدا ايضا ، هذا مثال صارخ على ال Sql injection بحيث يمكن ببساطة تخطي تسجيل الدخول وفعل الاسوا من ذلك بتدمير قاعدة البيانات

يجب استخدام Parameters

راجع الرابط في توقيعي


RE: اريد شرح مبسط - amer2000 - 28-09-20

هل من الممكن اخي انس ان ترفق كود جيد لا يمكن تجاوزه

بحيث يعتمد على الموديول ..اتصال قاعده بيانات SQL server 
Conn

فضلا ليس امرا