<?php
require_once('db_fns.php');
//提取数据
function get_ifo_1($username)
{
//extract from the database all the URLs this user has stored
$conn = db_connect();
$result = $conn->query( "select *
from ifo
where number = '$number'");
if (!$result)
return false;
//create an array of the URLs
$url_array = array();
for ($count = 1; $row = $result->fetch_row(); ++$count)
{
$url_array[$count] = $row[0];
}
return $url_array;
}
//验证是否填写完整
function filled_out($form_vars)//检查表单完整性
{
// test that each variable has a value
foreach ($form_vars as $key => $value)
{
if (!isset($key) || ($value == ''))
return false;
}
return true;
}
// 向数据库添加新数据
function add_ifo($number,$name,$xingbie,$age,$mingzu,$peiou_name,$peiou_age,$peiou_job,$school,$by_time,$zhuanye,$bumen,$zhiwei)
{
$valid_user = $_SESSION['valid_user'];
$conn = db_connect();
$result = $conn->query("select * from info
where number='$number'");
if ($result && ($result->num_rows>0))
throw new Exception('该编号已被占用 请重新输入.');
if (!$conn->query( "insert into info values
('$number', '$name', '$xingbie', '$age','$mingzu')"));
elseif (!$conn->query( "insert into peiou values
('$number', '$peiou_name', '$peiou_age', '$peiou_job')"));
elseif (!$conn->query( "insert into xueli values
('$number', '$school', '$by_time', '$zhuanye')"));
elseif (!$conn->query( "insert into job values
('$number', '$bumen', '$zhiwei')"))
throw new Exception('数据输入失败.');
return true;
}
//查找数据
function search_info()
{
$searchtype=$_POST['searchtype'];
$searchterm=$_POST['searchterm'];
$searchterm= trim($searchterm);
//if (!$searchtype || !$searchterm)
// {
// echo '您好 请您填写完整的数据';
// exit;
//}
//db_connect();
if (!get_magic_quotes_gpc())
{
$searchtype = addslashes($searchtype);
$searchterm = addslashes($searchterm);
}
@ $db = new mysqli('localhost', 'root', 'direnai1314', 'company');
if (mysqli_connect_errno())
{
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
$query ="
SELECT *
FROM info i,peiou p,xueli x ,job j
WHERE ".$searchtype." like '%".$searchterm."%'".
" AND i.number=j.number AND j.number=x.number AND x.number=p.number AND p.number=i.number AND j.number=p.number AND i.number=x.number";
$result = $db->query($query);
$num_results = $result->num_rows; ?>
<?php echo '<p>符合条件的员工有'.$num_results.'个</p>';
?><table width="778" border="0" cellpadding="0"
cellspacing="1" bgcolor="#000000">
<tr bgcolor="#FFFFFF">
<th>编号</th>
<td>姓名</td>
<td>名族</td>
<td>年龄</td>
<td>性别</td>
<td>配偶姓名</td>
<td>配偶年龄</td>
<td>配偶职业</td>
<td>毕业院校</td>
<td>毕业时间</td>
<td>专业</td>
<td>职位</td>
<td>所在部门</td>
</tr>
<?php for ($i=0; $i <$num_results; $i++)
{
?><tr bgcolor="#FFFFFF"><?php
$row = $result->fetch_assoc();
?><td><?php
echo stripslashes($row['number']);
?></td><?php
?><td><?php
echo stripslashes($row['name']);
?></td><?php
?><td><?php
echo stripslashes($row['mingzu']);
?></td><?php
?><td><?php
echo stripslashes($row['age']);
?></td><?php
?><td><?php
echo stripslashes($row['xingbie']);
?></td><?php
?><td><?php
echo stripslashes($row['peiou_name']);
?></td><?php
?><td><?php
echo stripslashes($row['peiou_age']);
?></td><?php
?><td><?php
echo stripslashes($row['peiou_job']);
?></td><?php
?><td><?php
echo stripslashes($row['school']);
?></td><?php
?><td><?php
echo stripslashes($row['by_time']);
?></td><?php
?><td><?php
echo stripslashes($row['zhuanye']);
?></td><?php
?><td><?php
echo stripslashes($row['zhiwei']);
?></td><?php
?><td><?php
echo stripslashes($row['bumen']);
?></td><?php
echo '</p>';
}
?> </table><?php
?><table>
<tr>
<td><button type="submit" onclick="javascript:window.print();">打印本页</button>
</td>
</tr>
</table><?php
$result->free();
$db->close();
}
//编辑数据
function edit_info()
{$number=$_POST['number'];
if (!$number)
{
echo 'You have not entered search details. Please go back and try again.';
exit;
}
if (!get_magic_quotes_gpc())
{
$number = addslashes($number);
}
@ $db = new mysqli('localhost', 'root', 'direnai1314', 'company');
if (mysqli_connect_errno())
{
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
$sql="select * FROM info where number='$number' ";
$result = $db->query($sql);
$num_results = $result->num_rows;
if($num_results>0){
$row = $result->fetch_assoc();
?>
<fieldset style="border:0px ">
<form method="POST" action="update_info.php">
<table bgcolor='#cccccc' >
<tr>
</tr>
<tr>
<td>编号(唯一标示符<br/>不能修改):</td>
<td><input name="number" type="text" value="<?php echo $row['number'];?>"> </td>
</tr>
<tr>
<td>姓名:</td>
<td><input name="name" type="text" value="<?php echo $row['name'];?>"> </td>
</tr>
<tr>
<td>年龄:</td>
<td><input name="age" type="text" value="<?php echo $row['age'];?>"> </td>
</tr>
<tr>
<td>性别:</td>
<td><input name="xingbie" type="text" value="<?php echo $row['xingbie'];?>"> </td>
</tr>
<tr>
<td>名族:</td>
<td><input name="mingzu" type="text" value="<?php echo $row['mingzu'];?>"> </td>
</tr>
<tr><td>
<input type="submit" name="submit" value="确认基本信息修改" class="button">
</td></tr>
</table>
</form>
</fieldset>
<?php
}
else
echo '<br/>未找到相应用户,请查证编号<br/>';
$sql="select * FROM peiou where number='$number' ";
$result = $db->query($sql);
$num_results = $result->num_rows;
?><b>以下为编号为<?php echo $number ?>的婚姻信息:</b>
<?php
if($num_results>0){
$row = $result->fetch_assoc();
?>
<fieldset style="border:0px ">
<form method="POST" action="update_info2.php">
<table bgcolor='#cccccc'>
<tr>
<td>编号(唯一标示符<br/>不能修改):</td>
<td><input name="number" type="text" value="<?php echo $row['number'];?>"> </td>
</tr>
<tr>
<td>配偶姓名:</td>
<td><input name="peiou_name" type="text" value="<?php echo $row['peiou_name'];?>"> </td>
</tr>
<tr>
<td>配偶年龄:</td>
<td><input name="peiou_age" type="text" value="<?php echo $row['peiou_age'];?>"> </td>
</tr>
<tr>
<td>配偶职业:</td>
<td><input name="peiou_job" type="text" value="<?php echo $row['peiou_job'];?>"> </td>
</tr>
<tr><td>
<input type="submit" name="submit" value="确认婚姻信息修改" class="button"></td></tr>
</table>
</form>
</fieldset>
<?php
}
else
echo '<br/>未找到相关信息,请查证编号<br/>';
$sql="select * FROM xueli where number='$number' ";
$result = $db->query($sql);
$num_results = $result->num_rows;
?><b>以下为编号为<?php echo $number ?>的学历信息:</b>
<?php
if($num_results>0){
$row = $result->fetch_assoc();
?>
<fieldset style="border:0px ">
<form method="POST" action="update_info3.php">
<table bgcolor='#cccccc'>
<tr>
<td>编号(唯一标示符<br/>不能修改
php 员工管理系统源程序
4星 · 超过85%的资源 需积分: 38 119 浏览量
2009-07-02
08:44:36
上传
评论 10
收藏 6KB 7Z 举报
direnai1314
- 粉丝: 0
- 资源: 1
最新资源
- mongodb数据库基本操作.pdf
- C#,布尔可满足性问题(Boolean Satisfiability Problem)算法与源代码
- C#,回文分割问题(Palindrome Partitioning Problem)算法与源代码
- C#,煎饼排序问题(Pancake Sorting Problem)算法与源代码
- C#,排列组合的堆生成法(Heap’s Algorithm for generating permutations)算法与源代码
- C#,老鼠迷宫问题的回溯法求解(Rat in a Maze)算法与源代码
- 6693eeb8d683458a07938615fba9e68f.apk
- C#,数值计算,解微分方程的龙格-库塔二阶方法与源代码
- C#,数值计算,用割线法(Secant Method)求方程根的算法与源代码
- C#,子集和问题(Subset Sum Problem)的算法与源代码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
前往页