if($action=='add'){
?>
}
elseif($action=='save'){
$login = isset($_post['login']) ? $_post['login'] : '';
$pws = isset($_post['pws']) ? $_post['pws'] : '';
$question = isset($_post['question']) ? $_post['question'] : '';
$answer = isset($_post['answer']) ? $_post['answer'] : '';
$sql = "insert into person (login,pws,question,answer)
values('$login','$pws','$question','$answer')";
$db->query($sql);
forward('发布成功','href','personlist.php');
}
elseif($action=='del'){
$person_id=$_get['person_id'];
$page=$_get['page'];
$sql="delete from person where person_id='$person_id'";
$db->query($sql);
forward('删除成功','href','personlist.php?page='.$page);
}
elseif($action=='editsave'){
$person_id = isset($_post['person_id']) ? $_post['person_id'] : '';
$page = isset($_post['page']) ? $_post['page'] : '';
$login = isset($_post['login']) ? $_post['login'] : '';
$pws = isset($_post['pws']) ? $_post['pws'] : '';
$question = isset($_post['question']) ? $_post['question'] : '';
$answer = isset($_post['answer']) ? $_post['answer'] : '';
$sql="update person set login='$login',pws='$pws',question='$question',answer='$answer' where person_id='$person_id'";
$db->query($sql);
forward('修改成功','href','personlist.php?page='.$page);
}
elseif($action=='edit'){
$person_id=$_get['person_id'];
$page=$_get['page'];
$sql="select * from person where person_id='$person_id'";
$query = $db->query($sql);
$row = $db->fetch_array($query);
$login=$row['login'];
$pws=$row['pws'];
$question=$row['question'];
$answer=$row['answer'];
?>
}
else{
$page = isset($_get['page']) ?intval($_get['page']) : 1;
$num = 5;
$sql="select * from person";
$query = $db->query($sql);
$totalnum = $db->num_rows($query);//记录总数
$pagenum = ceil($totalnum/$num); //总页数
$offset = ($page-1) * $num;
$sql=$sql." limit $offset,$num ";
$query = $db->query($sql);//取得记录
?>
记录总数:————添加人员 | |||||
登陆账号 | 登陆密码 | 问题 | 答案 | 加入时间 | 操作 |
删除/ 修改 |