def POST(self): user=web.input().user passwd=md5str(web.input().passwd) if cmp(web.session.Session.yzm.upper(),web.input().yzm.upper()): f='Wrong! auth code is wrong!' color='red' return render.login(f,color,imgs=authidentcode(),b=web.session.Session.yzm) else: pass if checkpass(user,passwd): web.session.Session.user=user web.session.Session.uuid=md5str(user+config.mi_key) session_add('client_ip','0.0.0.0') session_add('user_info','') web.session.Session.user_info=user_persion_info(web.session.Session.user).list()[0] web.session.Session.client_ip=web.ctx.env.get('REMOTE_ADDR') n_time=str(nowtime()) login_logs(user,n_time,web.session.Session.client_ip) session_add('login_time','') web.session.Session.login_time=n_time web.redirect('/admin/manager/') else: f='Fail,username or passwd wrong!' color='red' return render.login(f,color,imgs=authidentcode(),b=web.session.Session.yzm)
def POST(self): color='red' try: user=web.input().user passwd=md5str(web.input().passwd) if cmp(web.session.Session.yzm.upper(),web.input().yzm.upper()): f='请输入正确的验证码' color='red' return render.login(f,color,imgs=authidentcode(),b=web.session.Session.yzm) else: pass if checkpass(user,passwd): web.session.Session.user=user web.session.Session.uuid=md5str(user+config.mi_key) session_add('client_ip','0.0.0.0') session_add('user_info','') web.session.Session.user_info=user_persion_info(web.session.Session.user).list()[0] web.session.Session.client_ip=web.ctx.env.get('REMOTE_ADDR') n_time=str(nowtime()) login_logs(user,n_time,web.session.Session.client_ip) session_add('login_time','') web.session.Session.login_time=n_time web.redirect('/admin/manager/') else: f='验证失败!请输入正确的用户名和密码' return render.login(f,color,imgs=authidentcode(),b=web.session.Session.yzm) except: f='验证失败!请开启浏览器的cookies' return render.login(f,color,imgs=authidentcode(),b=web.session.Session.yzm)
def get_lou(atc_id): from app.models.madmin import authidentcode html_js=''' <script language="javascript"> function GG(s) { var s=s; document.getElementById('lytext').value="<a href='#"+s+"'/>@"+s+"</a>"; } </script> <style type='text/css'> .ly_css{ font-size:18px; } </style> ''' lou=html_js lou+="<div style='color:blue;font-size:14px;'><h2>评论一下吧:</h2><form action='/users/public/' method='POST'><input type='text' name='lyname' >姓名*<p><input type='text' name='lyemail'>邮箱*<p>" lou+="<textarea id='lytext' rows='3' cols='20' name='lytext'></textarea><br>" lou+="<input type='text' name='yzm' size='5'><img src='"+authidentcode()+"'>" lou+="<input type='submit' value='发表'/>" lou+="<input type='text' style='display:none;' name='atc_id' value='"+str(atc_id)+"' />" lou+="<input type='text' style='display:none;' id='id_atc_url' name='atc_url' value=''/>" lou+="<script type='text/javascript'>document.getElementById('id_atc_url').value=location.href;</script>" lou+="</form></div>" sql_res='select * from ly_tb where atc_id='+str(atc_id)+' and ly_bz="Y" order by date desc' res=config.dbw.query(sql_res).list() sql_res='select count(*) c from ly_tb where atc_id='+str(atc_id)+' and ly_bz="Y" order by date desc' n=config.dbw.query(sql_res).list()[0]['c'] for i in range(n): lou+="<div class='ly_css'><p><img src='/static/upload/public/lytouxiang.jpg'>"+str(res[i]['mes_author'])+"在<font size='1px'>"+str(res[i]['date'])+"</font>说道:<span id="+str(res[i]['mes_author'])+">"+mysql_to_str(str(res[i]['mes_text']))+"</span>" lou+="<input type='submit' onclick=" lou+="GG('"+str(res[i]['mes_author'])+"') value='回复'></p></div>" return lou
def GET(self): return render.login('','',imgs=authidentcode(),b=web.session.Session.yzm)