Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('/inc/ses_check.php');
- require_once('/inc/mysql_connection.php');
- $username = $_SESSION['username'];
- $id = $_SESSION['loginID'];
- if(isset($_SESSION['errmsg'])){
- $errmsg=$_SESSION['errmsg'];
- unset($_SESSION['errmsg']);
- }else{
- $errmsg="";
- }
- $pgtitle="Assign Access";
- require_once('components/html_head.php');
- ?>
- <script>
- $(document).ready(function(){
- $("#add").click(function(){
- $.ajax({
- type: "POST",
- url: "access_process.php",
- data:{
- operation:1,
- name: "xxx",
- },
- dataType: "html",
- success: function(response){
- $("#response_container").html(response);
- }
- });
- });
- });
- $(document).ready(function(){
- $("#add").click(function(){
- $.ajax({
- type: "POST",
- url: "access_process.php",
- data:$("#theForm").serialize(),
- datatype: "html",
- success: function(response){
- display();
- }
- });
- });
- });
- function display(){
- var x=document.getElementById("selected_id").value;
- $.x({
- type: "POST",
- url: "access_process.php",
- data:{
- operation:4,
- usertype: x,
- },
- dataType: "html",
- success: function(response){
- $("#response_container").html(response);
- }
- });
- }
- </script>
- </head>
- <body>
- <center>
- <?php
- require_once('components/html_banner.php');
- ?>
- <div class="container board">
- <div class="row">
- <div class="row">
- <?php
- require_once('./components/html_userpanel.php');
- ?>
- <div class="col-sm-8">
- <div class="panel panel-success cpassword">
- <div class="panel-heading">
- <strong><center>Assign Access</center></strong>
- </div>
- <div class="panel-body">
- <form action="user_mgmt_process.php" method="POST">
- <?php
- $fromdb="Admin";
- $selected_id="1";
- ?>
- <form id="theForm" method="post" action="access_process.php">
- <label>User type </label><input type="text" name="usertype" value="<?=$fromdb;?>"/></br>
- <label>Module </label><select name="module">
- <option value="1">user Management </option>
- </select>
- </br>
- <input type="checkbox" name="can_add"/><label>Can Add</label></br>
- <input type="checkbox" name="can_edit"/><label>Can Edit</label></br>
- <input type="checkbox" name="can_delete"/><label>Can Delete</label></br>
- <input type="hidden" name="operation" value="1"/>
- <input type="hidden" id="selected_id" name="selected_id" value="1"/>
- <input type="button" value="Add" id="add"/>
- </form>
- <div id="response_container">
- <table class="table table-striped">
- <tr>
- <th>Module</th>
- <th>Can Add</th>
- <th>Can Edit</th>
- <th>Can Delete</th>
- <th>Select</th>
- </tr>
- <?php
- $qry="SELECT * from tbl_access";
- if(isset($_SESSION['search_str'])){
- $search_str= $_SESSION['search_str'];
- $qry= $qry." WHERE username LIKE '$search_str%' OR fullname LIKE '$search_str%';";
- unset($_SESSION['search_str']);
- }else{
- $qry=$qry.";";
- }
- $result=mysql_query($qry);
- if($result){
- while($row=mysql_fetch_array($result)){
- echo'<tr><td>'.$row['usertype'].'</td>';
- echo'<td>'.$row['module'].'</td>';
- echo'<td>'.$row['can_add'].'</td>';
- echo'<td>'.$row['can_edit'].'</td>';
- echo'<td>'.$row['can_delete'].'</td>';
- echo'<td><input type="radio" name="selected_rad" value ='.$row['id'].' onclick="radValueChange()"/></td>';
- echo'<tr>';
- }
- }else{
- die("Error in fetching records".mysql_error());
- }
- ?>
- </table>
- </center>
- <div id="response_container">
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <?php
- require_once('components/html_footer.php');
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment