《動(dòng)態(tài)網(wǎng)站設(shè)計(jì)與開發(fā)》
考試改革報(bào)告
項(xiàng)目名稱:? ????會(huì)員注冊(cè)管理系統(tǒng)???????
專業(yè)班級(jí): 計(jì)算機(jī)科學(xué)與技術(shù)
學(xué)生學(xué)號(hào):? ? ? ?*************? ? ? ? ??
學(xué)生姓名:? ? ? ? ? ?***? ? ? ? ? ??
日??? 期:?????? ??2022.12.12? ? ? ? ?
目? 錄
1.系統(tǒng)開發(fā)背景及意義................................................................................................... 1
1.1系統(tǒng)開發(fā)背景介紹...................................................................................................... 2
1.2 系統(tǒng)開發(fā)的意義......................................................................................................... 2
2.系統(tǒng)的設(shè)計(jì)思路.......................................................................................................... 2
2.1 數(shù)據(jù)庫設(shè)計(jì)分析......................................................................................................... 2
2.2 功能模塊設(shè)計(jì)分析..................................................................................................... 2
3.程序功能測(cè)試及截圖................................................................................................... 2
3.1程序代碼測(cè)試............................................................................................................. 2
3.2功能演示(界面)...................................................................................................... 2
4.總結(jié)與收獲................................................................................................................. 2
1.系統(tǒng)背景及意義
1.1系統(tǒng)開發(fā)背景介紹
???????? 在大三上學(xué)期PHP程序設(shè)計(jì)期末考試中我選擇了會(huì)員注冊(cè)管理系統(tǒng)的項(xiàng)目,這個(gè)項(xiàng)目是在最近的授課中剛剛講授的課題,對(duì)于這個(gè)課題的選擇旨在于從頭開始搭建項(xiàng)目開發(fā)思路,提升自己的開發(fā)思維,同時(shí)也完善這個(gè)不夠完整的項(xiàng)目,使其最終成為一個(gè)完整使用的系統(tǒng),從頭梳理會(huì)員注冊(cè)管理系統(tǒng)的各個(gè)模塊,能夠使我在頭腦中牢記開發(fā)思路并使其完全成為我的一個(gè)PHP搭建網(wǎng)站的框架,在學(xué)習(xí)PHP程序設(shè)計(jì)這個(gè)課程的道路中,一定要形成一種自己的開發(fā)思維,構(gòu)架自己的一套開發(fā)框架,初學(xué)PHP我們都是小白,對(duì)于完成一個(gè)完整的系統(tǒng)設(shè)計(jì)頭腦一般都是一片空白,所以老師帶著我們一步一個(gè)腳印,去完成每一個(gè)頁面的創(chuàng)建,每一行代碼的指引,每一種方法的使用,從起初的懵懵懂懂到現(xiàn)在一個(gè)系統(tǒng)的完成,過程漫長(zhǎng)而復(fù)雜,所以在基礎(chǔ)知識(shí)還不夠牢固的情況下選擇最熟悉的項(xiàng)目,寫曾經(jīng)寫過的代碼,對(duì)于我們來說不能說信手拈來吧,也能循著自己的腳印獨(dú)立完成這個(gè)項(xiàng)目,就像嬰兒蹣跚學(xué)步那樣,脫離了父母的幫助才能學(xué)得更快掌握的也更加牢固吧。
1.2 系統(tǒng)開發(fā)的意義
???????? 會(huì)員信息管理系統(tǒng)開發(fā)的意義在于對(duì)本學(xué)期學(xué)習(xí)成果的檢驗(yàn),同時(shí)對(duì)本學(xué)期所學(xué)到的PHP知識(shí)進(jìn)行回顧,加深記憶,同時(shí)在獨(dú)立編寫一個(gè)完整的系統(tǒng)中去搭建屬于自己的PHP編寫思路,為以后的計(jì)算機(jī)學(xué)習(xí)奠定基礎(chǔ)。
2.系統(tǒng)的設(shè)計(jì)思路
2.1 數(shù)據(jù)庫設(shè)計(jì)分析
數(shù)據(jù)庫需要與設(shè)計(jì)系統(tǒng)的版本相互匹配,并且操作方便,這里使用的是phpstudy中的MYSQL8.0.12數(shù)據(jù)庫,需要專門建立一個(gè)用于存儲(chǔ)信息管理系統(tǒng)的庫,該庫中包含兩個(gè)表,一個(gè)是存儲(chǔ)登錄信息的表login,另一個(gè)是存儲(chǔ)會(huì)員數(shù)據(jù)的表student。Login表中設(shè)定兩個(gè)字段,一個(gè)是賬戶名:username,另一個(gè)是登錄密碼:password。Student表中包含五個(gè)字段,編號(hào):ID(設(shè)置為主鍵)、姓名:name、性別:sex、年齡:age、地址:adress。
2.2 功能模塊設(shè)計(jì)分析
會(huì)員信息管理系統(tǒng)的設(shè)計(jì),需要考慮到它具備的功能:1、存儲(chǔ)會(huì)員信息。所以它必須具備數(shù)據(jù)局庫連接的功能。2、信息展示。一個(gè)系統(tǒng)需要有一個(gè)系統(tǒng)首頁,首頁連接著系統(tǒng)其他的所有功能,還需要簡(jiǎn)介易于操作。3、登錄功能。一個(gè)專有的系統(tǒng)不是隨便一個(gè)用戶可以訪問的,所以需要設(shè)計(jì)一個(gè)登錄界面,讓擁有權(quán)限的管理員或用戶登錄到系統(tǒng)。4、注冊(cè)功能。針對(duì)申請(qǐng)獲取登錄系統(tǒng)權(quán)限的新用戶,需要設(shè)計(jì)一個(gè)注冊(cè)模塊,用于添加新的管理用戶。5、添加功能。針對(duì)需要添加的新的會(huì)員信息,需要一個(gè)添加模塊對(duì)新的信息進(jìn)行添加,并保存到數(shù)據(jù)庫。6、修改功能。針對(duì)需要改動(dòng)的會(huì)員信息,需要增加一個(gè)修改模塊,用于對(duì)已存在的信息進(jìn)行更新,也可以對(duì)不需要的信息進(jìn)行刪除。7、搜索功能。針對(duì)需要的特定信息設(shè)定一個(gè)搜索欄,篩選符合用戶要求的數(shù)據(jù)。
數(shù)據(jù)庫連接模塊:數(shù)據(jù)庫在用戶登錄成功后進(jìn)行連接,該界面不用向用戶展示,數(shù)據(jù)庫連接失敗則彈出窗口提示連接數(shù)據(jù)庫失敗。
登錄模塊:登錄模塊包含一個(gè)用于輸入登錄信息的表格,有表頭、賬戶名輸入欄、密碼輸入欄、一個(gè)登錄按鈕、一個(gè)注冊(cè)按鈕。該模塊在于簡(jiǎn)單易懂,畫面簡(jiǎn)潔美觀,有賬號(hào)密碼的用戶依次填寫登錄信息就可跳轉(zhuǎn)系統(tǒng)首頁,沒有賬號(hào)密碼的用戶,可以點(diǎn)擊注冊(cè)按鈕跳轉(zhuǎn)注冊(cè)界面。信息輸入欄還需要對(duì)用戶輸入的信息進(jìn)行篩選,與數(shù)據(jù)庫進(jìn)行連接匹配。
注冊(cè)模塊:注冊(cè)模塊包含頁面標(biāo)識(shí)、用戶名輸入欄、密碼欄、確認(rèn)密碼欄、注冊(cè)按鈕、退出按鈕。該模塊還需要對(duì)用戶輸入的注冊(cè)信息進(jìn)行判定,不能輸入不可識(shí)別信息,檢測(cè)到就彈出提示,信息填寫正常就跳轉(zhuǎn)到登錄界面。
首頁模塊:首頁模塊必須排版簡(jiǎn)潔美觀,該頁面重在向用戶展示,其他模塊的連接必須包含在首頁中,首頁還需設(shè)置一個(gè)信息展示欄用來輸出操作者需要操作的信息。針對(duì)信息過多,還需要設(shè)定信息分頁展示。
添加模塊:添加模塊需要將所有的添加信息類別依次羅列出來,還需要一個(gè)信息提交按鈕,也可已添加一個(gè)返回按鈕。需要對(duì)添加的信息進(jìn)行篩選,屬性錯(cuò)誤則彈出提示信息。
修改模塊:修改模塊需要包含修改按鈕和刪除按鈕,點(diǎn)擊修改按鈕則進(jìn)入修改界面,將修改的用戶所有信息放在一個(gè)表單中,其中用戶的ID不可改動(dòng),針對(duì)修改后的信息進(jìn)行不匹配篩選,有則彈出提示,無則保存提交數(shù)據(jù)庫更新信息。
搜索模塊:搜索模塊針對(duì)用戶需要的信息進(jìn)行模糊匹配,將搜索信息提交數(shù)據(jù)庫進(jìn)行查詢輸出,沒有查詢到就展示無結(jié)果或提示更換關(guān)鍵詞。
3.程序功能測(cè)試及截圖
3.1程序代碼測(cè)試
//每一個(gè)小標(biāo)題都需要建一個(gè)PHP文件
?
數(shù)據(jù)庫快速連接:
<?php
//連接數(shù)據(jù)庫
$link = mysqli_connect("localhost", "root", "123456", "數(shù)據(jù)庫名","3306");
if($link == false)
{
??? die("連接數(shù)據(jù)庫失敗!");
}
?>
首頁代碼:
<?php
//連接數(shù)據(jù)庫
include_once "sqlcon.php";
$sql=<<<ztbu
select * from student;
ztbu;
$query = mysqli_query($link,$sql);
$infos = mysqli_fetch_all($query,MYSQLI_ASSOC);
//定義分頁
//每頁信息條數(shù)
$perpage=5;
//總信息條數(shù)
$total_num=count($infos);
//總頁數(shù)
$total_page=ceil($total_num/$perpage);
//第一頁
$page=isset($_GET['page'])?$_GET['page']:1;
//設(shè)定第一條信息
$start_index=$perpage*($page-1);
//最后一條信息
$end_index=$perpage*$page-1;
$end_index=min($end_index,$total_num-1);
?>
<style>
??? html{
??????? background-color: bisque;
??? }
??? #login_div{
??????? height: 200px;
??????? background-color: bisque;
??? }
??? #td{
???? ???font-size: 20px;
??????? font-weight: bolder;
??? }
??? #head{
??????? position: absolute;
??????? padding-left: 500px;
?????? ?top: 100px;
??? }
??? .show{
??????? position: relative;
??????? width: 800px;
??????? left: 270px;
??????? bottom: 50px;
?? ?????background-color: aliceblue;
??????? border:thin solid black;
??????? height: 400px;
??????? overflow-x: hidden;
??????? overflow-y: scroll;
??????? line-height: 30px;
??? }
??? .select{
??????? position: relative;
??????? left: 700px;
??????? top:-107px;
??? }
??? .denglu{
??????? position: absolute;
??????? right: 450px;
??????? top: 103px;
??????? z-index: 99;
??? }
??? .zhuce {
??????? position: absolute;
??????? right: 390px;
??????? top: 103px;
??????? z-index: 99;
??? }
</style>
<head>
??? <meta charset="utf-8">
??? <title>會(huì)員信息管理系統(tǒng)</title>
</head>
<body? style="background-image: url('img/1.png')">
<!--登錄注冊(cè)添加跳轉(zhuǎn)界面-->
??? <div id="login_div"? style="background-image: url('img/1.png')">
??????? <button class="denglu"><a href="loginfront.php">登錄</a></button>
??????? <button class="zhuce"><a href=" zhuce.php">注冊(cè)</a></button>
??? </div>
<!--#首頁標(biāo)簽-->
??? <div align="center" id="head">
??????? <tr>
??????????? <td><a href="login.php" id="td"? style=" position: relative;left: -200px;">首頁</a></td>
??????????? <td><a href="insert.php" id="td" style=" position: relative;left: -100px;">添加</a></td>
??????????? <td><a href="alter.php" id="td">修改</a></td>
??????? </tr>
??? </div>
<!--搜索欄-->
<div>
??? <form action="selectok.php" method="post" class="select">
??????? <tr>
??????????? <td ><input type="text" name="text" value="請(qǐng)輸入關(guān)鍵詞進(jìn)行搜索" onclick="this.value=''"></td>
??????????? <td> <button? name="select" style="margin-left: 20px">搜索</button></td>
??????? </tr>
??? </form>
</div>
<!--信息展示窗口-->
??? <div class="show">
??????? <h1 align="center">會(huì)員信息表</h1>
??????? <table? border="1" align="center" width="783" cellspacing="1" cellpadding="1" bgcolor="#ffe4c4">
??????????? <tr align="center">
??????????????? <th>編號(hào)</th>
??????????????? <th>姓名</th>
??????????????? <th>性別</th>
??????????????? <th>年齡</th>
??????????????? <th>地址</th>
??????????? </tr>
??????????? <?php
??????????? for($i=$start_index;$i<=$end_index;$i++)
??????????? {
??????????????? echo "<tr>";
??????????????? echo "<td align='center'>",$infos[$i]["id"],"</td>";
??????????????? echo "<td align='center'>",$infos[$i]["name"],"</td>";
??????????????? echo "<td align='center'>",$infos[$i]["sex"],"</td>";
??????????????? echo "<td align='center'>",$infos[$i]["age"],"</td>";
??????????????? echo "<td align='center'>",$infos[$i]["adress"],"</td>";
??????????????? echo "</tr>";
??????????? }
??????????? echo '<tr>';
??????????? echo "<td colspan='5' align='center'><a href='?page=1' >【首頁】</a>";
??????????? $prepage=($page-1)<1?1:($page-1);
??????????? //判斷當(dāng)前頁是否為首頁,若為首頁,則上一頁的超鏈接無效,仍為首頁
??????????? echo "<a href='?page=$prepage'>【上一頁】</a>";
??????????? $nextpage=($page+1)>$total_page?$total_page:($page+1);
??????????? //判斷當(dāng)前頁是否為尾頁,若為尾頁,則下一頁的超鏈接無效,仍為尾頁
? ??????????echo "<a href='?page=$nextpage'>【下一頁】</a>";
??????????? echo "<a href='?page=$total_page'>【尾頁】</a>";
??????????? echo "</td></tr>";
????????? ???>
??????? </table>
??? </div>
</body>
登錄展示界面:
<style>
??? html,body{
??????? background-color: bisque;
??????? background-size: 100% 100%;
??????? background-image: url('img/1.png');
??? }
??? .tb {
??????? align-content: center;
??? }
??? tr {
??????? border: 3px solid yellow;
??? }
??? td {
??????? #position: absolute;
??????? border: 1px? black;
??? }
</style>
<form? action="logincheck.php" method="post" class="tb">
??? <table align="center" >
??????? <tr>
??????????? <td colspan="2" align="center"><h2>用戶登錄</h2></td>
??????? </tr>
?????? <tr>
?????????? <td>用戶名:</td>
?????????? <td><input type="text" name="username" ></td>
?????? </tr>
??????? <tr>
??????????? <td>密碼:</td>
??????????? <td><input type="text" name="password"></td>
??????? </tr>
??????? <tr>
??????????? <td colspan="2" align="center">
??????????????? <input type="submit" value="登錄" style="margin-left: 65px">
??????????????? <input type="button" value="注冊(cè)" style="margin-left: 70px;margin-top: 10px"
??????????????????? onclick="window.location.href='zhuce.php'">
??????????? </td>
??????? </tr>
??? </table>
</form>
登錄信息驗(yàn)證代碼:
<?php
//獲取用戶名和密碼
$username=$_POST["username"];
$password=$_POST["password"];
//連接數(shù)據(jù)庫
include_once "sqlcon.php";
$sql=<<<ztbu
select * from login where username="{$username}" and password="{$password}";
ztbu;
$query=mysqli_query($link,$sql);
$number=mysqli_num_rows($query);
if($number>0){
??? echo "<script>alert('歡迎登錄!')</script>";
??? header("refresh:1;url=login.php");
}
else{
??? echo "<script>alert('你不是合法用戶,請(qǐng)重新登錄!')</script>";
??? header("refresh:1;url=loginfront.php");
}
?>
注冊(cè)展示界面:
<style>
??? html{
? ??????background-color: bisque;
??????? background-size: 100% 100%;
??????? background-image: url('img/1.png');
??? }
</style>
<form? action="zhuceok.php" method="post" >
??? <table align="center" >
??????? <tr>
??????????? <td colspan="2" align="center"><h2>用戶注冊(cè)</h2></td>
??????? </tr>
??????? <tr>
??????????? <td>用戶名:</td>
??????????? <td><input type="text" name="username" ></td>
??????? </tr>
??????? <tr>
??????????? <td>密碼:</td>
??????????? <td><input type="password" name="password"></td>
?? ?????</tr>
??????? <tr>
??????????? <td>確認(rèn)密碼:</td>
??????????? <td><input type="password" name="okpassword"></td>
??????? </tr>
??????? <tr>
??????????? <td colspan="2" align="center">
??????????????? <input type="submit" value="注冊(cè)" style="margin-top: 10px;margin-left: 80px">
??????????????? <input type="button" value="返回" style="margin-left: 70px;"
????????????????????? onclick="window.location.href='loginfront.php'">
??????????? </td>
??????? </tr>
??? </table>
</form>
注冊(cè)信息驗(yàn)證代碼:
<?php
//獲取用戶填寫的注冊(cè)信息
$username=$_POST["username"];
$password=$_POST["password"];
$okpassword=$_POST["okpassword"];
//判斷用戶信息是否重復(fù)注冊(cè)
//連接數(shù)據(jù)庫
include_once "sqlcon.php";
//定義輸出語句
$sql1=<<<ztbu
select * from login where username='{$username}';
ztbu;
$query=mysqli_query($link,$sql1);
$number=mysqli_num_rows($query);
if($number>0){
??? echo "<script>alert('該用戶已存在!請(qǐng)重新注冊(cè)')</script>";
??? header("refresh:1;url=zhuce.php");
}
elseif(strcmp($password, $okpassword) == 0) {//密碼相等
??? if ($username==null)
??? {
??? ????echo "<script>alert('用戶名不能為空!請(qǐng)重新注冊(cè)!')</script>";
??????? header("refresh:1;url=zhuce.php");
??? }elseif ($okpassword == null or $password==null) {
??????? echo "<script>alert('密碼不能為空!請(qǐng)重新注冊(cè)!')</script>";
??????? header("refresh:1;url=zhuce.php");
??? }
??? else{
??????????? $sql2=<<<ztbu
insert into login(username,password,sex,age)values("{$username}","{$password}","暫無","暫無");
ztbu;
??????????? $query=mysqli_query($link,$sql2);
??????????? if($query==true){
????? ??????????echo "<script>alert('注冊(cè)成功!請(qǐng)登錄!')</script>";
??????????????? header("refresh:1;url=loginfront.php");
??????????? }
??????????? else{
??????????????? echo "<script>alert('注冊(cè)失??!請(qǐng)重新注冊(cè)!')</script>";
??????????????? header("refresh:1;url=zhuce.php");
??????????? }
??????? }
}
else {
??? echo "<script>alert('密碼不一致!請(qǐng)重新注冊(cè)!')</script>";
??? header("refresh:1;url=zhuce.php");
}
?>
修改界面:
<?php
//連接數(shù)據(jù)庫
include_once "sqlcon.php";
$sql=<<<ztbu
select * from student;
ztbu;
$query = mysqli_query($link,$sql);
$infos = mysqli_fetch_all($query,MYSQLI_ASSOC);
//定義分頁
//每頁信息條數(shù)
$perpage=5;
//總信息條數(shù)
$total_num=count($infos);
//總頁數(shù)
$total_page=ceil($total_num/$perpage);
//第一頁
$page=isset($_GET['page'])?$_GET['page']:1;
//設(shè)定第一條信息
$start_index=$perpage*($page-1);
//最后一條信息
$end_index=$perpage*$page-1;
$end_index=min($end_index,$total_num-1);
?>
<style>
??? html{
??????? background-color: bisque;
??? }
??? #login_div{
??????? height: 200px;
??????? background-color: bisque;
??? }
?? ?#td{
??????? font-size: 20px;
??????? font-weight: bolder;
??? }
??? #head{
??????? position: absolute;
??????? padding-left: 500px;
??????? top: 100px;
??? }
??? .show{
??????? position: relative;
??????? width: 800px;
??????? left: 270px;
??????? bottom: 50px;
??????? background-color: aliceblue;
??????? border:thin solid black;
??????? height: 400px;
??????? overflow-x: hidden;
??????? overflow-y: scroll;
??????? line-height: 30px;
??? }
??? .select{
??????? position: relative;
??????? left: 700px;
??????? top:-107px;
??? }
??? .denglu{
??????? position: absolute;
??????? right: 450px;
??????? top: 103px;
??????? z-index: 99;
??? }
??? .zhuce {
??????? position: absolute;
??????? right: 390px;
??????? top: 103px;
??????? z-index: 99;
??? }
</style>
<head>
??? <meta charset="utf-8">
??? <title>會(huì)員信息管理系統(tǒng)</title>
</head>
<body? style="background-image: url('img/1.png')">
<!--登錄注冊(cè)添加跳轉(zhuǎn)界面-->
<div id="login_div"? style="background-image: url('img/1.png')">
??? <button class="denglu"><a href="loginfront.php">登錄</a></button>
??? <button class="zhuce"><a href=" zhuce.php">注冊(cè)</a></button>
</div>
<!--#首頁標(biāo)簽-->
<div align="center" id="head">
??? <tr>
??????? <td><a href="login.php" id="td"? style=" position: relative;left: -200px;">首頁</a></td>
?? ?????<td><a href="insert.php" id="td" style=" position: relative;left: -100px;">添加</a></td>
??????? <td><a href="alter.php" id="td">修改</a></td>
??? </tr>
</div>
<!--搜索欄-->
<div>
??? <form action="selectok.php" method="post" class="select">
??????? <tr>
? ??????????<td ><input type="text" name="text" value="請(qǐng)輸入關(guān)鍵詞進(jìn)行搜索" onclick="this.value=''"></td>
??????????? <td> <button? name="select" style="margin-left: 20px">搜索</button></td>
??????? </tr>
??? </form>
</div>
<!--信息展示窗口-->
<div class="show">
??????? <h1 align="center">會(huì)員信息修改</h1>
??? <table? border="1" align="center" width="783" cellspacing="1" cellpadding="1" bgcolor="#ffe4c4">
??????? <tr align="center">
??????????? <th>編號(hào)</th>
??????????? <th>姓名</th>
??????????? <th>性別</th>
??????????? <th>年齡</th>
??????????? <th>地址</th>
??????????? <th colspan="2">操作</th>
??????? </tr>
??????? <?php
??????? for($i=$start_index;$i<=$end_index;$i++)
??????? {
??????????? echo "<tr>";
??????????? echo "<td align='center'>",$infos[$i]["id"],"</td>";
??????????? echo "<td align='center'>",$infos[$i]["name"],"</td>";
??????????? echo "<td align='center'>",$infos[$i]["sex"],"</td>";
??????????? echo "<td align='center'>",$infos[$i]["age"],"</td>";
??????????? echo "<td align='center'>",$infos[$i]["adress"],"</td>";
??????????? ?>
??????????? <td align="center"><a href="update.php?uid=<?php echo $infos[$i]['id']?>">修改</a></td>
??????????? <td align="center"><a href="delete.php?uid=<?php echo $infos[$i]['id']?>">刪除</a></td>
??????????? <?php
??????????? echo "</tr>";
??????? }
??????? echo "<tr>";
??????? echo "<td colspan='7' align='center'><a href='?page=1' >【首頁】</a>";
??????? $prepage=($page-1)<1?1:($page-1);
??????? //判斷當(dāng)前頁是否為首頁,若為首頁,則上一頁的超鏈接無效,仍為首頁
??????? echo "<a href='?page=$prepage'>【上一頁】</a>";
??????? $nextpage=($page+1)>$total_page?$total_page:($page+1);
??????? //判斷當(dāng)前頁是否為尾頁,若為尾頁,則下一頁的超鏈接無效,仍為尾頁
??????? echo "<a href='?page=$nextpage'>【下一頁】</a>";
??????? echo "<a href='?page=$total_page'>【尾頁】</a>";
??????? echo "</td></tr>";
??????? ?>
??? </table>
</div>
</body>
修改信息展示界面:
<?php
//連接數(shù)據(jù)庫
include_once "sqlcon.php";
$sql=<<<ztbu
select * from student;
ztbu;
$query = mysqli_query($link,$sql);
$infos = mysqli_fetch_all($query,MYSQLI_ASSOC);
//定義分頁
//每頁信息條數(shù)
$perpage=5;
//總信息條數(shù)
$total_num=count($infos);
//總頁數(shù)
$total_page=ceil($total_num/$perpage);
//第一頁
$page=isset($_GET['page'])?$_GET['page']:1;
//設(shè)定第一條信息
$start_index=$perpage*($page-1);
//最后一條信息
$end_index=$perpage*$page-1;
$end_index=min($end_index,$total_num-1);
?>
<style>
??? html{
??????? background-color: bisque;
??? }
??? #login_div{
??????? height: 200px;
??????? background-color: bisque;
??? }
??? #td{
??????? font-size: 20px;
??????? font-weight: bolder;
??? }
??? #head{
??????? position: absolute;
??????? padding-left: 500px;
??????? top: 100px;
??? }
??? .show{
??????? position: relative;
??????? width: 800px;
??????? left: 270px;
??????? bottom: 50px;
??????? background-color: aliceblue;
??????? border:thin solid black;
??????? height: 400px;
??????? overflow-x: hidden;
???? ???overflow-y: scroll;
??????? line-height: 30px;
??? }
??? .select{
??????? position: relative;
?? ?????left: 700px;
??????? top:-107px;
??? }
??? .denglu{
??????? position: absolute;
??????? right: 450px;
??????? top: 103px;
??????? z-index: 99;
??? }
??? .zhuce {
??????? position: absolute;
??????? right: 390px;
??????? top: 103px;
??????? z-index: 99;
??? }
</style>
<head>
??? <meta charset="utf-8">
??? <title>會(huì)員信息管理系統(tǒng)</title>
</head>
<body? style="background-image: url('img/1.png')">
<!--登錄注冊(cè)添加跳轉(zhuǎn)界面-->
<div id="login_div"? style="background-image: url('img/1.png')">
??? <button class="denglu"><a href="loginfront.php">登錄</a></button>
??? <button class="zhuce"><a href=" zhuce.php">注冊(cè)</a></button>
</div>
<!--#首頁標(biāo)簽-->
<div align="center" id="head">
??? <tr>
??????? <td><a href="login.php" id="td"? style=" position: relative;left: -200px;">首頁</a></td>
???? ???<td><a href="insert.php" id="td" style=" position: relative;left: -100px;">添加</a></td>
??????? <td><a href="alter.php" id="td">修改</a></td>
??? </tr>
</div>
<!--搜索欄-->
<div>
??? <form action="selectok.php" method="post" class="select">
??????? <tr>
???? ???????<td ><input type="text" name="text" value="請(qǐng)輸入關(guān)鍵詞進(jìn)行搜索" onclick="this.value=''"></td>
??????????? <td> <button? name="select" style="margin-left: 20px">搜索</button></td>
??????? </tr>
??? </form>
</div>
<!--信息展示窗口-->
<div class="show">
??????? <h1 align="center">會(huì)員信息修改</h1>
??? <table? border="1" align="center" width="783" cellspacing="1" cellpadding="1" bgcolor="#ffe4c4">
??????? <tr align="center">
??????????? <th>編號(hào)</th>
??????????? <th>姓名</th>
??????????? <th>性別</th>
??????????? <th>年齡</th>
????? ??????<th>地址</th>
??????????? <th colspan="2">操作</th>
??????? </tr>
??????? <?php
??????? for($i=$start_index;$i<=$end_index;$i++)
??? ????{
??????????? echo "<tr>";
??????????? echo "<td align='center'>",$infos[$i]["id"],"</td>";
??????????? echo "<td align='center'>",$infos[$i]["name"],"</td>";
??????????? echo "<td align='center'>",$infos[$i]["sex"],"</td>";
??????????? echo "<td align='center'>",$infos[$i]["age"],"</td>";
??????????? echo "<td align='center'>",$infos[$i]["adress"],"</td>";
?????????? ??>
??????????? <td align="center"><a href="update.php?uid=<?php echo $infos[$i]['id']?>">修改</a></td>
??????????? <td align="center"><a href="delete.php?uid=<?php echo $infos[$i]['id']?>">刪除</a></td>
??????????? <?php
??????????? echo "</tr>";
??????? }
? ??????echo "<tr>";
??????? echo "<td colspan='7' align='center'><a href='?page=1' >【首頁】</a>";
??????? $prepage=($page-1)<1?1:($page-1);
??????? //判斷當(dāng)前頁是否為首頁,若為首頁,則上一頁的超鏈接無效,仍為首頁
??????? echo "<a href='?page=$prepage'>【上一頁】</a>";
??????? $nextpage=($page+1)>$total_page?$total_page:($page+1);
??????? //判斷當(dāng)前頁是否為尾頁,若為尾頁,則下一頁的超鏈接無效,仍為尾頁
??????? echo "<a href='?page=$nextpage'>【下一頁】</a>";
??????? echo "<a href='?page=$total_page'>【尾頁】</a>";
??????? echo "</td></tr>";
??????? ?>
??? </table>
</div>
</body>
修改信息驗(yàn)證代碼:
<?php
//獲取修改后的最新值
$id=$_POST['id'];
$name=$_POST['name'];
$sex=$_POST['sex'];
$age=$_POST['age'];
$adress=$_POST['adress'];
//連接數(shù)據(jù)庫
include_once "sqlcon.php";
//執(zhí)行SQL語句
if(!$id)
{
??? echo "<script>alert('用戶名格式錯(cuò)誤!請(qǐng)重新輸入!')</script>";
??? header("refresh:1;url=update.php");
}
elseif (!(is_string($name)))
{
??? echo "<script>alert('用戶名輸入格式錯(cuò)誤!請(qǐng)重新輸入!')</script>";
??? header("refresh:1;url=update.php");
}
elseif ($sex!='男' and $sex!='女')
{
??? echo "<script>alert('性別輸入錯(cuò)誤!請(qǐng)重新輸入!')</script>";
??? header("refresh:1;url=update.php");
}
elseif ($age<=0 or $age>150)
{
??? echo "<script>alert('年齡輸入錯(cuò)誤!請(qǐng)重新輸入!')</script>";
??? header("refresh:1;url=update.php");
}
elseif (!(is_string($adress)))
{
??? echo "<script>alert('地址輸入錯(cuò)誤!請(qǐng)重新輸入!')</script>";
??? header("refresh:1;url=update.php");
}
else{
??? $sql = <<<ztbu
??? update student set name ="{$name}", sex="{$sex}",age="{$age}",adress="{$adress}" where id='{$id}'
??? ztbu;
??? $query = mysqli_query($link, $sql);
??? //通過$link執(zhí)行的最新操作影響的行數(shù)
??? if (mysqli_affected_rows($link)>0) {
??????? echo "<script>alert('用戶'+$id+'的信息修改成功!')</script>";
?? ?????header("refresh:1;url=login.php");
??? } else {
??????? echo "<script>alert('用戶信息修改失??!請(qǐng)重新修改!')</script>";
??????? header("refresh:1;url=update.php");
??? }
}
刪除功能代碼:
<?php
//獲取超鏈接傳遞過來的數(shù)據(jù)
$id=$_GET["uid"];
//連接數(shù)據(jù)庫
include_once "sqlcon.php";
//執(zhí)行SQL語句
$sql=<<<ztbu
delete from student where id = $id
ztbu;
$query=mysqli_query($link,$sql);//$link值在連接數(shù)據(jù)庫中,數(shù)據(jù)庫還未加載,故報(bào)錯(cuò)
if($query==true)
{
??? echo "<script>alert('刪除成功')</script>";
??? header("refresh:1;url=alter.php");
}
添加界面:
<body style="background-image: url('img/1.png')">
<form action="insertok.php" method="post">
??? <table align="center" >
??????? <tr>
??????????? <td colspan="2" align="center"><h2>添加用戶</h2></td>
??????? </tr>
? ??????<tr>
??????????? <td>編號(hào):</td>
??????????? <td><input type="text" name="id"></td>
??????? </tr>
??????? <tr>
??????????? <td>姓名:</td>
??????????? <td><input type="text" name="name"></td>
??????? </tr>
??????? <tr>
??????????? <td>性別:</td>
??????????? <td><input type="text" name="sex" ></td>
??????? </tr>
? ??????<tr>
??????????? <td>年齡:</td>
??????????? <td><input type="text" name="age"></td>
??????? </tr>
??????? <tr>
??????????? <td>地址:</td>
??????????? <td><input type="text" name="adress"></td>
??? ????</tr>
??????? <tr>
??????????? <td colspan="2" align="center">
??????????????? <input type="submit" value="保存" style="margin-left: 50px">
??????????????? <input type="button" value="返回" style="margin-left: 65px;margin-top: 10px"
??????????????? onclick="window.location.href='login.php'">
??????????? </td>
??????? </tr>
??? </table>
</form>
</body>>
添加信息驗(yàn)證代碼:
<?php
$id=$_POST['id'];
$name=$_POST['name'];
$sex=$_POST['sex'];
$age=$_POST['age'];
$adress=$_POST['adress'];
include_once "sqlcon.php";
//用戶插入信息篩選
if(!(is_string($name)))
{
??? echo "<script>alert('用戶名格式錯(cuò)誤!請(qǐng)重新輸入!')</script>";
??? header("refresh:1;url=update.php");
}
elseif ($sex!='男' and $sex!='女')
{
??? echo "<script>alert('性別輸入錯(cuò)誤!請(qǐng)重新輸入!')</script>";
??? header("refresh:1;url=update.php");
}
elseif ($age<=0 or $age>150)
{
??? echo "<script>alert('年齡輸入錯(cuò)誤!請(qǐng)重新輸入!')</script>";
??? header("refresh:1;url=update.php");
}
elseif (!(is_string($adress)))
{
??? echo "<script>alert('地址輸入錯(cuò)誤!請(qǐng)重新輸入!')</script>";
??? header("refresh:1;url=update.php");
}
elseif (!$id)
{
??? echo "<script>alert('用戶ID輸入錯(cuò)誤!請(qǐng)重新輸入!')</script>";
??? header("refresh:1;url=update.php");
}else {
??? $sql = <<<ztbu
insert into student (id, name, sex, age, adress)values('$id','$name','$sex','$age','$adress');
ztbu;
??? $query = mysqli_query($link, $sql);
??? if(mysqli_num_rows($query)>0)
??? {
??????? echo "<script>alert('此用戶已存在,請(qǐng)重新添加!')</script>";
??????? header("refresh:1;url=update.php");
??? }
??? elseif($query == true) {
??????? echo "<script>alert('用戶添加成功!')</script>";
??????? header("refresh:1;url=login.php");
??? } else {
??????? echo "<script>alert('添加用戶失??!請(qǐng)重新添加!')</script>";
??????? header("refresh:1;url=insert.php");
??? }
}
搜索代碼:
<?php
$text=$_POST["text"];
$select=$_POST['select'];
//連接數(shù)據(jù)庫
include_once "sqlcon.php";
//SQL執(zhí)行語句
?>
<style>
html{
??? background-color: bisque;
??? }
??? #login_div{
??????? height: 200px;
??????? background-color: bisque;
??? }
??? #td{
??????? font-size: 20px;
??????? font-weight: bolder;
??? }
??? #head{
??????? position: absolute;
??????? padding-left: 500px;
??????? top: 100px;
??? }
??? .show{
??? position: relative;
??? width: 800px;
??????? left: 270px;
??????? bottom: 50px;
??????? background-color: aliceblue;
??????? border:thin solid black;
??????? height: 400px;
??????? overflow-x: hidden;
??????? overflow-y: scroll;
??????? line-height: 30px;
??? }
.select{
??? position: relative;
??? left: 700px;
??? top:-107px;
}
.denglu{
??? position: absolute;
??? right: 450px;
??? top: 103px;
??? z-index: 99;
}
.zhuce {
??? position: absolute;
??? right: 390px;
??? top: 103px;
??? z-index: 99;
}
</style>
<head>
??? <meta charset="utf-8">
??? <title>會(huì)員信息管理系統(tǒng)</title>
</head>
<body? style="background-image: url('img/1.png')">
<!--登錄注冊(cè)添加跳轉(zhuǎn)界面-->
??? <div id="login_div"? style="background-image: url('img/1.png')">
??????? <button class="denglu"><a href="loginfront.php">登錄</a></button>
??????? <button class="zhuce"><a href=" zhuce.php">注冊(cè)</a></button>
??? </div>
<!--#首頁標(biāo)簽-->
??? <div align="center" id="head">
??????? <tr>
??????? ????<td><a href="login.php" id="td"? style=" position: relative;left: -200px;">首頁</a></td>
??????????? <td><a href="insert.php" id="td" style=" position: relative;left: -100px;">添加</a></td>
??????????? <td><a href="alter.php" id="td">修改</a></td>
??????? </tr>
??? </div>
<!--搜索欄-->
<div>
??? <form action="selectok.php" method="post" class="select">
??????? <tr>
??????????? <td ><input type="text" name="text" value="請(qǐng)輸入關(guān)鍵詞進(jìn)行搜索" onclick="this.value=''"></td>
??????????? <td> <button? name="select" style="margin-left: 20px">搜索</button></td>
??????? </tr>
??? </form>
</div>
<!--信息展示窗口-->
<div class="show">
??? <h1 align="center">信息查詢結(jié)果</h1>
??? <table? border="1" align="center" width="783" cellspacing="1" cellpadding="1" bgcolor="#ffe4c4">
??????? <?php
?? ?????if($text) {
??????????? $sql = <<<ztbu
??????????? select * from student where id like "%{$text}%" or name like "%%{$text}%%"or sex="{$text}" or age="{$text}"or adress like "%%{$text}%%"
??????????? ztbu;
??????????? $query = mysqli_query($link, $sql);
??????????? $sql2 =mysqli_num_rows($query);
??????????????? if($sql2>0) {
??????????? ?>
??????????? <tr align="center">
??????????????? <th>編號(hào)</th>
??????????????? <th>姓名</th>
??????????????? <th>性別</th>
??????????????? <th>年齡</th>
??????????????? <th>地址</th>
??????????? </tr>
??????? <?php
??????????????? foreach ($query as $a => $b) {
??????????????????? echo '<tr align="center">';
??????????????????? foreach ($b as $key => $value) {
??????????????????????? echo '<td align="center">' . $value . '</td>';
??????????????????? }
??????????? ????????echo '</tr>';
??????????????? }
??????????? }else{
??????????????????? echo '<td align="center" id="td">沒有查詢到相關(guān)信息!</td>';
??????????? }
??????? }else{
??????????? echo '<td align="center" id="td">請(qǐng)輸入關(guān)鍵詞進(jìn)行查詢!</td>';
??????? }
??????? ?>
??? </table>
</div>
</body>
3.2功能演示(界面)
???????????????
?登錄界面
注冊(cè)界面
首頁
?添加界面
修改界面
確認(rèn)修改界面
搜索界面
?數(shù)據(jù)庫student表(會(huì)員信息表)
?數(shù)據(jù)庫login表
?文章來源:http://www.zghlxwxcb.cn/news/detail-500997.html
4.總結(jié)與收獲
通過這次對(duì)會(huì)員信息管理系統(tǒng)的實(shí)現(xiàn),我對(duì)PHP程序的基礎(chǔ)知識(shí)的記憶更加牢固了,對(duì)這些數(shù)據(jù)類型的使用也有了進(jìn)一步提升,雖然這個(gè)課題是老師帶著一個(gè)模塊一個(gè)模塊分開授課的,但是自己獨(dú)立地從頭編寫過來還是很有收獲的,對(duì)這個(gè)簡(jiǎn)易的系統(tǒng)已經(jīng)在腦海中形成了一套自己的構(gòu)建模型,相信這些經(jīng)驗(yàn)?zāi)軌蚴刮以诤髞淼膶W(xué)習(xí)中更上一層樓。文章來源地址http://www.zghlxwxcb.cn/news/detail-500997.html
到了這里,關(guān)于PHP結(jié)課報(bào)告 《會(huì)員信息管理系統(tǒng)》的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!