php实现人员信息搜索的功能的方法:1、创建conn.php文件连接人员信息数据库;2、创建index.php文件;3、通过“ if(isset($_POST[“flag”])){…}”等语句实现人员搜索功能即可。
1、首次登录需要输入访问的密码
<?php
/**
* 登录
**/
$mod='blank';
include("../include/common.php");
$title='管理登录';
include './head.php';
?>
<nav class="navbar navbar-fixed-top navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">导航按钮</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="./">系统后台</a>
</div><!-- /.navbar-header -->
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active">
<a href="./login.php"><span class="glyphicon glyphicon-user"></span> 管理登录</a>
</li>
<li>
<a href="../"><span class="glyphicon glyphicon-home"></span> 返回首页</a>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav><!-- /.navbar -->
<div class="container" style="padding-top:70px;">
<div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
<?php
if(isset($_POST['user']) && isset($_POST['pass'])){
$user=daddslashes($_POST['user']);
$user_name=$user;
$pass=daddslashes($_POST['pass']);
$pass=md5($pass);
$auth=$_POST['auth'];
$row = $DB->get_row("SELECT * FROM black_admin WHERE user='$user' limit 1");
if($row['user']=='') {
@header('Content-Type: text/html; charset=UTF-8');
exit("<script language='javascript'>alert('此用户不存在');history.go(-1);</script>");
}elseif ($pass != $row['pass']) {
@header('Content-Type: text/html; charset=UTF-8');
exit("<script language='javascript'>alert('用户名或密码不正确!');history.go(-1);</script>");
}elseif($row['user']==$user && $row['pass']==$pass){
$session=md5($user.$pass.$password_hash);
$token=authcode("{$user}\t{$session}", 'ENCODE', SYS_KEY);
setcookie("admin_token", $token, time() + 7200);
@header('Content-Type: text/html; charset=UTF-8');
exit("<script language='javascript'>alert('登陆后台成功!');window.location.href='./';</script>");
}
}elseif(isset($_GET['logout'])){
setcookie("admin_token", "", time() - 7200);
@header('Content-Type: text/html; charset=UTF-8');
exit("<script language='javascript'>alert('您已成功注销本次登陆!');window.location.href='./login.php';</script>");
}elseif($islogin==1){
exit("<script language='javascript'>alert('您已登陆!');window.location.href='./';</script>");
}
?>
<div class="panel panel-primary">
<div class="panel-heading"><h3 class="panel-title">管理登录</h3></div>
<div class="panel-body">
<form action="./login.php" method="post" class="form-horizontal" role="form">
<input type="hidden" name="backurl" value="<?php echo $_SERVER['HTTP_REFERER']; ?>"/>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
<input type="text" name="user" value="<?php echo @$_POST['user'];?>" class="form-control" placeholder="用户名" required="required"/>
</div><br/>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
<input type="password" name="pass" class="form-control" placeholder="密码" required="required"/>
</div><br/>
<div class="form-group">
<div class="col-xs-12"><input type="submit" value="登陆" class="btn btn-primary form-control"/></div>
</div>
</form>
</div>
</div>
</div>
</div>
2、普通用户在前台 输入名称进行查询相关的内容
3、在后台添加人员信息内容
4、管理后台人员列表 ,增删改查功能
名单查询系统后台代码披露
<?php
/**
* 名单查询系统后台
**/
$mod='blank';
include("../include/common.php");
$title='查询系统后台';
include './head.php';
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
?>
<nav class="navbar navbar-fixed-top navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">导航按钮</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="./">系统后台</a>
</div><!-- /.navbar-header -->
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active">
<a href="./"><span class="glyphicon glyphicon-user"></span> 后台首页</a>
</li>
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-pushpin"></span> 人员管理<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="./add.php">添加人员记录</a><li>
<li><a href="./list.php">人员列表</a></li>
<li><a href="./search.php">搜索人员</a><li>
</ul>
</li>
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-cog"></span> 系统管理<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="./siteset.php">site设置</a><li>
<li><a href="./passwd.php">修改密码</a></li>
</ul>
</li>
<li><a href="./login.php?logout"><span class="glyphicon glyphicon-off"></span> 退出管理</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav><!-- /.navbar -->
<?php
$sum=$DB->count("SELECT count(*) from black_list WHERE 1");
?>
<div class="container" style="padding-top:70px;">
<div class="col-xs-12 col-sm-10 col-lg-8 center-block" style="float: none;">
<div class="panel panel-primary">
<div class="panel-heading"><h3 class="panel-title">后台首页</h3></div>
<ul class="list-group">
<li class="list-group-item"><span class="glyphicon glyphicon-stats"></span> <b>人员数量</b> 共有:<?=$sum?>人!</li>
<li class="list-group-item"><span class="glyphicon glyphicon-time"></span> <b>现在时间:</b> <?=$date?></li>
<li class="list-group-item"><span class="glyphicon glyphicon-tint"></span> <b>欢迎你:</b> 超级管理员</li>
<li class="list-group-item"><span class="glyphicon glyphicon-list"></span> <b>功能菜单:</b>
<a href="./add.php" class="btn btn-xs btn-success">添加人员记录</a>
<a href="./passwd.php" class="btn btn-xs btn-success">修改密码</a>
</li>
</ul>
</div>
</div>
</div>