Home  >  Article  >  Backend Development  >  求TP大神帮小弟我看看,为什么不能验证登陆

求TP大神帮小弟我看看,为什么不能验证登陆

WBOY
WBOYOriginal
2016-06-13 12:21:561187browse

求TP大神帮我看看,为什么不能验证登陆?

<!-- 弹出登陆框 --><br /><div class="theme-popover"><br />     <div class="theme-poptit"><br />          <a href="javascript:;" title="关闭" class="close">×</a><br />          <h3 style="font-size:20px;">会员登陆</h3><br />     </div><br />     <div class="theme-popbod dform"><br />           <form class="theme-signin" name="loginform"><br />                <ol><br />                     <li><strong>用户名:</strong><input class="ipt" type="text" name="username"  size="20" placeholder="手机/邮箱/用户名"/></li><br />                     <li><strong>密码:</strong><input class="ipt" type="password" name="password" size="20" placeholder="请输入你的密码"/></li><br />                     <li><input  id="btnEnter" class="btn btn-primary" type="submit" name="submit" value="登 录 " /></li><br />                     <li style="margin-left:30%;margin-top:-12%;"><a href="">忘记密码  ?</a></li><br />                     <li style="margin-left:-20%;margin-top:12%;"><input type="checkbox">记住账号</li><br />                     <li><br/><div id="datainfo"></div></li><br />                </ol><br />           </form><br />     </div><br /></div>[code=javascript]<script type="text/javascript"><br />	$(function(){<br />		//提交表单<br />		$('#btnEnter').click(function()<br />		{<br />			var username=$('input[name="username"]').val();<br />			var password=$('input[name="password"]').val();<br />			//alert(password);<br /><br />			$.get('__URL__/doLogin',{'username':username,'password':password},function(data)<br />			{<br />				if(data=='验证成功')<br />				{<br />					window.location='__APP__/index/index';<br />				}<br />				else if(data=='验证失败')<br />				{<br />					$('#datainfo').html("管理员登录失败.");<br />				}<br />			});<br /><br />			$('input[class="boxcontent"]').blur(function()<br />			{<br />				$('#datainfo').html("");<br />			});<br />		});<br />	});<br /></script>
[/code]
 //登陆验证<br />   public function doLogin()<br />   {<br />   	$username=$_GET['username'];<br />   	$password=$_GET['password'];<br />   	$user=M('member');<br />   	$where['username']=$username;<br />   	$where['password']=md5($password);<br />   	$count=$user->where($where)->count();<br />   	if($count)<br />   	{<br />   		$_SESSION['username']=$username;<br />   		echo '验证成功';<br />   	}<br />   	else<br />   	{<br />   		echo '验证失败';<br />   	}<br />   }

------解决思路----------------------
ajax指定格式比如json

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn