Advertisement
Guest User

Untitled

a guest
Dec 26th, 2014
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include'connection.php';
  4. ?>
  5. <?php
  6. include 'login.php';
  7. ?>
  8.  
  9. <?php
  10. if (!isset($_SESSION["authenticatedUserEmail"])) {
  11. echo $_SESSION["message"] = "You must be logged in to see this page. Please Login";
  12. }
  13. else{
  14. echo $_SESSION["message"] = "Your Account:";
  15. ?>
  16. <html>
  17. <body>
  18. <table width="703" border="0" cellpadding="0" cellspacing="0">
  19. <tr>
  20. <td width="161" height="13"></td>
  21. <td width="524"></td>
  22. <td width="18"></td>
  23. </tr>
  24. <tr>
  25. <td height="48" valign="top"><p><a href="logoutnew.php">Logout</a></p>
  26. </td>
  27. <td></td>
  28. </tr>
  29. <tr>
  30. <td height="339" valign="top"><p>&nbsp;</p>
  31. <p>&nbsp;</p>
  32. <p>&nbsp;</p></td>
  33. <td valign="top">
  34. <p>&nbsp;</p>
  35. <h2>Your Profile.</h2>
  36. <?php
  37. echo "ID = " . $_SESSION["ID"] . " " , '<a href = "editaccount.php">Edit</a> <br/>';
  38. echo "Email = " . $_SESSION["authenticatedUserEmail"] . " ",'<a href = "editaccount.php">Edit</a><br/>';
  39. echo "Password = " . $_SESSION["password"]." ",'<a href = "editaccount.php">Edit</a><br/>';
  40. ?>
  41. </p></td>
  42. <td></td>
  43. </tr>
  44. <tr>
  45. <td height="103">&nbsp;</td>
  46. <td>&nbsp;</td>
  47. <td></td>
  48. </tr>
  49. </table>
  50. </body>
  51. <?php
  52. }
  53. ?>
  54. </html>
  55.  
  56. <?php
  57. include 'connection.php';
  58. $query=mysqli_query($connection,"SELECT ID, email, password,from users");
  59. $num=mysqli_num_rows($query);
  60. if($num>0){
  61. ?>
  62. <div id= "form1">
  63. <table border='1'>
  64. <tr>
  65. <th>Email</th>
  66. <th>Password</th>
  67. <th>Action</th>
  68. </tr>
  69. <?php
  70. while($row=mysqli_fetch_array($query)){
  71. extract($row);
  72. ?>
  73. <tr>
  74. <td><?php echo $email; ?></td>
  75. <td><?php echo $password; ?></td>
  76. <td> <a href="edit.php?id=<?php echo $id; ?>">Edit</a></td></tr>
  77. <?php
  78. }
  79. ?>
  80. </table>
  81. <?php
  82. }else{
  83. echo "No records found.";
  84. }
  85. ?>
  86.  
  87. <?php
  88. if(isset($_REQUEST['id'])){
  89. include('connection.php');
  90. if(isset($_REQUEST['edit'])){
  91. extract($_REQUEST);
  92. $query=mysqli_query($connection,"UPDATE users set email='$email', password='$password' where id='$id'");
  93.  
  94. if($query){
  95. echo "<div>Record was edited.</div>";
  96. }
  97. }
  98. $id=$_REQUEST['id'];
  99. $query=mysqli_query($connection,"SELECT * from users where ID='$id'");
  100.  
  101. $num=mysqli_num_rows($query);
  102. if($num>0){
  103. $row=mysqli_fetch_assoc($query);
  104. extract($row);
  105. ?>
  106.  
  107. <form action='' method='post' border='0'>
  108. <table>
  109. <tr>
  110. <td>Email</td>
  111. <td><input type='text' name='email' value='<?php echo $email; ?>' /></td>
  112. </tr>
  113. <tr>
  114. <td>Password</td>
  115. <td><input type='password' name='password' value='<?php echo $password; ?>' /> </td>
  116. </tr>
  117. <input type='hidden' name='id' value='<?php echo $id ?>' />
  118. <input type='submit' value='Edit' name="edit" />
  119. </td>
  120. </tr>
  121. </table>
  122. </form>
  123. <?php
  124.  
  125. }else{
  126. echo "<div>User with this id is not found.</div>";
  127. }
  128. }
  129. else{
  130. echo "<div> You are not authorized to view this page";
  131. }
  132. echo "<a href='account.php'>Back to account</a>";
  133. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement