Advertisement
Guest User

Untitled

a guest
May 12th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.96 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include 'connect.inc';
  4. if (isset($_POST["UserID"]))
  5. {
  6. $UserID = $_POST['UserID'];
  7. $fname = $_POST['fname'];
  8. $lname = $_POST['lname'];
  9. $email = $_POST['email'];
  10. $contact = $_POST['contact'];
  11. $Usertype = $_POST['Usertype'];
  12. $username = $_POST['username'];
  13. $password = $_POST['password'];
  14. $query="UPDATE userdatabase SET fname = '$fname', lname = '$lname', email = '$email', contact = '$contact',
  15. Usertype = '$Usertype', username = '$username', password ='$password' WHERE UserID = '$UserID'";
  16. $is_query_successful=mysql_query($query);
  17. }
  18.  
  19. ?>
  20. <!doctype html>
  21. <html lang="en">
  22. <head>
  23. <title>
  24.  
  25. </title>
  26. <!-- Required meta tags -->
  27. <meta charset="utf-8">
  28. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  29.  
  30. <!-- Bootstrap CSS -->
  31. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  32. </head>
  33. <?php include "index.php";?>
  34. <body style="color: white; background-color: #344e35">
  35. <form id="formTbl" method="get">
  36. <!--
  37. <button id="btnDelete" onclick="buttonDelete()">Delete Request/s</button>
  38. -->
  39. <table class="table table-hover" id="formtbl">
  40. <?php
  41. include('connect.inc');
  42. $result = mysql_query("SELECT * FROM userdatabase")
  43. or die(mysql_error());
  44. echo '<tr>';
  45. echo '<th> First Name</th>';
  46. echo '<th> Last Name</th>';
  47. echo '<th> E-Mail</th>';
  48. echo '<th> Contact</th>';
  49. echo '<th> User type</th>';
  50. echo '<th> Username</th>';
  51. echo '<th> Password</th>';
  52. echo '<th> </th>';
  53. '</tr>';
  54. while($row = mysql_fetch_array( $result ))
  55. {
  56. echo '<tr>';
  57. echo '<td>' . $row['fname'].'</td>';
  58. echo '<td>' . $row['lname'].'</td>';
  59. echo '<td>' . $row['email'].'</td>';
  60. echo '<td>' . $row['contact'].'</td>';
  61. echo '<td>' . $row['Usertype'].'</td>';
  62. echo '<td>' . $row['username'].'</td>';
  63. echo '<td>' . hash('adler32', $row['password']) .'</td>';
  64. ?>
  65. <td>
  66. <?php echo'<button type="button" class= "btn-sm btn" data-toggle="modal" data-target="#exampleModal' . $row['UserID'] . '">Manage Account</button>';?>
  67. <!-- Button trigger modal -->
  68. <div class="modal fade text-dark" id="exampleModal<?php echo $row['UserID'];?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  69. <?php $_SESSION['UserID']=$row['UserID']; ?>
  70. <div class="modal-dialog" role="document">
  71. <div class="modal-content">
  72. <div class="modal-header">
  73. <h5 class="modal-title" id="exampleModalLabel">Manage Account</h5>
  74. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  75. <span aria-hidden="true">&times;</span>
  76. </button>
  77. </div>
  78. <!-- Modal -->
  79. <div class="modal-body">
  80. <form method="POST" action="ManageAccount.php">
  81. <input type="hidden" name="UserID" value="<?php echo $row["UserID"] ?>"
  82. <div class="tableBorder"><!-- tableborder open -->
  83. <div class="col">
  84. <div class="row">
  85. <div class="col-6 mb-3">
  86. <label for="fname">First Name</label>
  87. <input type="text" class="form-control" name="fname" value="<?php echo $row["fname"]?>" >
  88. </div>
  89. <div class="col-md-6 mb-3">
  90. <label for="lname">Last Name</label>
  91. <input type="text" class="form-control" name="lname" value="<?php echo $row["lname"]?>" >
  92. </div>
  93. </div><!-- tableborder close -->
  94. <div class="row">
  95. <div class="col-6 mb-3">
  96. <label for="email">Email</label>
  97. <input type="email" class="form-control" name="email" value="<?php echo $row["email"]?>" >
  98. </div>
  99. <div class="col-md-6 mb-3">
  100. <label for="contact">Contact Number</label>
  101. <input type="text" class="form-control" name="contact" value="<?php echo $row["contact"]?>" >
  102. </div>
  103. </div><!-- tableborder close -->
  104. <div class="row">
  105. <div class="col-6 mb-3">
  106. <label for="Usertype">Usertype</label>
  107. <input type="text" class="form-control" name="Usertype" value="<?php echo $row["Usertype"]?>" >
  108. </div>
  109. </div><!-- tableborder close -->
  110. <div class="row">
  111. <div class="col-6 mb-3">
  112. <label for="username">Username</label>
  113. <input type="text" class="form-control" name="username" value="<?php echo $row["username"]?>" >
  114. </div>
  115. <div class="col-md-6 mb-3">
  116. <label for="password">Password</label>
  117. <input type="password" class="form-control" name="password" value="<?php echo $row["password"]?>" >
  118. </div>
  119. </div><!-- tableborder close -->
  120. </div>
  121. </div>
  122. <div class="modal-footer">
  123. <button type="" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
  124. <button type="submit" class="btn btn-success" role="button">Update Account</button>
  125. </div>
  126. </form>
  127. </div>
  128. </div>
  129. </div>
  130. </td>
  131. </td>
  132. <?php
  133. echo '</tr>';
  134. }
  135. ?>
  136. </table>
  137. <!--</table>
  138. <!--Table-->
  139. <!-- Optional JavaScript -->
  140. <!-- jQuery first, then Popper.js, then Bootstrap JS -->
  141. <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  142. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  143. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
  144. </body>
  145. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement