Hai All,
Good Evening,
I'm doing a small application using python and MySQL in APPLE MACINTOSH OPERATING SYSTEM. I want to to store the password in encrypted form in the database. While retriving the password it should check the encrypted text with the plain text and it should navigate to the other form.
I have done the encrypted form, but while checking the parameters it should not check the plain text with the encrypted text. It only checks the encrypted text in the database.
This is the code I have given it. Please Check the code and if any modifications please correct it and send to me.
Please Check the code and if there are any corrections made it and send to me. It is very urgent.
Please help me.
Thank You in advance.
Warm Regards
Srinivas
Good Evening,
I'm doing a small application using python and MySQL in APPLE MACINTOSH OPERATING SYSTEM. I want to to store the password in encrypted form in the database. While retriving the password it should check the encrypted text with the plain text and it should navigate to the other form.
I have done the encrypted form, but while checking the parameters it should not check the plain text with the encrypted text. It only checks the encrypted text in the database.
This is the code I have given it. Please Check the code and if any modifications please correct it and send to me.
Code:
#! /usr/bin/env python from Tkinter import * import tkMessageBox import Tkinter import time curtime = '' clock = Tkinter.Label(bg="tan") clock.grid(row=22,column=0,columnspan=3,sticky=E) def tick(): global curtime newtime = time.strftime("TIME:"'%d/%m/%d %H:%M:%S') if newtime != curtime: curtime = newtime clock.config(text=curtime) clock.after(200, tick) tick() class GUIFramework(Frame): """This is the GUI""" def __init__(self,master=None): """Initialize yourself""" """Initialise the base class""" Frame.__init__(self,master) """Set the Window Title""" self.master.title("LOGIN FORM") self.master.config(bg="wheat") """Display the main window" with a little bit of padding""" self.grid(padx=10,pady=10) self.CreateWidgets() def CreateWidgets(self): """Create all the widgets that we need""" self.config(bg="wheat") self.lbText = Label(self,text="LOGIN DETAILS",bg="tan",relief="solid") self.lbText.grid(row=0, column=0,sticky=NSEW,columnspan=50,pady=10) """Create the Text""" self.lbText1 = Label(self,text="User Name:",bg="wheat",relief="groove",width=20) self.lbText1.grid(row=1, column=0,sticky=W,columnspan=1) """Create the Entry, set it to be a bit wider""" self.enText1 = Entry(self, width=25) self.enText1.grid(row=1, column=1, columnspan=3,sticky=W) self.lbText2 = Label(self, text="Password:",bg="wheat",relief="groove",width=20) self.lbText2.grid(row=2, column=0,sticky=W) self.enText2 = Entry(self,width=25,show="*") self.enText2.grid(row=2, column=1, columnspan=3,sticky=W) self.lbText3 = Label(self, text="Confirm Password:",bg="wheat",relief="groove",width=20) self.lbText3.grid(row=3, column=0,sticky=W) self.enText3 = Entry(self,width=25,show="*") self.enText3.grid(row=3, column=1, columnspan=3,sticky=W) self.btnsubmit = Button(self, text="Login",command=self.login, bg='wheat',relief="groove",width=8) self.btnsubmit.grid(row=4, column=0,sticky=E,pady=10) def login(self): uname=self.enText1.get() pwd=self.enText2.get() cpwd = self.enText3.get() try: import os import MySQLdb import _mysql_exceptions as DB_EXC from hashlib import md5 cxn = MySQLdb.connect(user ='root') cur = cxn.cursor() no = cur.execute("insert into abc.users values (%s,%s)", (uname,pwd)) # here abc is the database and users is the table name new = md5 st = cur.execute("update abc.users set pwd=MD5(pwd) where uname=%s", (uname)) cur.close() cxn.commit() cxn.close() if (no != 0): tkMessageBox.showinfo("Text", "succesfully logged." ) else: tkMessageBox.showinfo("Text", "Invalid User Name and password.") except ImportError , e: return None if __name__ == "__main__": guiFrame = GUIFramework() guiFrame.mainloop()
Please help me.
Thank You in advance.
Warm Regards
Srinivas
Comment