<?php 
//****************************************请求权限****************************************
require("locked.php");                                                                 //*
setlocked(-1,用户管理—恩格会计管理系统);                                                   //*
//****************************************************************************************
include("header.php");
?>

<div align="center">
<form action="" method="post" name="form1">
请输入用户名称：<input name="keyword" type="text" /><input name="ok" type="submit" value="提交" />
</form>
</div>
<table id="mytable1" align="center" width="95%">
<tr>
<td align="center"><img src="picture/b_fulltext.png" width="50" height="19" /></td>
<td>ID</td>
<td>名称</td>
<td>电话</td>
</tr>
<?php
if($_POST[ok]=="提交"){
	include("cnn.php");
	$sql=$mysqli->query('select * from user where name like "%'.$_POST[keyword].'%" order by id desc');
	$info=$sql->fetch_array(MYSQLI_BOTH);
	echo '<script language="javascript" type="text/javascript">form1.keyword.value="'.$_POST[keyword].'";</script>';
	if($info){ //如果存在数据；
		DO{
		   echo '<tr>
		   <td align="center">
		   <a href="#" onclick="openInsert()"><abbr title="新增用户"><img src="picture/b_insert.png" /></abbr></a>|
		   <a href="#" onclick="openEdit('.$info[id].')"><abbr title="修改用户"><img src="picture/b_edit.png" /></abbr></a>|
		   <a href="#" onclick="openDrop('.$info[id].')"><abbr title="删除用户"><img src="picture/b_drop.png" /></abbr></a>|
		   <a href="#" onclick="openRight('.$info[id].')"><abbr title="权限管理"><img src="picture/b_link.png" /></abbr></a>
		   </td>
		   <td>'.$info[id].'</td>
		   <td>'.$info[name].'</td>
		   <td>'.$info[telephone].'</td>
		   </tr>';
		}while($info=$sql->fetch_array(MYSQLI_BOTH));
	}
	$sql->free();
    $mysqli->close();
}else{
	echo '<tr>
    <td align="center" colspan="4">
	请使用提交按钮检索相关数据；<a href="#" onclick="openInsert()">新增</a></td>
	</tr>';
}
?>
</table>
<script language="javascript" type="text/javascript">
<!--
mytable("mytable1");
var sta="height=350,width=300,top="+(window.screen.availHeight-350)/2+",left="+(window.screen.availWidth-300)/2;
sta=sta+",toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no";
function openInsert(){
	var url="userInsert.php"
	window.open(url,"",sta);
}
function openEdit(id){
	var url="userEdit.php?keyword="+id
	window.open(url,"",sta);
}
function openDrop(id){
	var url="userDrop.php?keyword="+id
	window.open(url,"",sta);
}
function openRight(id){
	var url="userRight.php?keyword="+id
	window.open(url,"",sta);
}

//自动加载高亮显示；
HighLight();

//-->
</script>
<?php include("footer.php");?>