深夜调代码 试过无数种方法最终见了成效

login.php内容例如以下

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>管理员后台登录 </title>
<!-- CSS -->
<!-- Reset Stylesheet -->
<link rel="stylesheet" href="resources/css/reset.css" type="text/css" media="screen" />
<!-- Main Stylesheet -->
<link rel="stylesheet" href="resources/css/style.css" type="text/css" media="screen" />
<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
<link rel="stylesheet" href="resources/css/invalid.css" type="text/css" media="screen" />
<!-- Javascripts -->
<!-- jQuery -->
<script type="text/javascript" src="resources/scripts/jquery-1.3.2.min.js"></script>
<!-- jQuery Configuration -->
<script type="text/javascript" src="resources/scripts/simpla.jquery.configuration.js"></script>
<!-- Facebox jQuery Plugin -->
<script type="text/javascript" src="resources/scripts/facebox.js"></script>
<!-- jQuery WYSIWYG Plugin -->
<script type="text/javascript" src="resources/scripts/jquery.wysiwyg.js"></script>
</head>
<body id="login">
<div id="login-wrapper" class="png_bg">
<div id="login-top">
<h1>管理员后台登录</h1>
<!-- Logo (221px width) -->
<a href="#"><img id="logo" src="resources/images/logo.png" alt="Simpla Admin logo" /></a> </div>
<!-- End #logn-top -->
<div id="login-content">
<form action="login_1.php" method = "POST">
<fieldset>
<p>
<label>username</label>
<input class="text-input" type="text" name = "loginName"/>
</p>
<div class="clear"></div>
<p>
<label>密码</label>
<input class="text-input" type="password" name = "loginPwd"/>
</p>
<div class="clear"></div>
<p id="remember-password">
<input type="checkbox" />
记住我 </p>
<div class="clear"></div>
<p>
<input id = "loginbtn" class="button" type="submit" value="登入" name = "submit" />
</p>
</fieldset>
</form>
</div>
<!-- End #login-content -->
</div>
<!-- End #login-wrapper -->
</body>
</html>

login_1.php内容例如以下

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<?

php 

	error_reporting(0);
if(!isset($_POST['submit'])){
exit('非法訪问!');
} $name=$_POST['loginName'];
$password=$_POST['loginPwd']; include('connect.php'); if($name && $password){
echo "come in";
$sql="select * from admin where adName='$name' and adPwd='$password' ";
$res=mysql_query($sql);
echo "$res";
echo "$name";
$test=mysql_fetch_array($res);
if($test && strcmp($name,'admin')==0){
header("location:index.php");
echo "finally";
exit;
}else{
echo "fail to login";
exit;
}
mysql_free_result($res);
mysql_close($conn);
}
? >

connect.php内容例如以下

<?php
$conn=mysql_connect('localhost','root','') or die("连接失败".mysql_error());
mysql_select_db('door',$conn) or die("选择数据库失败".mysql_error());
mysql_query("set names gb2312");
?>

数据库设计 例如以下

最新文章

  1. iOS图表库Charts集成与使用
  2. Example: Encoded SNMP Message - SNMP Tutorial
  3. 改变 TMemo 的背景颜色 (Firemonkey)
  4. (二)cordova+framework7入门——笑笑APP
  5. js中常用的Tab切换
  6. ASP.NET中的Image和ImageButton控件
  7. malloc函数详解
  8. shell脚本入门教程(转)
  9. phonegap_android配置文档
  10. com.classpath.www
  11. stack计算表达式的值
  12. bzoj 3531 [Sdoi2014]旅行(树链剖分,线段树)
  13. Linux下的getline函数
  14. 监听enter事件
  15. 『openframeworks』shader制作三角形马赛克效果
  16. gRPC编码初探(java)
  17. String.valueOf(int i)和Integer.toString(int i)有什么区别?
  18. PostConstruct注解
  19. Regular expressions in lexing and parsing(翻译)
  20. jQuery选择器ID、CLASS、标签获取对象值、属性、设置css样式

热门文章

  1. 【LeetCode】467. Unique Substrings in Wraparound String
  2. Sqoop架构(四)
  3. node or gulp 使用
  4. html5+css3杂记
  5. React Native 环境搭建踩坑
  6. Android Studio 关于build.gradle配置问题
  7. PHP7安装Memcache+Memcached缓存加速WordPress教程
  8. 06--Qt窗口布局
  9. 转录组入门(3):了解fastq测序数据
  10. Sprinboot优雅配置监听,并记录所有启动事件