def register(): if request.method == 'GET': username = request.args.get('username') password = request.args.get('password') age = request.args.get('age') email = request.args.get('emial') IPhone = request.args.get('IPhone') else: username = request.form.get('username') password = request.form.get('password') age = request.form.get('age') email = request.form.get('email') IPhone = request.form.get('IPhone') sensitive_str = ['~','@','#','$','%','^','&','*','(',')','_','.'] if username not in sensitive_str: if username != '' and password != '': if models.mysql_userlogin(username, password): return render_template('login.html', \ registererror='用户名或密码存在', \ registerusername=username, \ registerpassword=password) else: #age必须是数字,这里做下转换对应数据库中的int类型 if models.mysql_add(username, password, int(age), email, IPhone): return redirect('/successful/') else: return "注册失败" else: return render_template('login.html', \ Username='******') else: return render_template('login.html', \ sensitive_str='用户名含有敏感字符,请重新输入:')
def increaseone(): if request.method == 'POST': username = request.form.get('username') password = request.form.get('password') age = request.form.get('age') email = request.form.get('email') IPhone = request.form.get('IPhone') if models.mysql_add(username, password, age, email, IPhone): return "添加成功" else: return "添加失败"
def register(): if request.method == 'GET': username = request.args.get('username') password = request.args.get('password') age = request.args.get('age') email = request.args.get('emial') IPhone = request.args.get('IPhone') else: username = request.form.get('username') password = request.form.get('password') age = request.form.get('age') email = request.form.get('email') IPhone = request.form.get('IPhone') sensitive_str = [ '~', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '.' ] if username not in sensitive_str: if username != '' and password != '': if models.mysql_userlogin(username, password): return render_template('login.html', \ registererror='用户名或密码存在', \ registerusername=username, \ registerpassword=password) else: #age必须是数字,这里做下转换对应数据库中的int类型 if models.mysql_add(username, password, int(age), email, IPhone): return redirect('/successful/') else: return "注册失败" else: return render_template('login.html', \ Username='******') else: return render_template('login.html', \ sensitive_str='用户名含有敏感字符,请重新输入:')