예제 #1
0
def login():
    user=entry1.get()
    user=user.lower()
    pass1=entry2.get()

    try:

        db=sql.connect(host='localhost',user='******',passwd='',db='library')
        cursor=db.cursor()
        query="select id,password from admin where username='******'".format(user)
        cursor.execute(query)
        pass2=cursor.fetchone()
        admin_id=pass2[0]
        
        pass2=pass2[1] 
        if pass1==pass2:
            query="insert into admin_login_details VALUES ('{}',NOW())".format(admin_id)
            cursor.execute(query)
            db.commit()
            db.close()
            root.destroy()
            from admin_panel import admin
            admin()
            
        elif pass1!=pass2:
            messagebox.showinfo('Alert Box','Login Credentials not matched!!')
    except:
        messagebox.showinfo('Alert Box','Error!!')
def return_to_admin(root):
    root.destroy()
    from admin_panel import admin
    admin()
예제 #3
0
 def quit():
     m.destroy()
     ap.admin()