def authentication(username, password): sql = '''select username,password from users where username='******' ''' % username data = select_one_result(sql) if data == None: return False elif data[0] != username: return False elif data[1] != password: return False else: return True
def authentication(username, password): sql = '''select username,password from users where username='******' ''' % username data = select_one_result(sql) md5pwd = encryption(password) if not data: return "username:%s is not found!" % username, False #elif data[0] != username: # return "username:%s is not found!"%username,False elif data[1] != md5pwd: return "username:%s bad password" % username, False else: return None, True
def userInfo(uid): sql = '''SELECT * FROM users WHERE id = %s; ''' % uid return select_one_result(sql)
def get_user_id(uid): sql = '''SELECT * FROM users WHERE id = '%d';''' % uid return select_one_result(sql)
def get_email(email): sql = '''SELECT * FROM users WHERE email = '%s';''' % email return select_one_result(sql)
def get_user(name): sql = '''SELECT * FROM users WHERE username = '******';''' % name return select_one_result(sql)
def login_check(name,password): sql = '''SELECT * FROM users WHERE username = '******' and password = '******';''' % (name,password) print sql return select_one_result(sql)
def search(name): sql = '''SELECT * FROM users WHERE username like '%s\%' or email like '%s\%';''' % (name,name) print sql return select_one_result(sql)