def loginProcess(): uid = request.form['uid'] upw = request.form['upw'] rows = loginSql(uid=uid, upw=upw) if rows: # uid=='1' and upw=='1' : return redirect(url_for('main') + '?name=%s' % rows[0]['name']) else: return render_template('alert.2.html', msg='회원이 아닙니다')
def loginProcess(): uid = request.form['uid'] upw = request.form['upw'] # 디비 쿼리 수행 rows = loginSql(uid, upw) if rows: #uid=='1' and upw=='1': # ~/service?name=멀티 # 회원 정보를 포워딩할때 get방식에 맞춰서 전달 return redirect(url_for('main2') + '?name=%s' % rows[0]['name']) else: return render_template('alert2.html', msg='회원아님')
def loginProcess(): uid = request.form['uid'] #post 방식으로 요청 upw = request.form['upw'] print(uid, upw) # 디비 쿼리 수행 rows = loginSql(uid=uid, upw=upw) if rows: #rows가 db에서 받아 반환하면 return redirect(url_for('main') + '?name=%s' % rows[0]['name']) # return '/service' #만약 html에서 input하면 위에 처럼 ~/service?name=멀티 헤더로 보내주는 것이기 때문에 위처럼 쓰면 #get방식으로 보냄을 의미 #~/service?name=멀티 - 멀티라는 것을 else: return render_template('alert.2.html', msg='회원이 아닙니다')
# d1_8.py 모듈을 가져와서 로그인 처리를 하겠다. from d1_8 import loginSql #아이디 비번을 인자로 세팅 user_id = '1' user_pw = '1' rows = loginSql(uid=user_id, upw=user_pw) if rows: #[{'id':1,....}] print("회원이다") else: if rows == None: print("시스템 오류(내부 오류)") else: # () or [] uuprint("회원 아니다")