Guest User

Untitled

a guest
Jul 26th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. <?php
  2. require_once('/inc/ses_check.php');
  3. require_once('/inc/mysql_connection.php');
  4. $username = $_SESSION['username'];
  5. $id = $_SESSION['loginID'];
  6. if(isset($_SESSION['errmsg'])){
  7. $errmsg=$_SESSION['errmsg'];
  8. unset($_SESSION['errmsg']);
  9. }else{
  10. $errmsg="";
  11. }
  12. $pgtitle="Assign Access";
  13. require_once('components/html_head.php');
  14. ?>
  15. <script>
  16. $(document).ready(function(){
  17. $("#add").click(function(){
  18. $.ajax({
  19. type: "POST",
  20. url: "access_process.php",
  21. data:{
  22. operation:1,
  23. name: "xxx",
  24. },
  25. dataType: "html",
  26. success: function(response){
  27. $("#response_container").html(response);
  28. }
  29. });
  30. });
  31. });
  32. $(document).ready(function(){
  33. $("#add").click(function(){
  34. $.ajax({
  35. type: "POST",
  36. url: "access_process.php",
  37. data:$("#theForm").serialize(),
  38. datatype: "html",
  39. success: function(response){
  40. display();
  41. }
  42. });
  43. });
  44. });
  45. function display(){
  46. var x=document.getElementById("selected_id").value;
  47. $.x({
  48. type: "POST",
  49. url: "access_process.php",
  50. data:{
  51. operation:4,
  52. usertype: x,
  53. },
  54. dataType: "html",
  55. success: function(response){
  56. $("#response_container").html(response);
  57. }
  58. });
  59. }
  60.  
  61. </script>
  62. </head>
  63. <body>
  64. <center>
  65. <?php
  66. require_once('components/html_banner.php');
  67. ?>
  68. <div class="container board">
  69. <div class="row">
  70.  
  71.  
  72.  
  73. <div class="row">
  74. <?php
  75. require_once('./components/html_userpanel.php');
  76. ?>
  77. <div class="col-sm-8">
  78. <div class="panel panel-success cpassword">
  79. <div class="panel-heading">
  80. <strong><center>Assign Access</center></strong>
  81. </div>
  82. <div class="panel-body">
  83. <form action="user_mgmt_process.php" method="POST">
  84. <?php
  85. $fromdb="Admin";
  86. $selected_id="1";
  87. ?>
  88. <form id="theForm" method="post" action="access_process.php">
  89. <label>User type </label><input type="text" name="usertype" value="<?=$fromdb;?>"/></br>
  90. <label>Module </label><select name="module">
  91. <option value="1">user Management </option>
  92. </select>
  93. </br>
  94. <input type="checkbox" name="can_add"/><label>Can Add</label></br>
  95. <input type="checkbox" name="can_edit"/><label>Can Edit</label></br>
  96. <input type="checkbox" name="can_delete"/><label>Can Delete</label></br>
  97. <input type="hidden" name="operation" value="1"/>
  98. <input type="hidden" id="selected_id" name="selected_id" value="1"/>
  99. <input type="button" value="Add" id="add"/>
  100. </form>
  101. <div id="response_container">
  102. <table class="table table-striped">
  103. <tr>
  104. <th>Module</th>
  105. <th>Can Add</th>
  106. <th>Can Edit</th>
  107. <th>Can Delete</th>
  108. <th>Select</th>
  109. </tr>
  110. <?php
  111. $qry="SELECT * from tbl_access";
  112. if(isset($_SESSION['search_str'])){
  113. $search_str= $_SESSION['search_str'];
  114. $qry= $qry." WHERE username LIKE '$search_str%' OR fullname LIKE '$search_str%';";
  115. unset($_SESSION['search_str']);
  116. }else{
  117. $qry=$qry.";";
  118. }
  119. $result=mysql_query($qry);
  120. if($result){
  121. while($row=mysql_fetch_array($result)){
  122. echo'<tr><td>'.$row['usertype'].'</td>';
  123. echo'<td>'.$row['module'].'</td>';
  124. echo'<td>'.$row['can_add'].'</td>';
  125. echo'<td>'.$row['can_edit'].'</td>';
  126. echo'<td>'.$row['can_delete'].'</td>';
  127. echo'<td><input type="radio" name="selected_rad" value ='.$row['id'].' onclick="radValueChange()"/></td>';
  128. echo'<tr>';
  129. }
  130. }else{
  131. die("Error in fetching records".mysql_error());
  132. }
  133. ?>
  134. </table>
  135. </center>
  136. <div id="response_container">
  137. </form>
  138. </div>
  139.  
  140.  
  141.  
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. </div>
  147. <?php
  148. require_once('components/html_footer.php');
  149. ?>
  150. </body>
  151. </html>
Add Comment
Please, Sign In to add comment