?? user.php.bak
字號:
<?
}
?>
<input name="form1" type="submit" value="提 交" > <input type="reset" value="取 消">
</form>
<?php
break;
case "delete":
if ( $_SESSION['userjs'] == "0" ) {
$query = "delete from job_user where id='$_REQUEST[id]';";
mysql_query($query);
$Message->setMessage("刪除成功!","user.php");
$Message->showMessage();
} else {
$Message->setMessage("不能刪除!","javascript:window.close()");
$Message->showMessage();
}
break;
case "update":
if ($_REQUEST['id']){
$query = "select * from job_user where id='$_REQUEST[id]';";
}else{
$query = "select * from job_user where userid='$_SESSION[userid]';";
}
$result = mysql_query($query);
$row = mysql_fetch_array($result);
?>
<p align="center"> <b><font size="3">請輸入修改信息</font></b></p>
<form action="user.php" method=post name=form onsubmit="return check_input()">
<table width="460" border=0 cellpadding=0 cellspacing=1 bgcolor=#333333>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>帳號名稱</td>
<td width="72%" bgColor=#ffffff>
<?php
if ($_REQUEST['id']){
echo "<font color=red>"."$row[userid]"."</font>";
echo "<input type=hidden size=40 name=a1 maxlength=15 value=\"$row[userid]\">";
}else{
echo "<font color=red>"."$_SESSION[userid]"."</font>";
echo "<input type=hidden size=40 name=a1 maxlength=15 value=\"$_SESSION[userid]\">";
}
?>
</td>
</tr>
<?
if ($_SESSION['userjs'] == "0"){
?>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>所屬部門</td>
<td width="72%" bgColor=#ffffff>
<select name="department">
<?
//if ()
$query = "select * from department";
$result = mysql_query($query);
$num1 = mysql_num_rows($result);
for ($i=1;$i<=$num1;$i++) {
$row1 = mysql_fetch_array($result);
if ( $row1['id']) {
echo "<option value=$row1[id]>$row1[department]</option>";
}
}
?>
</select>
</td>
</tr>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>用戶角色</td>
<td width="72%" bgColor=#ffffff>
<select name=userjs>
<?php
if ($row['userjs']=="0") {
echo "<option value=0>管理員</option>";
}elseif($row['userjs']=="1"){
echo "<option value=1>普通用戶</option>";
}else{
echo "<option value=2>部門經理</option>";
}
?>
<option value="1">普通用戶</option>
<option value="0">管理員</option>
<option value="2">部門經理</option>
</select>
</td>
</tr>
<?php
/*if ( $_REQUEST['userjs'] == "2" ){
echo "<select name=department>";
$query = "select * from department";
$result = mysql_query($query);
$num = mysql_num_rows($result);
for ($i=1;$i<=$num;$i++) {
$row = mysql_fetch_array($result);
if ( $row['id']) {
echo "<option value=$row[id]>$row[department]</option>";
}
}
echo "</select>";
}*/
}
?>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>舊 密 碼</td>
<td width="72%" bgColor=#ffffff>
<input type="password" size="40" name="a2" maxlength="15">
</td>
</tr>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>新 密 碼</td>
<td width="72%" bgColor=#ffffff>
<input type="password" size="40" name="a3" maxlength="15">
</td>
</tr>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>新密碼確認</td>
<td width="72%" bgColor=#ffffff>
<input type="password" size="40" name="a4" maxlength="15">
</td>
</tr>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>姓 名</td>
<td width="72%" bgColor=#ffffff>
<?php
echo "<input type=text size=40 name=username maxlength=15 value=\"$row[username]\">";
?>
</td>
</tr>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>性 別</td>
<td width="72%" bgColor=#ffffff>
<?php
if ($row['sex']=="男"){
echo "<input type=radio name=sex value=男 checked>男 ";
echo "<input type=radio name=sex value=女>女";
}else{
echo "<input type=radio name=sex value=男>男 ";
echo "<input type=radio name=sex value=女 checked>女";
}
?>
</td>
</tr>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>年 齡</td>
<td width="72%" bgColor=#ffffff>
<?php
echo "<input type=text size=40 name=age maxlength=15 value=\"$row[age]\">";
?>
</td>
</tr>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>地 址</td>
<td width="72%" bgColor=#ffffff>
<?php
echo "<input type=text size=40 name=address maxlength=15 value=\"$row[address]\">";
?>
</td>
</tr>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>郵 編</td>
<td width="72%" bgColor=#ffffff>
<?php
echo "<input type=text size=40 name=code maxlength=15 value=\"$row[code]\">";
?>
</td>
</tr>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>電 話</td>
<td width="72%" bgColor=#ffffff>
<?php
echo "<input type=text size=40 name=phone1 maxlength=15 value=\"$row[phone1]\">";
?>
</td>
</tr>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>手 機</td>
<td width="72%" bgColor=#ffffff>
<?php
echo "<input type=text size=40 name=phone2 maxlength=15 value=\"$row[phone2]\">";
?>
</td>
</tr>
<tr height=24>
<td width="20%" bgColor=#E6E6E6 align=center>E_mail</td>
<td width="72%" bgColor=#ffffff>
<?php
echo "<input type=text size=40 name=email maxlength=15 value=\"$row[email]\">";
echo "<input type=hidden size=40 name=id maxlength=15 value=\"$row[id]\">";
?>
</td>
</tr>
</table>
<br>
<input type="hidden" value="update" name="action">
<input type="submit" value="修 改" > <input type="reset" value="取 消">
</form>
<?php
break;
default:
echo "<center>";
echo "<form action=user.php method=post>";
echo "<table border=0 width=680>";
echo "<tr>";
echo "<td width=40% bgColor=#ffffff align=center>";
echo "按文用戶姓名查詢:<input type=text size=20 name=search maxlength=20>";
echo " <input type=submit value=搜索>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</form>";
if ($_SESSION['userjs'] == "2"){
if ($_REQUEST['search']){
$sql = "select * from job_user where username like '%$_REQUEST[search]%' and department='$_SESSION[department]' order by id desc;";
}else{
$sql = "select * from job_user where department='$_SESSION[department]' order by id desc;";
}
} else {
if ($_REQUEST['search']){
$sql = "select * from job_user where username like '%$_REQUEST[search]%' order by id desc;";
}else{
$sql = "select * from job_user order by id desc;";
}
}
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if ( $num>0 ){
$last = intval(($num-1)/40)+1;
if ( $page < 1 ) $page=1;
if ( $page > $last ) $page=$last;
mysql_data_seek($result,($page-1)*40);
echo "<table border=0 cellpadding=0 cellspacing=1 bgcolor=#333333 width=520>";
echo "<tr>";
echo "<td width=100 height=18 bgColor=#E6E6E6><div align=center><b>帳號</b></div></td>";
echo "<td width=200 height=18 bgColor=#E6E6E6><div align=center><b>姓名</b></div></td>";
echo "<td width=250 height=18 bgColor=#E6E6E6><div align=center><b>電話</b></div></td>";
echo "<td width=40 height=18 bgColor=#E6E6E6><div align=center><b>編輯</b></div></td>";
echo "<td width=40 height=18 bgColor=#E6E6E6><div align=center><b>刪除</b></div></td>";
echo "</tr>";
for ( $i=0;$i<40;$i++ ) {
$row = mysql_fetch_array($result);
$id = $row['id'];
if ( $id ) {
echo "<tr bgColor=#ffffff>";
echo "<td width=80 height=18 bgColor=#ffffff><div align=center><a href=# onClick=\"window.open('text2.php?id=$row[id]',$row[id],'top=50,left=50,height=520,width=500,scrollbars=yes')\">$row[userid]</a></div></td>";
echo "<td width=250 height=18 bgColor=#ffffff><div align=center>$row[username]</div></td>";
echo "<td width=250 height=18 bgColor=#ffffff><div align=center>$row[phone1]</div></td>";
echo "<td width=40 height=18 bgColor=#ffffff><div align=center><a title=點擊編輯聯系人信息 href=user.php?page=update&id=$row[id]>編輯</a></div></td>";
echo "<td width=40 height=18 bgColor=#ffffff><div align=center><a title=點擊刪除記錄 href=user.php?page=delete&id=$row[id]>刪除</a></div></td>";
echo "</tr>";
}
}
echo "</table><br>";
echo "<table width=500 border=0 cellspacing=0 cellpadding=0 height=24>";
echo "<tbody>";
echo "<tr><td><center>";
echo "總共找到<font color=red>$num</font>條記錄,第<font color=red>$page</font>頁,共<font color=red>$last</font>頁。";
echo "</center></td></tr><tr>";
if ( $page <> 1 ) {
echo "<td align=center> <a href=user.php?page=1>第一頁</a></td>";
echo "<td align=center><a href=user.php?page=".($page-1).">上一頁</a></td>";
}
if ( $page <> $last ) {
echo "<td align=center><a href=user.php?page=".($page+1).">下一頁</a></td>";
echo "<td align=center><a href=user.php?page=$last>最后一頁</a></td>";
}
echo "</tbody>";
echo "</tr>";
echo "</table><br>";
echo "</center>";
} else {
echo "<center>對不起,找不到符合條件的記錄!</center>";
}
break;
}
} else {
$Message->setMessage("對不起,您沒有權限進入后臺管理!","index.php");
$Message->showMessage();
}
?>
</td>
<td width="13" align="right" background="../images/home_16.jpg"> </td>
</tr>
<tr>
<td height="8" colspan="2" valign="top"><img src="../images/home_24.jpg" width="789"></td>
</tr>
</table>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -