对不起我的代码,但这只是一个练习代码,我试图删除用户访问链接,我显示了与所选用户访问对应的所有链接,这里是代码和数据库
选择用户级别
<p class="left"><b>User Level Information</b></p><br>
<table class="left">
<tr>
<td id="TD3"><B>User Level ID</B></td>
<td id="TD3"><B>User Level Name</B></td>
</tr>
<?php
$employee = mysql_query("SELECT * FROM cms_userlevels ORDER BY `cms_userlevels`.`user_level` ASC ");
while($row1 = mysql_fetch_array($employee)){
?>
<tr>
<td id="TD3"><?php echo $row1['user_level']; ?></td>
<td id="TD3"><?php echo "<a href='manageuserlevels.php?id=".$row1['user_level']."'>"; ?> <?php echo $row1['user_type']; ?> </a></td>
</tr>
<?php } ?>
</table>
选定的用户级别
if(isset($_POST['Update']))
{
if(isset($_POST['delete']))
{
$delete1= mysql_query("DELETE FROM cms_userlevels where PROGRAM_ID = '$userId'");
header('location:manageuserlevel.php');
}
else
{
$update = mysql_query("UPDATE cms_program set
PROGRAM_TITLE='$_POST[progti]',
PROGRAM_DESCRIPTION='$_POST[progde]'
where
PROGRAM_ID='$userId'");
}
}
?>
<?php
$userId = $_GET['id'];
$sql = mysql_query("select * from cms_userlevels where user_level='$userId'");
$row2 = mysql_fetch_array($sql);
echo "
<center>
<table class='left'>
<form method='post' action='managemanageuserlevels.php?id=". $userId. "'>
<tr>
<td id='TD4'>User Level ID </td>
<td id='TD4'><input type='text' name='usertype' value='".$row2['user_type']."'></td>
</tr>
<tr>
<td colspan='2'><center><input type='submit' name='submit' value='Update'></td>
</tr>
</form>
</table>";
?>
<table class="left">
<tr>
<td>Remove Access:</td></tr>
<?php
$haslevel = mysql_query("select * from cms_userlevels, cms_level_page_matches, cms_pages
WHERE cms_userlevels.user_level = '$userId'
AND cms_level_page_matches.page_id = cms_pages.id");
while($getlevel = mysql_fetch_array($haslevel)){
$showhaslevel1 = $getlevel['id'];
$showhaslevel2 = $getlevel['page_title'];
?>
<tr><td>
<input type="checkbox" name="checkbox[]" value="<? echo $showhaslevel1; ?>"><?php echo $showhaslevel2; ?></td></tr>
<?php } ?>
使用的表格
cms_userlevels
user_level user_type
1 Admin
2 Student
user_pages
id page name
1 page1.php
2 page2.php
user_level_page_matches
id user_level page_id
1 1 1
2 2 2