一款講得非常詳細的登錄代碼,對php入門者有很大的幫助,有需要的朋友可以免費查看。
效果圖。
index.php教程
代碼如下 復制代碼<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<title>系統登錄</title>
<link href="css教程.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="box">
<div id="denglu">
<div id="pic"> 系統後台登陸</div>
<form action="check.php" method="post">
<p>用戶名:
<input type="text" name="name" id="name" />
<span class="must">*</span></p>
<p>密 碼:
<input name="password" type="password" id="password" />
<span class="must">*</span></p>
<p>驗證碼:
<input name="check" type="text" id="check" size="8" />
<img src="piccheck.php" /> <span class="must">*</span></p>
<p class="form_button">
<input type="submit" name="sub" id="sub" value="登陸" />
<input type="reset" name="unsub" id="unsub" value="取消" />
</p>
</form>
</div>
</div>
</body>
</html>
數據庫教程連接 connect.php
代碼如下 復制代碼<?php
$connect=mysql教程_connect("localhost","root","")or die("服務器連接失敗");
mysql_select_db("test",$connect)or die("沒有建立相應的數據庫");
$sql="select * from admin";
?>
圖片驗證碼 piccheck.php
代碼如下 復制代碼 <?phpcss.css文件
代碼如下 復制代碼@charset "utf-8";
/* CSS Document */
body {
background-color: #9CF;
text-align: left;
}
#denglu {
width: 400px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
background-image: url(images/login.gif);
background-repeat: no-repeat;
height: 320px;
text-indent: 6px;
}
#box #denglu form {
position: relative;
top: 50px;
left: 10px;
width: 92%;
}
.must {
color: #F00;
font-size: 12px;
}
#box #denglu #pic {
background-image: url(images/dot1.gif);
background-repeat: no-repeat;
height: 20px;
width: 100px;
font-size: 12px;
color: #F00;
text-align: left;
line-height: 18px;
left: 10px;
top: 30px;
position: relative;
}