def menudrive(self): print("1. Admin \n 2. register") choice = int(input("enter the choice")) if choice == 1: admin().adetails() if choice == 2: register().reg()
def home(): window= tk.Tk() opt = '' print(" Choose your role") print(" For admin : 1") print(" For User: 2 ") print("....................") opt = input("Enter appropraite number:--->") window.destroy() print("---------------------------------") if opt == '1': print(" You have to enter your admin id and password ") id = input("id:---->") password = input("password :---->") if id == 'gautam591' and password == '123456': print(" You ahve logged in successfully") print(".....................") admin.admin() else: print("You entered wrong details please try again ") home() elif opt == '2': user.menu() else: print("Choose at least one option for our service ") home()
def check(): if mdp.get() == "ADMIN": admin(user.get()) elif mdp.get() == "JOBSEEKER": client(user.get()) else: messagebox.showwarning(" \n mot de passe incoreect \n") #Label(f,text="mot de passe incorrect",fg="red").pack() mdp.set("")
def main(): student1 = student("John Smith", "*****@*****.**") student2 = student("Name Surname Suffix", "*****@*****.**", False) admin1 = admin("Joe Admin", "*****@*****.**") admin2 = admin("root", "root@localhost", False) placeholder = person("", "") #desired output is commented next to each print statement print("Testing get name from student") print(student1.get_name()) #John Smith print(student2.get_name()) #Name Surname Suffix print("Testing get name from admin") print(admin1.get_name()) #Joe Admin print(admin2.get_name()) #root print("Testing get name from person") placeholder = student1 #John Smith print(placeholder.get_name()) placeholder = student2 #Name Surname Suffix print(placeholder.get_name()) placeholder = admin1 #Joe Admin print(placeholder.get_name()) placeholder = admin2 #root print(placeholder.get_name()) print("") print("Testing get email from student") print(student1.get_email()) #[email protected] print(student2.get_email()) #[email protected] print("Testing get email from admin") print(admin1.get_email()) #[email protected] print(admin2.get_email()) #root@localhost print("Testing get email from person") placeholder = student1 print(placeholder.get_email()) #[email protected] placeholder = student2 print(placeholder.get_email()) #[email protected] placeholder = admin1 print(placeholder.get_email()) #[email protected] placeholder = admin2 print(placeholder.get_email()) #root@localhost print("") print("Testing get attendance from student") print(student1.get_attendance()) #True print(student2.get_attendance()) #False print("") print("Testing get request from admin") print(admin1.get_admin_request()) #True print(admin2.get_admin_request()) #False
def ATMsystem(): while True: admin1 = admin('ADMIN', '123') m = admin1.login() if m == 'ok': filepath = os.path.join(os.getcwd(), 'AllUserlist.txt') f = open(filepath, 'rb') Userlist = pickle.load(f) f.close() ATM1 = ATM(Userlist) print('ATM系统当前账户有:') print([x for x in ATM1.userlist]) print('正在进入ATM系统界面!请稍候...') time.sleep(2) while True: admin1.choiceUI() c = input('请输入功能选项:') if c == '1': #建户 ATM1.creataccount() time.sleep(2) elif c == '2': ATM1.serach() time.sleep(2) elif c == '3': ATM1.savemoney() time.sleep(2) elif c == '4': ATM1.reducemoney() time.sleep(2) elif c == '5': ATM1.transfer() time.sleep(2) elif c == '6': ATM1.changepassword() time.sleep(2) elif c == '7': ATM1.lock() time.sleep(2) elif c == '8': ATM1.unlock() time.sleep(2) elif c == '9': ATM1.deleteAccount() time.sleep(2) elif c == 'Q': filepath = os.path.join(os.getcwd(), 'AllUserlist.txt') f = open(filepath, 'wb') pickle.dump(ATM1.userlist, f) f.close() print('正在保存用户信息并退出!请稍候...') time.sleep(1) print('退出至管理员登录界面成功!') break else: print('输入有误,请重新输入!') time.sleep(1) if m == 'exit': print('正在退出程序!请稍候...') time.sleep(2) break
def Login(self, event): a = self.rbox.GetStringSelection() if a == "管理员": if self.pd(self.userText.GetValue(), self.passText.GetValue(), a): ui = admin(self.userText.GetValue()) ui.frame() self.loginFrame.Close() else: wx.MessageBox('用户名或密码错误', 'error', wx.OK | wx.ICON_ERROR) self.userText.SetValue("") self.passText.SetValue("") elif a == "教师": if self.pd(self.userText.GetValue(), self.passText.GetValue(), a): ui = teacher(self.userText.GetValue()) ui.frame() self.loginFrame.Close() else: wx.MessageBox('用户名或密码错误', 'error', wx.OK | wx.ICON_ERROR) self.userText.SetValue("") self.passText.SetValue("") else: if self.pd(self.userText.GetValue(), self.passText.GetValue(), a): ui = student(self.userText.GetValue()) ui.frame() self.loginFrame.Close() else: wx.MessageBox('用户名或密码错误', 'error', wx.OK | wx.ICON_ERROR) self.userText.SetValue("") self.passText.SetValue("")
def login(self): try: self.db = MySQLdb.connect("127.0.0.1", "root", "root", "customs") except: start_server() self.db = MySQLdb.connect("127.0.0.1", "root", "root", "customs") try: username = self.box1.get() password = self.box2.get() cursor = self.db.cursor() sql = "SELECT * FROM admin where username='******' && pword='%s'" % ( username, password) cursor.execute(sql) result = cursor.fetchall() self.db.close() if len(result) > 0: self.parent.destroy() root = tk.Tk() if username != "admin": app = MainApp(root) else: app = admin(root) root.mainloop() else: self.status.set(u"Login Failed") except: self.status.set(u"Launch MySQL Server First")
def displayy(self): import admin self.objadmin = admin.admin() self.objadmin.show() self.close()
def login(): """ 登陆模块 :return: """ login_status = 0 user_name = input("请输入用户名:").strip() user_pwd = input("请输入密码:").strip() hash = hashlib.md5() hash.update(bytes(user_pwd, encoding='utf-8')) with open(r'../data/info.txt', 'r', encoding='utf-8') as f: ret = f.readline() while ret: ret = ret.strip('\n') ret = eval(ret) if user_name == ret['name']: if str(hash.hexdigest()) == ret['passwd']: print("登陆成功") # 登录写入日志 with open('../log/login.txt', mode='a', encoding='utf-8') as f1: f1.write( "{} 用户{}登录成功了\n".format( time.strftime("%Y-%m-%d %X"), user_name)) if ret['level'] == 1: user1 = student.student( ret['name'], ret['passwd'], ret['level'], ret['subject'], ret['class_grade'], ret['lecturer']) login_status = 1 return user1, login_status elif ret['level'] == 2: user1 = teacher.teacher( ret['name'], ret['passwd'], ret['level'], ret['subject'], ret['class_grade'], ret['lecturer']) login_status = 1 return user1, login_status else: user1 = admin.admin( ret['name'], ret['passwd'], ret['level'], ret['subject'], ret['class_grade'], ret['lecturer']) login_status = 1 return user1, login_status ret = f.readline() if login_status == 0: print('用户不存在或者密码错误') return [], 0
def lineReceived(self, line): print("Line Recieved: " + line) information_sent = pickle.loads(line) print information_sent task = information_sent['task'] if task == 'LOGIN_SUCCESS': self.state = 'AUTH' exists, self.one_dir_path = retrieve_local_onedir(self.username) self.options() elif task == 'GET_DIFFERENT_USERNAME': print("That username has already been taken") self.create_username() elif task == 'GET_NEW_USER_PASSWORD': self.create_new_user_password() elif task == 'LOGIN_SUCCESS': self.state = 'AUTH' self.determine_if_auto_sync_on_or_off() self.options() elif task == 'LOGIN_FAIL': self.handle_login_fail() elif task == 'CREATE_ONEDIR': self.create_onedir(information_sent) self.state = 'AUTH' self.determine_if_auto_sync_on_or_off() self.options() elif task == 'RUN_FILE_DETECTION': self.tell_server_to_update_onedir() elif task == 'LOGOUT_SUCCESS': print 'Successfully Logged out!' self.logout() elif task == 'LOGOUT_FAIL': print 'Logout failed!' self.options() elif task == 'CHANGE_PASWD_SUCCESS': print 'Password Changed' self.options() elif task == 'CHANGE_PASWD_FAIL': print 'Password not successfully changed' self.options() elif task == 'OPTIONS': self.options() #elif task == 'RUN_FILE_DETECTION': #self.determine_if_auto_sync_on_or_off() #self.tell_server_to_update_onedir() #self.run_watchdog(self.process) elif task == 'RUN_FILE_DETECTION': self.tell_server_to_update_onedir() elif task == 'ADMIN_LOGGED_IN': ad = admin() result = ad.main() if result: self.connectionMade() else: print self.one_dir_path print information_sent _, self.one_dir_path = retrieve_local_onedir(self.username) update_directory(self.one_dir_path, information_sent)
def privmsg(self, ident, channel, msg): if not ident: return try: msg = msg.decode("utf-8") except UnicodeDecodeError as ue: self.log("Received non-unicode message") return isAdmin = False if msg.startswith('!'): # It's a command to RepBot itself msg = msg[1:] elif channel != self.cfg["nick"] and msg.startswith(self.cfg["nick"] + ":"): # It's a command to RepBot itself msg = msg[len(self.cfg["nick"]) + 1:].strip() elif self.hasadmin(ident) and channel == self.cfg["nick"]: # They have admin access, check for commands if msg.startswith("admin"): msg = msg.replace("admin", "", 1) elif msg.startswith("@"): msg = msg[1:] else: return isAdmin = True elif get_rep_change(msg) == None: # It doesn't match a rep change return user = ident_to_name(ident) if self.ignores(ident) and not self.hasadmin(ident): self.msg( user, "You have been blocked from utilizing my functionality.") if self.cfg["spy"]: self.log("[{1}]\t{0}:\t{2}".format(ident, channel, msg)) if isAdmin: admin.admin(self, user, msg) elif channel == self.cfg["nick"] or not self.cfg["privonly"]: # I'm just picking up a regular chat # And we aren't limited to private messages only self.repcmd(user, channel, msg)
def new_namespace(self, context=None): user = getSecurityManager().getUser() return dict(__doc__=None, self=self, context=context, utils=admin(self), userid=user.getId(), acl_users_path=user.aq_parent.getPhysicalPath(), login=self.login, )
def application(env: tp.Dict[str, tp.Any], start_response: tp.Callable[..., None]) -> tp.List[tp.Any]: """ uWSGI entry point Manages HTTP request and calls specific functions for [GET, POST] Args: env: HTTP request environment - dict start_response: HTTP response headers function Returns: data: which will be transmitted """ # Parse query string query = dict(urllib.parse.parse_qsl(env['QUERY_STRING'])) # Parse cookie raw_json = env.get('HTTP_COOKIE', '') cookie_obj = SimpleCookie() cookie_obj.load(raw_json) # Even though SimpleCookie is dictionary-like, it internally uses a Morsel object # which is incompatible with requests. Manually construct a dictionary instead. cookie = {} for key, morsel in cookie_obj.items(): cookie[key] = morsel.value status = '200 OK' headers = [] data = [] # Manage admin actions if env['PATH_INFO'][:6] == '/admin': status, headers, data = admin(env, query, cookie) # Main methods elif env['REQUEST_METHOD'] == 'GET': status, headers, data = get(env, query, cookie) elif env['REQUEST_METHOD'] == 'POST': status, headers, data = post(env, query, cookie) elif env['REQUEST_METHOD'] == 'OPTIONS': status = '200 OK' headers = [ ('Access-Control-Allow-Origin', '*'), ('Access-Control-Allow-Methods', 'GET, POST, HEAD, OPTIONS'), ('Access-Control-Allow-Headers', '*'), ('Allow', 'GET, POST, HEAD, OPTIONS' ) # TODO: Add content application/json ] # Setup request status and headers start_response(status, headers) return data
def check(name,password): conn=sqlite3.connect('login.db') cur = conn.cursor() if (cur.execute('SELECT * FROM admin WHERE name =? AND password = ?',(name,password))): if cur.fetchone(): window = Tk() window.title('Admin_User') window.geometry('700x450') obj=admin(window) window.mainloop() else: messagebox.showinfo('error','INVALID CREDENTIALS for ADMIN LOGIN')
def new_namespace(self, context=None): user = getSecurityManager().getUser() return dict( portal_path=self.aq_parent.getPhysicalPath(), __name__="__zope_debug__", __doc__=None, self=self, context=context, utils=admin(self), userid=user.getId(), acl_users_path=user.aq_parent.getPhysicalPath(), )
def check(name,password):#checking for valid credentails and allowing admin to proceed further conn=sqlite3.connect('lms.db') cur = conn.cursor() if (cur.execute('SELECT * FROM admin WHERE name =? AND password = ?',(name,password))): if cur.fetchone(): window = Tk() window.title('Admin') window.geometry('700x450') obj=admin(window) window.mainloop() else: messagebox.showinfo('error','Invalid details for admin login')
def home(): print("Welcome To Python Bank") while True: print("""\n\n\nPress 1 to access your account Press 2 to open new account Press 3 for admin login Press 4 to exit""") try: usr_ch = int(input('>> ')) if usr_ch == 1: access.acc() elif usr_ch == 2: create.create_acc() elif usr_ch == 3: admin.admin() elif usr_ch == 4: exit.ext() break else: print('Wrong Choice!!') except ValueError: print('invalid choice') continue
def loginWindow(): root = login.Login() root.update() root.mainloop() if (login.Login.user == "admin"): window = admin.admin() window.update() window.mainloop() elif (login.Login.user == "student"): window = student.student() window.update() window.mainloop() login.Login.user = "******" if (login.Login.userloggedout): loginWindow()
def __init__(self): self.librarian_list = [] self.book_list = [] self.student_list = [] self.issued_books_list = [] self.admin = admin() self.librarian_list.append( librarian("Omar", "Shahen77", "*****@*****.**", "Moustafa Kamel", "Alexandria", "01065630331")) self.librarian_list.append( librarian("Ahmed", "Ahmed77", "*****@*****.**", "Smouha", "Alexandria", "01006615471")) self.librarian_list.append( librarian("Youssef", "Youssef77", "*****@*****.**", "Abo 2ER", "Cairo", "01111185001")) self.book_list.append(book("The 10X Rule", "Grant Cardone", "VIP", 7)) self.book_list.append(book("The 5 AM Club", "Robin Sharma", "VIP", 5)) self.book_list.append(book("Power of habbit", "Reda", "VIP", 1))
def setup_admin(): #vars admin_name = "" admin_email = "" admin_bool = True #setting up optional email to administrators boolval = raw_input("Would you like to send the cumulative absence statistics to an admisistrator? (Y or N): ") boolval = boolval.lower() if boolval == "y": adminName = raw_input("Please enter Administrators name: ") admin_name = adminName adminEmail = raw_input("Please enter Administrators email: ") admin_email = adminEmail elif boolval == "n": admin_bool = False else: while boolval != "y" and boolval != "n": boolval = str(raw_input("Please enter a valid character (Y or N): ")) boolval = boolval.lower() return admin(admin_name, admin_email, admin_bool)
def handle(msg): print(msg) global all_ques_of_type global my_user content_type, chat_type, chat_id = telepot.glance(msg) print('Chat Message:', content_type, chat_type, chat_id) if(msg['text'] == '/admin'): entry_user_pass(telegrambotapi,chat_id) admin.admin.import_questions(telegrambotapi,chat_id) elif(msg['text'] == '/import_admin'): import_admin() elif content_type == 'text': my_admin = admin.admin() if(msg['text'] != '/get_export'): my_user = my_admin.display_questions_check_answers(telegrambotapi,chat_id,msg) elif(msg['text'] == '/get_export'): my_admin.get_export(telegrambotapi,msg,chat_id,my_user) print('=+=+=+=+=+=+=+=+=+=+')
def login(theform, userdir, thisscript=None, action=None): #print 'Content-type: text/plain\n\nxxxxxxxxxxxxxxxxxxxx',"error in projects:",type(action),action.encode("utf-8") """From the form decide which function to call.""" # FIXME: this function got a bit more complicated than intended # it also handles checking logins when editaccount or admin # functions are being called. br = False loginaction = '' if thisscript is None: thisscript = THISSCRIPT # # used so that we can tell if we have a genuinely empty action # or not later on.... action = sortaction(theform.getfirst('action') or action) # # let's work out what we're supposed - if nothing is specified we'll just # check if we have a valid login and then return try: loginaction = theform['login'].value except KeyError: # this function displays login and exits if there is no valid login action, userconfig, newcookie = checklogin(userdir, thisscript, action) # break - means go straight to the end br = True # # dologin is special # it can be called by functions here - they may require a user to login before continuing. # So if we are returning from a login - we may need to go onto another function if loginaction.startswith('login'): action, userconfig, newcookie = dologin(theform, userdir, thisscript, action) # this function displays login and exits if username doesn't exist or password doesn't match # if this function returns, then the login attempt was succesful userconfig['numlogins'] = str(int(userconfig['numlogins']) + 1) # increment the number of logins in the user config userconfig.write() if action[:11] == 'edacc-mjf||': loginaction = 'editaccount' elif action[:11] == 'admin-mjf||': loginaction = 'admin' else: br = True # this is the list of possible actions # they must either call sys.exit() or return action, userconfig, newcookie # functions which can be called without an explicit checklogin must do their own first (to get the new cookie header) - e.g. admin and edit account (otherwise you could access them without being logged in) # if we have already done all this, then br will be set to True if br: pass elif loginaction == 'showlogin': displaylogin(userdir, thisscript) elif loginaction == 'logout': # this means a logout link can be implemented as myscript.py?login=logout print logout(userdir) # this prints the empty cookie displaylogin(userdir, thisscript) # we don't use 'action' in this case because user has explicitly logged out, outstanding action is lost. elif loginaction == 'newlogin': from newlogin import newlogin newlogin(userdir, thisscript, action) # this script always exits - so no return, preserves action though if needed elif loginaction.startswith('donewlogin'): from newlogin import donewlogin donewlogin(theform, userdir, thisscript, action) # this script always exits - so no return, preserves action though if needed elif loginaction == 'confirm': from newlogin import confirm action, userconfig, newcookie = confirm(theform, userdir, thisscript) # no action sent in, because the action is stored in the temporary user store userconfig['created'] = str(time()) elif loginaction.startswith('editaccount'): from newlogin import editaccount if action[:11] != 'edacc-mjf||': action, userconfig, newcookie = checklogin(userdir, thisscript, 'edacc-mjf||' + action) action = action[11:] if not istrue(userconfig['editable']): error('Sorry, this account cannot be edited.') editaccount(userdir, thisscript, userconfig, sortaction(action), newcookie) # we have checked that we have a valid login. This script prints a page, so no return elif loginaction.startswith('doeditaccount'): from newlogin import doeditaccount action, userconfig, newcookie = checklogin(userdir, thisscript, action) if not istrue(userconfig['editable']): error('Sorry, this account cannot be edited.') action, userconfig, newcookie = doeditaccount(theform, userconfig, userdir, thisscript, sortaction(action), newcookie) # we have checked that we have a valid login elif loginaction == 'admin': from admin import admin if action[:11] != 'admin-mjf||': action, userconfig, newcookie = checklogin(userdir, thisscript, 'admin-mjf||' + action) action = action[11:] adminlevel = int(userconfig['admin']) if not adminlevel: error("You're not authorised to do that. Sorry.") action, userconfig, newcookie = admin(theform, userdir, thisscript, userconfig, sortaction(action), newcookie) # we have checked that we have a valid login. else: displaylogin(userdir, thisscript, action) # we haven't understood - just display the login screen XXXX error message instead ? print newcookie # XXXX ought to be a way of returning the cookie object instead... if action == 'EMPTY_VAL_MJF': # the programmer ought never to 'see' this value, although it might get passed to his script by the login code a few times.... action = None userconfig['lastused'] = str(time()) userconfig['numused'] = str(int(userconfig['numused']) + 1) userconfig.write() return action, userconfig
from interpretor import interpretor from configurer import configurer from evaluator import evaluator from admin import admin itp=interpretor('localhost',27017) config=configurer(itp) eva=evaluator(itp) ad=admin(eva,config) """This script performs a complete test of our Python+MongoDB OrBAC single Tenant implementation""" """Test Scenario 1. we start from zero having a tenant called "apple" 2. we insert all administrative views including: srole,activity,view,role_assignment,activity_assignment,licence,cross_licence 3. we initialize it with assigning "John" to subject, "admin" to role, insert delete to action, insertActivity, deleteActivity and manage to activity and the first licence " John is permitted to manage licence in apple, also "nominal" to context 4. we then use John to create licences for himself for all administrative views, then use John to create different users,actions, resources and assign them to different abstract roles,activities,views 5. use John to assign users privileges 6. use John to assign admin privileges to someone """ """1. we start from zero having a tenant called apple""" #create tenant config.CreateTenant('null','apple') """2. we insert all administrative views including: subject,action,object,role,activity,view,role_assignment,activity_assignment,licence """ #create administrative views config.AssignView('null','apple',{'_id':'context','attr':{}}) config.AssignView('null','apple',{'_id':'role','attr':{}})
elif member == "NO Member" and name == "NO Member": print("There's no any member !") input("Press any key to leave") else : homepage.homepage(member,name) if count >= 3 : print("You Enter too many times !") input("Press any key to leave") elif choice == str(3) : check_admin = 0 while check_admin < 3: account,password = menu.admin_menu() if account == "0000" and password == "0000": break else : pass check_admin = check_admin + 1 if check_admin >=3 : print("You Enter too many times !") input("Press any key to leave") else : print("Congrats, Entering ...") time.sleep(1) admin.admin() elif choice == str(4): break else : print("You type the wrong number !") input("Press any key to continue ~")
height=1, width=15, command=lambda: manager.manager(root)) b2.place(x=750, y=20) b3 = Button(root, bg="firebrick4", fg="white", text='EMPLOYEE', font="Bold 10", pady=3.0, relief=FLAT, height=1, width=15, command=lambda: employee.employee(root)) b3.place(x=900, y=20) b4 = Button(root, bg="firebrick4", fg="white", text='ADMIN', font="Bold 10", pady=3.0, relief=FLAT, height=1, width=15, command=lambda: admin.admin(root)) b4.place(x=1050, y=20) root.mainloop()
def admin(self, user, msg): admin.admin(self, user, msg)
def login(theform, userdir, thisscript=None, action=None): """From the form decide which function to call.""" # FIXME: this function got a bit more complicated than intended # it also handles checking logins when editaccount or admin # functions are being called. br = False loginaction = '' if thisscript is None: thisscript = THISSCRIPT # # used so that we can tell if we have a genuinely empty action # or not later on.... action = sortaction(theform.getfirst('action') or action) # # let's work out what we're supposed - if nothing is specified we'll just # check if we have a valid login and then return try: loginaction = theform['login'].value except KeyError: # this function displays login and exits if there is no valid login action, userconfig, newcookie = checklogin(userdir, thisscript, action) # break - means go straight to the end br = True # # dologin is special # it can be called by functions here - they may require a user to login before continuing. # So if we are returning from a login - we may need to go onto another function if loginaction.startswith('login'): action, userconfig, newcookie = dologin(theform, userdir, thisscript, action) # this function displays login and exits if username doesn't exist or password doesn't match # if this function returns, then the login attempt was succesful userconfig['numlogins'] = str(int(userconfig['numlogins']) + 1) # increment the number of logins in the user config userconfig.write() if action[:11] == 'edacc-mjf||': loginaction = 'editaccount' elif action[:11] == 'admin-mjf||': loginaction = 'admin' else: br = True # this is the list of possible actions # they must either call sys.exit() or return action, userconfig, newcookie # functions which can be called without an explicit checklogin must do their own first (to get the new cookie header) - e.g. admin and edit account (otherwise you could access them without being logged in) # if we have already done all this, then br will be set to True if br: pass elif loginaction == 'showlogin': displaylogin(userdir, thisscript) elif loginaction == 'logout': # this means a logout link can be implemented as myscript.py?login=logout print logout(userdir) # this prints the empty cookie displaylogin(userdir, thisscript) # we don't use 'action' in this case because user has explicitly logged out, outstanding action is lost. elif loginaction == 'newlogin': from newlogin import newlogin newlogin(userdir, thisscript, action) # this script always exits - so no return, preserves action though if needed elif loginaction.startswith('donewlogin'): from newlogin import donewlogin donewlogin(theform, userdir, thisscript, action) # this script always exits - so no return, preserves action though if needed elif loginaction == 'confirm': from newlogin import confirm action, userconfig, newcookie = confirm(theform, userdir, thisscript) # no action sent in, because the action is stored in the temporary user store userconfig['created'] = str(time()) elif loginaction.startswith('editaccount'): from newlogin import editaccount if action[:11] != 'edacc-mjf||': action, userconfig, newcookie = checklogin(userdir, thisscript, 'edacc-mjf||' + action) action = action[11:] if not istrue(userconfig['editable']): error('Sorry, this account cannot be edited.') editaccount(userdir, thisscript, userconfig, sortaction(action), newcookie) # we have checked that we have a valid login. This script prints a page, so no return elif loginaction.startswith('doeditaccount'): from newlogin import doeditaccount action, userconfig, newcookie = checklogin(userdir, thisscript, action) if not istrue(userconfig['editable']): error('Sorry, this account cannot be edited.') action, userconfig, newcookie = doeditaccount(theform, userconfig, userdir, thisscript, sortaction(action), newcookie) # we have checked that we have a valid login elif loginaction == 'admin': from admin import admin if action[:11] != 'admin-mjf||': action, userconfig, newcookie = checklogin(userdir, thisscript, 'admin-mjf||' + action) action = action[11:] adminlevel = int(userconfig['admin']) if not adminlevel: error("You're not authorised to do that. Sorry.") action, userconfig, newcookie = admin(theform, userdir, thisscript, userconfig, sortaction(action), newcookie) # we have checked that we have a valid login. else: displaylogin(userdir, thisscript, action) # we haven't understood - just display the login screen XXXX error message instead ? print newcookie # XXXX ought to be a way of returning the cookie object instead... if action == 'EMPTY_VAL_MJF': # the programmer ought never to 'see' this value, although it might get passed to his script by the login code a few times.... action = None userconfig['lastused'] = str(time()) userconfig['numused'] = str(int(userconfig['numused']) + 1) userconfig.write() return action, userconfig
import os import subprocess import fileManager import time import fileTransfer import admin FM = fileManager.fileManager() FT = fileTransfer.fileTransfer() AD = admin.admin() class runner: def welcome(): """Functions that automatically desplays hello that is generated in ASCii """ os.system('clear') print(" _________ _____ ") print("| | | | | / \ ") print("| | | | | / \ ") print("|--------| | -------- | | | | ") print("| | | | | \ / ") print("| | |_________ |_________ |_________ \ _____ / ") print("") print("-------------------------------------------------------------") print("") def mainMenu(): """This is the function that creates deals with interaction with the user, It uses the functions from the other utilities file. (FileTransfer.py and FileManager.py) """ option = input(
def get(self): self.write(admin.admin(self))
def findadminpage(url): admin.admin(url)
# -*- coding: utf-8 -*- """ Created on Fri May 4 11:02:25 2018 @author: ADITYA """ import customer, admin a = customer.acc_query() ad = admin.admin() while 1: print( "\n\n**** WELCOME TO PUPPO BANK **** \n \n\t1-->Login \n\t2-->Sign up \n\t3-->Admin Login \n\t4-->Admin Sign up \n\t5-->Exit" ) ch = int(input("Enter your choice :")) if ch == 1: a.login() elif ch == 2: a.write_rec() elif ch == 3: ad.login() elif ch == 4: ad.write_rec() elif ch == 5: break else: print("\n Invalid option \n Please Try again")
def getAdmin(): #获取admin类,调用admin类的方法 admins = admin.admin() return admins
def user_name(self): print("Current user is " + self.first_name + " " + self.last_name) def greeting(self): print("hello " + self.first_name + " " + self.last_name + "!") class admin(user): def __init__(self, first_name, last_name): super().__init__(first_name, last_name) self.privileges = "can delete post" def show_privileges(self): print(self.first_name + " " + self.privileges) admin1 = admin('Wei', 'Wang') admin1.user_name() admin1.greeting() admin1.show_privileges() # In[41]: class user(): def __init__(self, first_name, last_name): self.first_name = first_name self.last_name = last_name def user_name(self): print("Current user is " + self.first_name + " " + self.last_name)
from sync_from_file import * from user import user from admin import admin if __name__ == '__main__': try: while True: print("1.User") print("2.Admin") print("3.Exit") choice = check("Enter the Option", 3) if choice == 1: user() elif choice == 2: admin() else: break except Exception as ex: print(ex)
def main(): while True: print(" ______________________________________________________________________ ") print("|-------------------------SMART HEALTH CARE SYSTEM---------------------|") print("| |") print("| 1. ADMIN LOGIN |") print("| 2. DOCTOR LOGIN |") print("| 3. PATIENT REGISTRATION WINDOW |") print("| 4. EXISTING USER |") print("| 5. RESET PASSWORD |") print("| 6. EMERGENCY |") print("| 7. Exit |") print("|______________________________________________________________________|") print("| PLEASE MAKE A SELECTION:... ") x = int(input()) if x == 1: aa = 1 while aa <= 3: pswrd = input("Enter password: "******" __________________________________________________________________________ ") print("|--------------------WELCOME TO ADMINISTRATIVE MODE------------------------|") print("| |") print("| 1. VIEW ALL DOCTORS |") print("| 2. VIEW ALL PATIENTS |") print("| 3. ASSIGN DOCTORS |") print("| 4. ADD DOCTORS |") print("| 5. DATABASE MANAGEMENT |") print("| 6. DELETE DOCTOR |") print("| 7. LOGOUT |") print("|__________________________________________________________________________|") ch = int(input("Enter your choice:")) a1 = admin() if ch == 1: a1.getdoctors() elif ch == 2: a1.getpatients() elif ch == 3: a1.assigndoctor() print("AUTOMATIC ASSIGNMENT SUCCESSFUL") elif ch == 4: a1.adddoctor() elif ch == 5: print(" __________________________________________________________________________ ") print("|-------------------------DATABASE MANAGEMENT WINDOW-----------------------|") print("| |") print("| 1. PATIENT'S PERSONAL DETAILS |") print("| 2. PATIENT'S MEDICAL HISTORY |") print("| 3. DOCTOR'S PERSONAL DETAILS |") print("| 4. DOCTOR'S PROFESSIONAL DETAILS |") print("| 5. HOD MANAGEMENT |") print("| 6. RETURN TO PREVIOUS PAGE |") print("| 7. LOGOUT |") print("|__________________________________________________________________________|") x = int(input("Enter your choice:.....")) if x == 1: p1=p() p1.editpatient() elif x == 2: print(" __________________________________________________________________________ ") print("|----------------PATIENT'S MEDICAL HISTORY EDIT WINDOW---------------------|") print("| |") print("| 1. EDIT PATIENT'S PRESCRIPTION |") print("| 2. EDIT PATIENT'S PAST REPORTS |") print("| 3. RETURN TO PREVIOUS PAGE |") print("|__________________________________________________________________________|") xx = int(input("Enter your choice:.....")) pmr1 = pmr() if xx == 1: pmr1.setpateientpres() elif xx == 2: pmr1.setpatienthistory() elif xx == 3: print("RETURNING TO PREVIOUS PAGE...PLEASE WAIT..") for i in range(1, 30000000): pass continue else: print("| WRONG CHOICE ENTERED..PLEASE TRY AGAIN") continue elif x == 3: doc2=doc() d1 = dpd() doc2.editdetail(d1) elif x == 4: doc3 = doc() d2 = ddd() doc3.editdocprofdetail(d2) elif x == 5: print(" __________________________________________________________________________ ") print("|----------------------HOD MANAGEMENT EDIT WINDOW--------------------------|") print("| |") print("| 1. HOD ASSIGNMENT |") print("| 2. VIEW HOD LIST |") print("| 3. RETURN TO PREVIOUS PAGE |") print("|__________________________________________________________________________|") hod1 = hod() xx = int(input("Enter your choice:.....")) if xx == 1: hod1.sethod() elif xx == 2: hod1.gethodall() elif xx == 3: print("RETURNING TO PREVIOUS PAGE...PLEASE WAIT..") for i in range(1, 30000000): pass continue else: print("| WRONG CHOICE ENTERED..PLEASE TRY AGAIN") continue elif x == 6: print("RETURNING TO PREVIOUS PAGE...PLEASE WAIT..") for i in range(1, 30000000): pass continue elif x == 7: print("| LOGGING OUT...PRESS ANY KEY TO CONTINUE..!") a = input("") sys.exit() else: print("| WRONG CHOICE ENTERED..PLEASE TRY AGAIN") continue elif ch == 6: a1.deletedoctor() elif ch == 7: print("| LOGGING OUT...PRESS ANY KEY TO CONTINUE..!") a = input("") sys.exit() else: print("| WRONG CHOICE ENTERED..PLEASE TRY AGAIN") continue else: if aa != 3: print("| ERROR:...TRY AGAIN...!") print(3 - aa, "CHANCES LEFT") aa = aa + 1 else: print("LIMIT EXCEEDED") aaa = input("PRESS ANY KEY TO EXIT") sys.exit() elif x == 2: aa = 1 while aa <= 3: print(" __________________________________________________________________________ ") print("|------------------------------DOCTOR's LOGIN WINDOW-----------------------|") a1 = admin() name = input("| USER ID:..") pswrd = input("| PASSWORD:..") doc4 = doc() y = a1.doctorlogin(name, pswrd) if y == 0: # if(cursor.execute("SELECT ID FROM `db`.`admin` where ID='" + d_id + "' AND Password='******';") != None): if aa != 3: print("| ERROR:...TRY AGAIN...!") print(3 - aa, "CHANCES LEFT") aa = aa + 1 else: print("LIMIT EXCEEDED") aaa = input("PRESS ANY KEY TO EXIT") sys.exit() else: cursor.execute("SELECT count(D_DID) FROM `db`.`doctor_professional_details` where BINARY D_DID='" + name + "' and BINARY D_Type='HOD';"); yyy=cursor.fetchone() ppp=int(yyy[0]) print(ppp) if (ppp>0): while True: h1 = h() print(" __________________________________________________________________________ ") print("|----------------------------WELCOME TO HOMEPAGE---------------------------|") print("| |") print("| 1. SEE PATIENT ALLOCATED |") print("| 2. EDIT PROFILE |") print("| 3. VIEW PROFILE |") print("| 4. PATIENT VIEWED |") print("| 5. REFERRAL |") print("| 6. HOD TASKS |") print("| 7. LOGOUT |") print("|__________________________________________________________________________|") x = int(input("Enter your choice:.....")) if x == 1: print(" __________________________________________________________________________ ") print("|----------------------------PATIENT VIEW TYPE-----------------------------|") print("| |") print("| 1. SORT BY PATIENT ID |") print("| 2. NORMAL VIEW |") print("| 3. VIEW HISTORY |") print("|__________________________________________________________________________|") xx = int(input("Enter your choice:.....")) if xx==1: cursor.execute("SELECT * FROM `mydb`.`doctor_assignment` where DOC_ID = '" + name + "' ORDER BY PAT_ID;") print(cursor.fetchall()) elif xx==2: h1.getpatientsallocated(name) elif xx == 3: pmr1 = pmr() pmr1.viewhistory(name) else: pass elif x == 2: doc4 = doc() d1 = dpd() doc4.editdetail(d1) elif x == 3: h1.getdoctordetail(name) elif x == 4: doc4.patientviewed(name) elif x == 5: print(" __________________________________________________________________________ ") print("|------------------------DOCTOR'S REFERRAL WINDOW--------------------------|") h1 = h() p1 = p() h1.referpatients(name,p1) elif x == 6: print(" __________________________________________________________________________ ") print("|---------------------------HOD'S TASK WINDOW------------------------------|") print("| |") print("| 1. SET DOCTOR'S OPD TIMINGS |") print("| 2. ROOM ALLOTMENT |") print("| 3. DEPARTMENT CONTACT |") print("| 4. ASSIGN DOCTOR TO OPD |") print("| 5. VIEW DOCTORS ASSIGNED TO OPD |") print("| 6. VIEW DOCTOR DETAILS ASSIGNED TO OPD |") print("| 7. RETURN |") print("|__________________________________________________________________________|") xxxx = int(input("Enter your choice:.....")) hod2 = hod() dprd = ddd() if xxxx == 1: print(" __________________________________________________________________________ ") print("|-----------------------HOD's OPD TIMING UPDATE----------------------------|") print("| |") print("| 1. OPD START TIMINGS |") print("| 2. OPD END TIMINGS |") print("| 3. RETURN |") print("|__________________________________________________________________________|") xxxxx = int(input("Enter your choice:.....")) if xxxxx == 1: hod2.setopdstarttiming(dprd) elif xxxxx == 2: hod2.setopdendtiming(dprd) elif xxxx == 2: hod2.setdocroomno(dprd) elif xxxx == 3: hod2.setdocextensionno(dprd) elif xxxx == 4: hod2.assigndocopd(dprd) elif xxxx == 5: hod2.getopdall() elif xxxx == 6: docid = input("| PLEASE ENTER THE DOCTOR's ID WHOSE INFROMATION NEEDS TO BE VIEWED:...") hod2.getdocdetails(docid) else: break elif x == 7: print("| LOGGING OUT...PRESS ANY KEY TO CONTINUE..!") a = input("") sys.exit() else: print("| WRONG CHOICE ENTERED..PLEASE TRY AGAIN") continue h1 = h() else: while True: h1 = h() print(" __________________________________________________________________________ ") print("|----------------------------WELCOME TO HOMEPAGE---------------------------|") print("| |") print("| 1. SEE PATIENT ALLOCATED |") print("| 2. EDIT PROFILE |") print("| 3. PATIENT VIEWED |") print("| 4. VIEW PROFILE |") print("| 5. REFERRAL |") print("| 6. LOGOUT |") print("|__________________________________________________________________________|") x = int(input("Enter your choice:.....")) if x == 1: print(" __________________________________________________________________________ ") print("|----------------------------PATIENT VIEW TYPE-----------------------------|") print("| |") print("| 1. SORT BY PATIENT ID |") print("| 2. NORMAL VIEW |") print("| 3. VIEW HISTORY |") print("|__________________________________________________________________________|") xx = int(input("Enter your choice:.....")) if xx==1: cursor.execute("SELECT * FROM `mydb`.`doctor_assignment` where DOC_ID = '" + name + "' ORDER BY PAT_ID;") print(cursor.fetchall()) elif xx==2: h1.getpatientsallocated(name) elif xx == 3: pmr1 = pmr() pmr1.viewhistory(name) else: pass elif x == 2: doc4 = doc() d1 = dpd() doc4.editdetail(d1,name) elif x == 3: doc4.patientviewed(name) elif x == 4: h1.getdoctordetail(name) elif x == 5: ### we have to assign all doctors a level a junior level dr can only reffere someone #### and also other departmental refferal only oh the consent of hod #### refereral if required print(" __________________________________________________________________________ ") print("|------------------------DOCTOR'S REFERRAL WINDOW--------------------------|") h2 = h() p2 = p() h2.referpatients(name,p2) elif x == 6: print("| LOGGING OUT...PRESS ANY KEY TO CONTINUE..!") a = input("") sys.exit() else: print("| WRONG CHOICE ENTERED..PLEASE TRY AGAIN") continue h1 = h() elif x == 3: print(" __________________________________________________________________________ ") print("|-----------------------PATIENT'S REGISTRATION WINDOW----------------------|") p5 = p() p5.registerpatient() elif x == 4: aa = 1 while aa <= 3: print(" __________________________________________________________________________ ") print("|-------------------------PATIENT's LOGIN WINDOW---------------------------|") u_id = input("| USERID:.. ") password = input("| PASSWORD:.. ") cursor.execute( "SELECT count(*) FROM `db`.`admin` where BINARY ID='" + u_id + "' AND BINARY Password='******';") p1 = cursor.fetchone() y = int(p1[0]) if y == 0: # if(cursor.execute("SELECT ID FROM `db`.`admin` where ID='" + d_id + "' AND Password='******';") != None): if aa != 3: print("| ERROR:...TRY AGAIN...!") print(3 - aa, "CHANCES LEFT") aa = aa + 1 else: print("LIMIT EXCEEDED") aaa = input("PRESS ANY KEY TO EXIT") sys.exit() else: while True: h1 = h() print(" __________________________________________________________________________ ") print("|----------------------------WELCOME TO HOSPITAL---------------------------|") print("| |") print("| 1. SEARCH DOCTOR |") #### ON THE BASIS OF DEPARTMENT OR DOCTOR NAME ## INSIDE OOF DEPARTMENT 10 DOCTOR AYE print("| 2. VIEW DOCTOR'S OPD TIMING |") print("| 3. VIEW DOCTOR'S PROFILE |") print("| 4. VIEW PAST HISTORY |") print("| 5. VIEW PROFILE |") print("| 6. NEW APPOINTMENT |") print("| 7. EDIT PROFILE |") print("| 8. EXIT |") print("|__________________________________________________________________________|") x = int(input("Enter your choice:")) if x == 1: p4 = p() p4.searchdoctor(h1,u_id) elif x == 2: print(" __________________________________________________________________________ ") print("|-------------------DOCTOR'S OPD TIMING SEARCH WINDOW----------------------|") print("| |") d_id = input("| PLEASE ENTER THE DOCTOR'S ID:... ") h1.gettiming(d_id) elif x == 3: print(" __________________________________________________________________________ ") print("|--------------------DOCTOR'S PROFILE SEARCH WINDOW------------------------|") print("| |") d_id = input("| PLEASE ENTER THE DOCTOR'S ID:... ") h1.getdoctordetail(d_id) elif x == 4: print(" __________________________________________________________________________ ") print("|----------------------------PAST HISTORY----------------------------------|") print("| |") h1.getpateinthistory(u_id) elif x == 5: print(" __________________________________________________________________________ ") print("|----------------------------SELF PROFILE----------------------------------|") print("| |") p1 = p() p1.getpatientall(u_id) elif x == 6: p6 = p() hx = h() p6.appointment(u_id,hx) elif x == 7: p3 = p() p3.editpatientself() elif x == 8: print("| LOGGING OUT...PRESS ANY KEY TO CONTINUE..!") a = input("") sys.exit() else: print("WRONG CHOICE...TRY AGAIN") continue elif x == 5: print(" __________________________________________________________________________ ") print("|----------------------------PASSWORD RESET PAGE---------------------------|") print("| 1. FORGOT ID |") print("| 2. FORGOT PASSWORD |") choice = int(input("Please enter your choice:.......")) p1 = p() if choice == 1: pno = input("Please enter a phone no associated with your account:...") print("YOUR ID IS GIVEN BELOW. USE THIS TO RESET YOUR PASSWORD") print(p1.getidpno(pno)) elif choice == 2: print("Please enter you id:....") x1 = input() print("Are you sure you want to reset your password") print("1. CONFIRM") print("2. RETURN BACK") ch = int(input("your choice::....")) if ch == 1: pswrd1 = input("please enter your password....") pswrd2 = input("please enter your password again....") if (pswrd1 == pswrd2): print("please wait while updating...............") p1.setpassword(pswrd1, x1) i = 100000000 while i >= 0: i = i - 1 print(" your password has changed ") print(" please move forward with login ") else: print("PASSWORDS DO NOT MATCH") print("PLEASE TRY AGAIN") else: print("wrong choice") pass elif x == 6: h3 = h() h3.emergency() elif x == 7: sys.exit() else: print("| ERROR:... ")
def employee(root): def store(v): if e1.get() == "" or e2.get() == "": #Condition to check Empty Fields messagebox.showinfo("ERROR3", "Each Field is Mandatory") else: res = [] p.execute('''select username from employee1''') result = p.fetchall() for row in result: if row[0] == e1.get(): p.execute( "select password from employee1 where username='******';") result1 = p.fetchall() name = e1.get() if result1[0][0] == e2.get(): messagebox.showinfo("Success", "Logged In Successfully") p.execute( "select designation from employee1 where username='******';") result2 = p.fetchall() desig = result2[0][0] e1.delete(0, 'end') e2.delete(0, 'end') login.login(v, root, name, desig) break else: flag = False p.execute("select username from employee1") res = p.fetchall() for row in res: if row[0] == e1.get(): flag = True #print(flag) if flag == False: messagebox.showinfo("Error", "Wrong Username") else: flag = False p.execute( "select password from employee1 where username='******';") res1 = p.fetchall() for row in res1: if row[0] == e2.get(): flag = True #print(flag) if flag == False: messagebox.showinfo("Error", "Wrong password") v.deiconify() i = 3 v = Toplevel(root) v.title("employee") v.minsize(1250, 700) background_img = PhotoImage(file="./bg1.png") background_label = Label(v, image=background_img) background_label.pack(fill=BOTH, expand=True) #employee="employee" #print(employee) #BUTTON b1 = Button(v, bg="steelblue2", fg="black", text='HOME', font="Bold 10", pady=3.0, relief=FLAT, height=1, width=15, command=lambda: home(root, v)) b1.place(x=600, y=20) b2 = Button(v, bg="steelblue2", fg="black", text='MANAGER', font="Bold 10", pady=3.0, relief=FLAT, height=1, width=15, command=lambda: manager.manager(v)) b2.place(x=750, y=20) b3 = Button(v, bg="white", fg="black", text='EMPLOYEE', font="Bold 10", pady=3.0, relief=GROOVE, height=1, width=15) b3.place(x=900, y=20) b4 = Button(v, bg="steelblue2", fg="black", text='ACCOUNT DETAILS', font="Bold 10", pady=3.0, relief=FLAT, height=1, width=15, command=lambda: admin.admin(v)) b4.place(x=1050, y=20) l1 = Label(v, font="Bold 15", fg="BLACK", bg="lightcyan", text="Username: "******"Bold 15", fg="BLACK", bg="lightcyan", text="Password : "******"*") l1.place(x=500, y=250) l2.place(x=500, y=300) e1.place(x=700, y=250) e2.place(x=700, y=300) b5 = Button(v, bg="DEEP SKY BLUE", fg="Black", text='LOGIN', font="Bold 10", pady=3.0, relief=RAISED, height=1, width=15, command=lambda: store(v)) b5.place(x=600, y=350) b6 = Button(v, bg="lightcyan", fg="NAVY BLUE", text='New User? Sign Up Here.', font="Bold 15", pady=3.0, relief=FLAT, height=1, width=20, command=lambda: signup.signup(v, root, "employee1")) b6.place(x=580, y=390) #c=con.cursor() #result=c.execute('''select * from employee1''') '''con.commit() for row in result: print(row[0],end=', ') print(row[1],end=', ') print(row[2],end=', ') print(row[3],end=', ') print(row[4])''' root.withdraw() v.mainloop() return v
from admin import admin from user import user import os allUsers = [] adminOfApplication = admin('omar', '*****@*****.**', 'admin123', 'male', '6/6/2000', 'Alexandria', 'Egypt', '01065630331') user1 = user('youssef', '*****@*****.**', 'FirstLast11', 'Male', '8/8/2006', 'Alexandria', 'Egypt', '01265630331') user2 = user('Ahmed', '*****@*****.**', 'SecondLast11', 'Male', '5/12/2006', 'Alexandria', 'Egypt', '01006615471') user3 = user('Omar', '*****@*****.**', 'Shahen77', 'Male', '6/6/2000', 'Alexandria', 'Egypt', '01065630331') allUsers.append(user1) allUsers.append(user2) allUsers.append(user3)
def submit(event): global photo global this_is_main_part who = int(v.get()) if who == 0: print(showerror('ShowError', 'Please Select Admin Or Student')) llll = len(entry_1.get()) entry_1.delete(0, llll) llll = len(entry_2.get()) entry_2.delete(0, llll) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) elif who == 1: if entry_1.get() != '': if entry_2.get() != '': query = "select * from admin where username=\'" + str( entry_1.get()) + "\' " cursor.execute(query) all_details = cursor.fetchall() if len(all_details) <= 0: query = "select * from librarian where username=\'" + str( entry_1.get()) + "\' " cursor.execute(query) all_details = cursor.fetchall() if len(all_details) > 0: query = "select * from admin where username=\'" + str( entry_1.get()) + "\' and password= \'" + str( entry_2.get()) + "\' " cursor.execute(query) all_details = cursor.fetchall() if len(all_details) <= 0: query = "select * from librarian where username=\'" + str( entry_1.get( )) + "\' and password= \'" + str( entry_2.get()) + "\' " cursor.execute(query) all_details = cursor.fetchall() if len(all_details) > 0: if entry_3.get() != '': if str(entry_3.get()) == str( this_is_main_part): all_details = all_details[0] t.destroy() admin(all_details[0], all_details[1]) else: entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) else: showwarning('Warning', 'Please Write The Captcha') this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) else: print( showerror('ShowError', 'Please Enter Right Password')) llll = len(entry_2.get()) entry_2.delete(0, llll) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) else: print( showerror('ShowError', 'Please Enter valid username')) llll = len(entry_1.get()) entry_1.delete(0, llll) llll = len(entry_2.get()) entry_2.delete(0, llll) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) else: print(showerror('ShowError', 'Please Enter Password')) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) else: print(showerror('ShowError', 'Please Enter Username')) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) elif who == 2: if entry_1.get() != '': if entry_2.get() != '': query = "select * from student where enrollment_no=\'" + str( entry_1.get()) + "\' " cursor.execute(query) all_details = cursor.fetchall() if len(all_details) > 0: query = "select * from student where enrollment_no=\'" + str( entry_1.get()) + "\' and password= \'" + str( entry_2.get()) + "\' " cursor.execute(query) all_details = cursor.fetchall() if len(all_details) > 0: if entry_3.get() != '': if str(entry_3.get()) == str( this_is_main_part): all_details = all_details[0] t.destroy() student(all_details[0], all_details[6]) else: entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) this_is_main_part = generate_captcha() this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) else: showwarning('Warning', 'Please Write The Captcha') this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) else: print( showerror('ShowError', 'Please Enter Right Password')) llll = len(entry_2.get()) entry_2.delete(0, llll) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) else: print( showerror('ShowError', 'Please Enter valid username')) llll = len(entry_1.get()) entry_1.delete(0, llll) llll = len(entry_2.get()) entry_2.delete(0, llll) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) else: print(showerror('ShowError', 'Please Enter Password')) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) else: print(showerror('ShowError', 'Please Enter Username')) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) elif who == 3: if entry_1.get() != '': if entry_2.get() != '': query = "select * from librarian where username=\'" + str( entry_1.get()) + "\' " cursor.execute(query) all_details = cursor.fetchall() if len(all_details) > 0: query = "select * from librarian where username=\'" + str( entry_1.get()) + "\' and password= \'" + str( entry_2.get()) + "\' " cursor.execute(query) all_details = cursor.fetchall() if len(all_details) > 0: all_details = all_details[0] t.destroy() admin(all_details[0], all_details[1]) else: print( showerror('ShowError', 'Please Enter Right Password')) llll = len(entry_2.get()) entry_2.delete(0, llll) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) else: print( showerror('ShowError', 'Please Enter valid username')) llll = len(entry_1.get()) entry_1.delete(0, llll) llll = len(entry_2.get()) entry_2.delete(0, llll) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) else: print(showerror('ShowError', 'Please Enter Password')) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get())) else: print(showerror('ShowError', 'Please Enter Username')) this_is_main_part = generate_captcha() photo = PhotoImage(file='shyam.png') Button(t, width=190, bg='#BDB76B', fg='black', command=papa, cursor='hand2', image=photo).place(x=230, y=210) entry_3.delete(0, len(entry_3.get())) entry_1.delete(0, len(entry_1.get())) entry_2.delete(0, len(entry_2.get()))
def manager(root): def store(a): if e1.get() == "" or e2.get() == "": #Condition to check Empty Fields messagebox.showinfo("ERROR3", "Each Field is Mandatory") print("error1") else: con = sqlite3.connect('database.db') p = con.cursor() res = [] result = p.execute('''select username from manager''') #con.commit() '''for row in result: #print(row[0],end=', ') #print(row[1],end=', ') res.append(row[2]) #print(row[3],end=', ') #print(row[4])''' for row in result: if row[0] == e1.get(): result1 = p.execute( "select * from manager where username='******';") #con.commit() print(result1) for row in result1: pas = row[4] #print(pas) if pas == e2.get(): messagebox.showinfo("Success", "Logged In Successfully") e1.delete(0, 'end') e2.delete(0, 'end') login_manager.login_manager(a, root) break else: flag = False p.execute("select username from manager") res = p.fetchall() for row in res: if row[0] == e1.get(): flag = True #print(flag) if flag == False: messagebox.showinfo("Error", "Wrong Username") else: flag = False p.execute("select password from manager where username='******';") res1 = p.fetchall() for row in res1: if row[0] == e2.get(): flag = True #print(flag) if flag == False: messagebox.showinfo("Error", "Wrong password") a.deiconify() i = 3 a = Toplevel(root) a.title("manager") a.minsize(1250, 700) background_img = PhotoImage(file="./bg1.png") background_label = Label(a, image=background_img) background_label.pack(fill=BOTH, expand=True) #BUTTON b1 = Button(a, bg="steelblue2", fg="black", text='HOME', font="Bold 10", pady=3.0, relief=FLAT, height=1, width=15, command=lambda: home(root, a)) b1.place(x=600, y=20) b2 = Button(a, bg="white", fg="black", text='MANAGER', font="Bold 10", pady=3.0, relief=GROOVE, height=1, width=15) b2.place(x=750, y=20) b3 = Button(a, bg="steelblue2", fg="black", text='EMPLOYEE', font="Bold 10", pady=3.0, relief=FLAT, height=1, width=15, command=lambda: employee.employee(a)) b3.place(x=900, y=20) b4 = Button(a, bg="steelblue2", fg="black", text='ADMIN', font="Bold 10", pady=3.0, relief=FLAT, height=1, width=15, command=lambda: admin.admin(a)) b4.place(x=1050, y=20) l1 = Label(a, font="Bold 15", fg="BLACK", bg="lightcyan", text="Username : "******"Bold 15", fg="BLACK", bg="lightcyan", text="Password : "******"*") l1.place(x=500, y=250) l2.place(x=500, y=300) e1.place(x=700, y=250) e2.place(x=700, y=300) b5 = Button(a, bg="DEEP SKY BLUE", fg="black", text='LOGIN', font="Bold 10", pady=3.0, relief=RAISED, height=1, width=15, command=lambda: store(a)) b5.place(x=600, y=350) b5 = Button(a, bg="lightcyan", fg="NAVY BLUE", text='New User? Sign Up Here.', font="Bold 15", pady=3.0, relief=FLAT, height=1, width=20, command=lambda: signup.signup(a, root, "manager")) b5.place(x=580, y=390) root.withdraw() a.mainloop() return a
def report(self, chan): admin.admin(self, chan, "report force")