تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
اريد شرح مبسط
#1
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 



ايضا كرما شرح هذي السطرين
الرد }}}
تم الشكر بواسطة:
#2
تحتاج لان تخبرنا myConn هذا من اي كلاس ؟؟؟

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

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

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

يجب استخدام Parameters

راجع الرابط في توقيعي
الرد }}}
تم الشكر بواسطة: amer2000
#3
هل من الممكن اخي انس ان ترفق كود جيد لا يمكن تجاوزه

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

فضلا ليس امرا
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [سؤال] اريد طباعة تقرير ريبورت فيو مباشرة فور عرض التقرير mh66 1 565 22-03-25, 09:59 AM
آخر رد: mh66
  اريد كود لو سمحتم خالد كامل1 10 1,229 15-02-25, 02:15 PM
آخر رد: خالد كامل1
  اريد كود معين اثابكم الله خالد كامل1 1 461 04-02-25, 09:28 PM
آخر رد: aliday03
  اريد كود يحذف جميع سجلات جدول بقاعدة بيانات اكسس دفعه واحده khalidalwdi 2 645 18-11-24, 01:02 AM
آخر رد: rdxdz
  اريد جلب عدد محدد من السجلات من قاعدة بيانات اكسس الى الداتا قراد فيو يوجد مثال khalidalwdi 2 673 12-11-24, 12:19 PM
آخر رد: khalidalwdi
  [نقاش] اريد مسااعدة انا مبتدئة ف بحر غارق?? ..N 1 352 29-09-24, 11:16 PM
آخر رد: justforit
Exclamation [VB.NET] اريد كود لتصدير البيانات من DataGridView الى ملف Excel zazasami 1 502 04-08-24, 09:15 PM
آخر رد: mrfenix93
  اريد إحصاء مجموع التأخير والغياب للموظف أبووسم 2 452 31-07-24, 02:16 PM
آخر رد: أبووسم
  اريد طباعة الباركود من غير ظهور نافذة المعاينة new_programer 1 535 23-05-24, 03:55 AM
آخر رد: new_programer
  اريد اضافة حفظ PDF فى مسار على الهارد- مثال الاستاذ عبدالله الدوسري new_programer 1 523 28-04-24, 04:52 PM
آخر رد: new_programer

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم