0

sorry for my code but this is only a practice code, i m trying to remove user access links, i displayed all the links that corresponds to the selected user access here's the code and database

Select user levels

<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>

Selected User level

    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 } ?>

the tables used

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
2
Contributors
1
Reply
14
Views
3 Years
Discussion Span
Last Post by diafol
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.