开发环境:win10+Xmapp+PHPstorm
一、 需求分析
- 基本的数据信息
- 企业信息
企业编号,企业名称,用户名,密码,企业地址,邮箱 - 用户信息
个人用户编号,用户名,密码,姓名,邮箱 - 新闻信息
新闻编号,新闻标题,新闻内容,新闻图片,新闻来源,发布时间,点击次数 - 招聘信息
招聘信息编号,企业编号,企业名称,企业类型,邮箱,电话,地址,邮政编码,工作职位,招聘人数,工作城市,工作描述,发布时间,点击次数 - 个人简历信息
求职信息编号,个人用户编号,用户名, 性别,邮箱,电话,地址,邮政编码,教育程度,特长,工作类型,工作职位,工作城市,期望工资,自我介绍,发布时间,点击次数 - 在线申请表
提交简历编号,个人用户编号,企业编号,姓名,企业名称,招聘职位,应聘职位
- 企业信息
- 需要实现的功能
- 企业信息管理
企业信息维护,企业新闻发布,招聘信息发布,应聘人员信息查询,求职人员管理 - 个人用户管理
用户注册,简历更新,求职信息发布,求职意向管理,浏览新闻,招聘信息查询,在线提交简历申请表 - 系统管理
新闻发布,新闻管理,个人用户管理,企业用户管理,系统维护
- 企业信息管理
二、 概念结构设计
三、 逻辑结构设计
企业信息(企业编号,企业名称,用户名,密码,企业地址,邮箱)
用户信息(个人用户编号,用户名,密码,姓名,邮箱)
新闻信息(新闻编号,新闻标题,新闻内容,新闻图片,新闻来源,发布时间,点击次数)
招聘信息(招聘信息编号,企业用户编号,企业名称,企业类型,邮箱,电话,地址,邮政编码,工作职位,招聘人数,工作城市,工作描述,发布时间,点击次数)
个人简历信息(求职信息编号,个人用户编号,用户名,姓名,邮箱,电话,地址,邮政编码,教育程度,特长,工作类型,工作职位,工作城市,期望工资,自我介绍,发布时间,点击次数)
在线申请表(提交简历编号,个人用户编号,企业编号,姓名,企业名称,招聘单位,应聘职位)
四、 物理结构设计
用PHP和Xampp建立自己的服务器端,并且实现建立自己的数据库和基本表
结果如下图所示:
现在主流的DBMS一般都采用的是索引法和HASH法。其中最常用的是索引法,所以我在经常需要搜索的列和主关键字上建立了唯一的索引。
并且添加外键:
五、 数据库实施
主要源码如下:
发布职位.php:
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>企业登录</title>
<link rel="shortcut icon" href="../img/20181229051952188_easyicon_net_16.ico">
<link rel="stylesheet" href="../css/发布职位.css">
<script type="text/javascript" src="../js/jquery.js"></script>
<script src="../js/发布职位.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/enterprise_register.js" type="text/javascript" charset="urf-8"></script>
</head>
<body>
<div class="all">
<div class="content">
<div class="top">
<div class="first pull-left active">
账号登陆
</div>
<div class="second pull-right">
短信快捷登陆
</div>
</div>
<div class="mid">
<div class="account">
<div class="ac">
<form action="account_login.php" method="post">
<div class="move pull-left clear-fix">
<img src="../img/icon-id card.png" alt="" width="20" height="20">
</div>
<input class="pull-left clear-fix" name="username" type="text" placeholder="用户名"><br>
<div class="move pull-left clear-fix">
<img src="../img/icon-pen.png" alt="" width="20" height="20">
</div>
<input class="pull-left clear-fix" name="password" type="password" placeholder="密码"><br>
<div class="move pull-left clear-fix">
<img src="../img/icon-right.png" alt="" width="20" height="20">
</div>
<input class="yan pull-left clear-fix" type="text" name="captcha" placeholder="验证码">
<img class="captcha pull-right clear-fix" src="image_captcha.php" alt="" onclick="this.src='image_captcha.php?'+new Date().getTime();" width="200" height="200" ><br>
<input class="log" type="submit" value="登录">
<div class="forget">
<a href="retrieve.php">密码遗失了?点这里试试</a><br>
<a href="enterprise_register.php">还没有账号?来注册一个</a>
</div>
</form>
</div>
</div>
<div class="phone">
<div class="ph">
<form action="phone_login.php" method="post">
<div class="move pull-left clear-fix">
<img src="../img/icon-tel.png" alt="" width="20" height="20">
</div>
<input id="telephone" name="telephone" type="text" placeholder="手机号">
<div class="move pull-left clear-fix">
<img src="../img/icon-right.png" alt="" width="20" height="20">
</div>
<input class="yan pull-left clear-fix" type="text" name="captcha" placeholder="验证码">
<img class="captcha pull-right clear-fix" src="image_captcha.php" alt="" onclick="this.src='image_captcha.php?'+new Date().getTime();" width="200" height="200" ><br>
<div class="move pull-left clear-fix">
<img src="../img/icon-mail.png" alt="" width="20" height="20">
</div>
<input name="input_message" class="other" type="text" placeholder="请输入短信验证码">
<input name="get_message" class="others" id="getCodeBtn" type="button" value="获取短信验证码" >
<input class="log" type="submit" value="登录">
<div class="forget">
<a href="enterprise_register.php">还没有账号?来注册一个</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Personal_register.php:
<head>
<title>注册</title>
<link rel="shortcut icon" href="../img/20181229051952188_easyicon_net_16.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/enterprise_register.css">
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/enterprise_register.js"></script>
</head>
<body>
<div id="all">
<div id="mid">
<form action="personal_register_action.php" method="post">
<span>姓名: </span><input type="text" class="change" name="personal_name"><br>
<span>账户名: </span><input class="one" type="text" name="account_name" /><br>
<span>密码: </span><input class="change" type="password" name="password" /><br>
<span>重复密码: </span><input class="one" type="password" name="repeat" /><br>
<span>个人地址: </span><input type="text" name="address" class="one"><br>
<span>邮箱: </span><input type="text" name="email" class="change"><br>
<span>手机号: </span><input class="change" type="text" name="telephone" id="telephone" /><br>
<span>图片验证码:</span><input class="two" type="text" name="captcha" /><br>
<img class="captcha pull-right clear-fix" src="image_captcha.php" alt="" onclick="this.src='image_captcha.php?'+new Date().getTime();" width="50" height="50" ><br>
<span>手机验证码:</span><input class="two twoo" type="text" name="check_code" /><br>
<input type="button" value="获取手机验证码" id="getCodeBtn" /><br>
<input type="reset" value="错了重填" class="three" />
<input type="submit" value="立即注册" class="three"/><br>
</form>
</div>
</div>
</body>
</html>
Enterprise_management.php:
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>企业管理</title>
<link rel="shortcut icon" href="../img/favicon-2019010107391610.ico">
<link rel="stylesheet" href="../css/enterprise_management.css">
<script type="text/javascript" src="../js/enterprise_management.js"></script>
</head>
<body>
<img id="tou_ming" class="pull-left clear-fix" src="../img/2b163928b263b7e4e4bb9c09ebcbd15f.jpg" alt="">
<table id="big" border="1" cellpadding="100" cellspacing="0">
<tr>
<th id="one" class="active">企业资料</th>
<td class="other" rowspan="5">
<div id="first">
<form action="enterprise_material.php" method="post">
<?php
$servername = "localhost:3306";
$username = "root";
$password = "";
$DB_name = "db";
global $conn;
$conn = new mysqli($servername, $username, $password, $DB_name);
if ($conn->connect_error) {
die("连接失败:" . $conn->connect_error . '\n');
} else {
// echo "连接成功.\n";
}
mysqli_set_charset($conn, 'utf8');
session_start();
$username = $_SESSION['username'];
$sql = "select * from enterprise_info where e_username='$username'";
$result = $conn->query($sql);
if ($result) {
// echo "找到了该用户";
} else {
// echo "没有找到该用户".$sql."<br>".$conn->error;
// exit("系统出错");
}
$row = mysqli_fetch_row($result);
$_SESSION['name'] = $row[1];
?>
企业名称:
<?php
echo "<input type=\"text\" id=\"name\" name=\"name\" value='$row[1]'>";
?>
<br/>
用户名:
<?php
echo "<input type=\"text\" id=\"username\" name=\"username\" value='$row[2]' readonly='readonly'>";
?>
<br/>
密码:
<?php
echo "<input type=\"text\" id=\"password\" name=\"password\" value='$row[3]'>";
?>
<br/>
企业地址:
<?php
echo "<input type=\"text\" id=\"address\" name=\"address\" value='$row[4]'>";
?>
<br/>
邮箱:
<?php
echo "<input type=\"text\" id=\"email\" name=\"email\" value='$row[5]'>";
?>
<input type="submit" class="change" value="确认修改">
</form>
</div>
<div id="second">
<form action="publish_news.php" method="post">
标题:
<?php
echo "<input type=\"text\" id=\"title\" name=\"title\">";
?>
内容:
<?php
echo "<input type=\"text\" id=\"content\" name=\"content\">";
?><br>
图片:
<?php
echo "<input type=\"text\" id=\"picture\" name=\"picture\">";
?>
来源:
<?php
echo "<input type=\"text\" id=\"resource\" name=\"resource\">";
?><br>
<input class="change" type="submit" value="确认发布">
</form>
</div>
<div id="third">
<form action="publish_recruit.php" method="post">
企业名称:
<?php
echo "<input type=\"text\" id=\"e_name\" name=\"e_name\">";
?>
企业类型:
<?php
echo "<input type=\"text\" id=\"types\" name=\"types\">";
?>
邮箱:
<?php
echo "<input type=\"text\" id=\"e_email\" name=\"e_email\">";
?><br>
电话:
<?php
echo "<input type=\"text\" id=\"phone\" name=\"phone\">";
?>
地址:
<?php
echo "<input type=\"text\" id=\"e_address\" name=\"e_address\">";
?>
邮政编码:
<?php
echo "<input type=\"text\" id=\"zip\" name=\"zip\">";
?><br>
工作职位:
<?php
echo "<input type=\"text\" id=\"position\" name=\"position\">";
?>
招聘人数:
<?php
echo "<input type=\"text\" id=\"count\" name=\"count\">";
?>
工作城市:
<?php
echo "<input type=\"text\" id=\"city\" name=\"city\">";
?><br>
工作描述:
<?php
echo "<input type=\"text\" id=\"description\" name=\"description\">";
?>
<br>
<input class="change" type="submit" value="确认发布">
</form>
</div>
<div id="fourth">
<input type="button" value="点击查询" onclick="window.location.href='search_employment.php'">
</div>
<div id="fifth">
<table cellpadding="100" cellspacing="0" border="1">
<tr id="header">
<td>姓名</td>
<td>手机号</td>
<td colspan="2"></td>
</tr>
<?php
$e_name = $_SESSION['name'];
$sql = "SELECT o_u_id FROM online_apply WHERE o_e_name='$e_name'";
$result = $conn->query($sql);
if ($result) {
if ($result->num_rows> 0) {
$j = $result->num_rows;
while ($j > 0) {
$row=$result->fetch_row();
$u_id = $row[0];
$sql="SELECT p_u_username,p_u_phone FROM personal_resume WHERE p_u_id='$u_id'";
$res=$conn->query($sql);
if($res){
$row=$res->fetch_row();
$u_username=$row[0];
$_SESSION['r_name['.$j.']']=$u_username;
$u_phone=$row[1];
echo "<tr>";
echo "<td>$u_username</td>";
echo "<td>$u_phone</td>";
echo "<td><button class='changes'>接受</button></td>";
echo "<td><button class='changes refuse'>拒绝</button></td>";
echo "</tr>";
}else{
echo "系统错误";
}
$j--;
}
}else{
echo "<script>alert('没有求职人员');</script>";
}
}else{
echo "failed".$sql."<br>".$conn->error;
}
?>
</table>
</div>
</td>
</tr>
<tr>
<th id="two">新闻发布</th>
</tr>
<tr>
<th id="three">招聘信息发布</th>
</tr>
<tr>
<th id="four">应聘人员信息查询</th>
</tr>
<tr>
<th id="five">求职人员管理</th>
</tr>
</table>
<?php
$conn->close();
?>
</body>
</html>
Personal_management.php:
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>个人管理</title>
<link rel="shortcut icon" href="../img/favicon-20190101073916688.ico">
<link rel="stylesheet" href="../css/personal_management.css">
<script type="text/javascript" src="../js/personal_management.js"></script>
</head>
<body>
<img id="tou_ming" class="pull-left clear-fix" src="../img/2b163928b263b7e4e4bb9c09ebcbd15f.jpg" alt="">
<table border="1" cellpadding="100" cellspacing="0">
<tr>
<th id="one" class="active">个人资料</th>
<td class="other" rowspan="5">
<div id="first">
<form action="personal_material.php" method="post">
<?php
$servername = "localhost:3306";
$username = "root";
$password = "";
$DB_name = "db";
global $conn;
$conn = new mysqli($servername, $username, $password, $DB_name);
if ($conn->connect_error) {
die("连接失败:" . $conn->connect_error . '\n');
} else {
// echo "连接成功.\n";
}
mysqli_set_charset($conn,'utf8');
session_start();
$username=$_SESSION['username'];
$sql="select * from user_info where u_username='$username'";
$result=$conn->query($sql);
if($result){
// echo "找到了该用户";
}else{
// echo "没有找到该用户".$sql."<br>".$conn->error;
// exit("系统出错");
}
$row=mysqli_fetch_row($result);
?>
姓名:
<?php
echo "<input type=\"text\" id=\"name\" name=\"name\" value='$row[1]'>";
?>
<br/>
用户名:
<?php
echo "<input type=\"text\" id=\"username\" name=\"username\" value='$row[2]' readonly='readonly'>";
?>
<br/>
密码:
<?php
echo "<input type=\"text\" id=\"password\" name=\"password\" value='$row[3]'>";
?>
<br/>
邮箱:
<?php
echo "<input type=\"text\" id=\"email\" name=\"email\" value='$row[4]'>";
?>
<input type="submit" class="change" value="确认修改">
</form>
</div>
<div id="second">
<form action="apply_resume.php" method="post">
<?php
$sql="select * from personal_resume where p_u_username='$username'";
$result=$conn->query($sql);
if($result->num_rows>0){
echo "<script>alert('欢迎您'.'$username');</script>";
}else{
echo "<script>alert('请完善您的简历');</script>";
}
$row=mysqli_fetch_row($result);
?>
用户名:
<?php
echo "<input type=\"text\" id=\"a_name\" name=\"a_name\" value='$row[2]' readonly='readonly'>";
?>
性别:
<?php
echo "<input type=\"text\" id=\"sex\" name=\"sex\" value='$row[3]'>";
?>
邮箱:
<?php
echo "<input type=\"text\" id=\"a_email\" name=\"a_email\" value='$row[4]'>";
?><br>
电话:
<?php
echo "<input type=\"text\" id=\"phone\" name=\"phone\" value='$row[5]'>";
?>
地址:
<?php
echo "<input type=\"text\" id=\"address\" name=\"address\" value='$row[6]'>";
?>
邮政编码:
<?php
echo "<input type=\"text\" id=\"zip\" name=\"zip\" value='$row[7]'>";
?><br>
教育程度:
<?php
echo "<input type=\"text\" id=\"education\" name=\"education\" value='$row[8]'>";
?>
特长:
<?php
echo "<input type=\"text\" id=\"special\" name=\"special\" value='$row[9]'>";
?>
工作类型:
<?php
echo "<input type=\"text\" id=\"types\" name=\"types\" value='$row[10]'>";
?><br>
工作职位:
<?php
echo "<input type=\"text\" id=\"position\" name=\"position\" value='$row[11]'>";
?>
工作城市:
<?php
echo "<input type=\"text\" id=\"city\" name=\"city\" value='$row[12]'>";
?>
期望工资:
<?php
echo "<input type=\"text\" id=\"salary\" name=\"salary\" value='$row[13]'>";
?><br>
自我介绍:
<?php
echo "<textarea id=\"myself\" name=\"myself\">$row[14]</textarea>";
?>
发布时间:
<?php
echo "<input type=\"text\" id=\"time\" name=\"time\" value='$row[15]' readonly='readonly'>";
?>
点击次数:
<?php
echo "<input type=\"text\" id=\"num\" name=\"num\" value='$row[16]' readonly='readonly'>";
?><br>
<input class="change" type="submit" value="提交简历">
</form>
</div>
<div id="third">
<a href="首页.php"><img src="../img/48a6fcdfa1c598f54f2d2eca3287cc78.jpg" alt="" width="100" height="100"><span>点击图片跳转进入新闻界面</span></a>
</div>
<div id="fourth">
<form action="search_recruit_info.php" method="post">
<input type="text" id="search" name="search" placeholder="请输入企业名称">
<input class="change" type="submit" value="搜索">
</form>
</div>
<div id="fifth">
<form action="online_apply.php" method="post">
姓名:
<?php
echo "<input type=\"text\" id=\"o_u_name\" name=\"o_u_name\" >";
?><br>
企业名称:
<?php
echo "<input type=\"text\" id=\"o_e_name\" name=\"o_e_name\">";
?><br>
招聘职位:
<?php
echo "<input type=\"text\" id=\"o_e_position\" name=\"o_e_position\">";
?><br>
应聘职位:
<?php
echo "<input type=\"text\" id=\"o_u_position\" name=\"o_u_position\">";
?><br>
<input class="change" type="submit" value="提交申请">
</form>
</div>
</td>
</tr>
<tr>
<th id="two">求职管理</th>
</tr>
<tr>
<th id="three">浏览新闻</th>
</tr>
<tr>
<th id="four">招聘信息查询</th>
</tr>
<tr>
<th id="five">提交简历申请表</th>
</tr>
</table>
<?php
$conn->close();
?>
</body>
</html>
六、 数据库运行和维护
数据库运行一段时间后,由于记录不断增删改,将会使数据库的物理存储情况变坏,降低数据的存取效率,使数据库性能下降,这时数据库管理员就要对数据库进行重组织或部分重组织(只对频繁增、删的表进行重组织)。关系数据库管理系统一般都提供数据重组织的实用程序,在重组织过程中,按原设计要求重新安排存储位置、回收垃圾、减少指针链等,提高系统性能。
数据库的重组织并不修改原设计的逻辑和物理结构,而数据库的重构造是指部分修改数据库的模式和内模式。
由于数据库应用环境发生变化,增加了新的应用或新的实体,取消了某些应用,有的实体与实体间的联系也发生了变化等,使原有的数据库设计不能满足新的需求,需要调整数据库的模式和内模式。
数据库的重构也是有限的,只能做部分修改。如果应用变化太大,重构也无济于事,说明此数据库应用系统的生命周期已经结束,应该设计新的数据库应用系统了。