user_list=[
{'name':'tom','passwd':'123< span style="color: #800000;">'},
{'name':'ubuntu','passwd':'123< span style="color: #800000;">'},
{'name':'centos','passwd':'123< span style="color: #800000;">'},
{'name':'jane','passwd':'123< span style="color: #800000;">'},
]
current_dict = {'username':None,'login< span style="color: #800000;">':False}
def auth(auth_type = 'filedb'): #< span style="color: #008000;">The default verification method is filedb
def auth_func(func):
def wrapper(*args,**kwargs):
print("The authentication method is:{}".format(auth_type))
if auth_type == 'filedb':
if current_dict['username'] and current_dict['login'< span style="color: #000000;">]:
res = func()
return res
username = input("username:>>> ").strip()
passwd = input("passwd:>>> ").strip()
for user_dict in user_list:
if username == user_dict['name'] and passwd == user_dict['passwd ']:
current_dict['username'] = username
current_dict['login'] =True
res = func()
return res
else:
print("Incorrect username or password")
else:
print("The ghost knows what the authentication method is--->{}" .format(auth_type))
return wrapper
return auth_func
@auth(auth_type = 'filedb')
def index():
print("Welcome to the JD homepage")
@auth()
def home():
print("Welcome home!")
@auth('sssssss')
def shopping_car():
print("There is..." )
if __name__ == '__main__':
index()
home()
shopping_car()
user_list=[
{'name':'tom','passwd':'123< span style="color: #800000;">'},
{'name':'ubuntu','passwd':'123< span style="color: #800000;">'},
{'name':'centos','passwd':'123< span style="color: #800000;">'},
{'name':'jane','passwd':'123< span style="color: #800000;">'},
]
current_dict = {'username':None,'login< span style="color: #800000;">':False}
def auth(auth_type = 'filedb'): #< span style="color: #008000;">The default verification method is filedb
def auth_func(func):
def wrapper(*args,**kwargs):
print("The authentication method is:{}".format(auth_type))
if auth_type == 'filedb':
if current_dict['username'] and current_dict['login'< span style="color: #000000;">]:
res = func()
return res
username = input("username:>>> ").strip()
passwd = input("passwd:>>> ").strip()
for user_dict in user_list:
if username == user_dict['name'] and passwd == user_dict['passwd ']:
current_dict['username'] = username
current_dict['login'] =True
res = func()
return res
else:
print("Incorrect username or password")
else:
print("The ghost knows what the authentication method is--->{}" .format(auth_type))
return wrapper
return auth_func
@auth(auth_type = 'filedb')
def index():
print("Welcome to the JD homepage")
@auth()
def home():
print("Welcome home!")
@auth('sssssss')
def shopping_car():
print("There is..." )
if __name__ == '__main__':
index()
home()
shopping_car()
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4912 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC