第一次接触这种 查了好久也不会 = - 求解
<br /><?php<br />session_start();<br /><br /> class chkuserlogin{<br /> <br /> private $username;<br /> private $password;<br /> <br /> <br /> public function __construct($username,$password){<br /> $this->username=$username;<br /> $this->password=$password;<br /> <br /> <br /> <br /> require_once("connn.php");<br /> $sql=mysql_query("select account from root where username='".$this->username."' and password='".$this->password."'",$conn); <br /> $info=mysql_fetch_array($sql);<br /> if($info==false){<br /> echo "<script>alert('用户名或密码输入错误!');history.back();</script>";<br /> exit;<br /> }else{<br /> if($_SESSION["unc"]!=""){<br /> session_unregister("unc");<br /> } <br /> session_register("unc");<br /> $_SESSION["unc"]=$this->username; <br /> mysql_query("update root set logintimes=logintimes+1,lastlogintime='".date("Y-m-d H:i:s")."'",$conn);<br /> echo "<script>alert('登录成功!');window.location.href='login.php';</script>"; <br /> }<br /> }<br /> }<br /><br /> $obj=new chkuserlogin($_POST["username"],md5($_POST["password"]));<br /> $obj->chk();<br />?><br /> 登录验证的一小段代码 我数据库为 localhost root 无密码 , 我数据库已保存了一组密码。 无限密码错误 跳转页面 而且也报错
= - 求解脱 拜谢
------解决思路---------------------- 你是怎么执行这个程序的
------解决思路----------------------
引用:
<br /><!DOCTYPE html><br /><html lang="en"><br /> <head><br /> <meta charset="utf-8" /><br /> <title>Administrator</title><br /> <br /> <br /> <br /> <br /> <link href="./css/bootstrap.min.css" rel="stylesheet" /><br /> <link href="./css/bootstrap-responsive.min.css" rel="stylesheet" /><br /> <br /> <br /> <link href="./css/font-awesome.css" rel="stylesheet" /><br /> <br /> <link href="./css/adminia.css" rel="stylesheet" /> <br /> <link href="./css/adminia-responsive.css" rel="stylesheet" /> <br /> <br /> <link href="./css/pages/login.css" rel="stylesheet" /> <br /><br /> <br /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><br /><form name="connForm" method="post" action="conn.php" onSubmit="return InputCheck(this)"> <br /><body><br /> <br /><div class="navbar navbar-fixed-top"><br /> <br /> <div class="navbar-inner"><br /> <br /> <div class="container"><br /> <br /> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <br /> <span class="icon-bar"></span> <br /> <span class="icon-bar"></span> <br /> <span class="icon-bar"></span> <br /> </a><br /> <br /> <a class="brand" href="./"> Admin</a><br /> <br /> <div class="nav-collapse"><br /> <br /> <br /> </div> <!-- /nav-collapse --><br /> <br /> </div> <!-- /container --><br /> <br /> </div> <!-- /navbar-inner --><br /> <br /></div> <!-- /navbar --><br /><br /><br /><div id="login-container"><br /> <br /> <br /> <div id="login-header"><br /> <br /> <h3>欢迎登陆用户保用注册后台</h3><br /> <br /> </div> <!-- /login-header --><br /> <br /> <div id="login-content" class="clearfix"><br /> <br /> <br /> <fieldset><br /><br /> <div class="control-group"><br /> <label class="control-label" for="username">用户名:</label><br /> <div class="controls"><br /> <input type="text" class="" id="username" /><br /> </div><br /> </div><br /> <div class="control-group"><br /> <label class="control-label" for="password">密码:</label><br /> <div class="controls"><br /> <input type="password" class="" id="password" /><br /> </div><br /> </div><br /> </fieldset><br /> <br /> <div id="remember-me" class="pull-left"><br /> <input type="checkbox" name="remember" id="remember" /><br /> <label id="remember-label" for="remember">Remember Me</label><br /> </div><br /> <br /> <div class="pull-right"><br /> <button type="submit" class="btn btn-warning btn-large"><br /> Login<br /> </button><br /> </div><br /> </form><br /> <br /> </div> <!-- /login-content --><br /> <br /> <br /> <br /> <br /></div> <!-- /login-wrapper --><br /><br /> <br /><br /><!-- Le javascript<br />================================================== --><br /><!-- Placed at the end of the document so the pages load faster --><br /><script src="./js/jquery-1.7.2.min.js"></script><br /><br /><br /><script src="./js/bootstrap.js"></script><br /><br /> </body><br /></html><br /> = - 用这个 页面<br />
你的用户名和密码没有提交过去啦
红色框框分别加上
name="username"
name="password"
再试试
Stellungnahme: Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn