我希望你们周末愉快!
我拥有这样的代码 - 非常成功:
if($privs == "100") {
// Lets set up our page display based on each 100 level users $id.
$v = $_GET['v']; if ($_GET['v'] == "") $v = $id;
?>
<table style="width: 100%; height: auto; margin: 0; border: 0;" cellspacing="0">
<tbody><tr>
<?php
// Get our list of all the active 100 level team members
$team100 = mysqli_query($con, "SELECT * FROM staff_100 WHERE privs='100' AND active='yes'");
$i = 0;
while ($row100 = mysqli_fetch_assoc($team100)) {
$i++;
if ($i == $v) {
$bg = $colour1;
$bc = $colour1;
$lnkc = " color: #ffffff;";
} else {
$bg = "transparent";
$bc = "#c0c0c0";
$lnkc = "";
}
echo " <td style=\"background: " . $bg . "; border: 2px solid " . $bc . "; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom: 0; text-align: center; padding: 2px 20px;\"><a href=\"./ops.php?v=" . $row100['id'] . "\" style=\"text-decoration: none;" . $lnkc . " display: block;\"><strong>" . $row100['forename'] . " " . $row100['surname'] . "</strong></a></td>\n";
}
?>
</tr></tbody>
</table>
<table style="width: 100%; height: auto; margin: 0; border: 2px solid <?=$colour1?>; border-top: 0; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;" cellspacing="0">
<tbody><tr style="background: <?=$colour1?>;">
<td class="center" style="width: 10%;"><strong>Claim ID</strong></td>
<td class="center" style="width: 20%;"><strong>Date received</strong></td>
<td style="width: 40%;"><strong>Registrar name</strong></td>
<td class="center" style="width: 13%;"><strong>Claim total</strong></td>
<td class="center" style="width: 12%;"></td>
</tr><?php
// Get the regions and the ready_to_process claims in one db call.
$result = mysqli_query($con, "SELECT * FROM registrar_claims WHERE reg_region IN (SELECT region FROM regions WHERE staff_100_id='$v') AND ready_to_process='yes' ORDER BY claim_id ASC");
while ($row = mysqli_fetch_assoc($result)) {
echo "\n <tr style=\"background: " . cycleColours() . ";\">\n";
echo " <td class=\"center\">" . $row['claim_id'] . "</td>\n";
echo " <td class=\"center\">" . $row['timestamp_3'] . "</td>\n";
echo " <td>" . $row['reg_1st_name'] . " " . $row['reg_2nd_name'] . "</td>\n";
echo " <td class=\"center\">" . $row['exp_total'] . "</td>\n";
echo " <td class=\"center\"><a href=\"./ops.php?c=claimdisplay&id=" . $row['reg_uri'] . "&v=" . $_GET['v'] . "\">View</a></td>\n </tr>";
}
?>
</tbody>
</table>
<?php
}
?>
只要我能确保只有拥有100级权限的员工才能进入“员工”表,这才能很好地发挥作用。我不再有这种保证 - 所有级别的所有用户现在都被保存在一个公共职员表中,因此用户的权限可以是100,200,300或400。
我有点迷失在如何改变我的代码以使第一个表显示只有100级人员,并且完全按照它具有表独占性时的功能。我现在是否需要完全重构我的代码,或者我错过了一些简单易用的内容?
谢谢!评论总是被阅读和赞赏。