Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include'connection.php';
- ?>
- <?php
- include 'login.php';
- ?>
- <?php
- if (!isset($_SESSION["authenticatedUserEmail"])) {
- echo $_SESSION["message"] = "You must be logged in to see this page. Please Login";
- }
- else{
- echo $_SESSION["message"] = "Your Account:";
- ?>
- <html>
- <body>
- <table width="703" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="161" height="13"></td>
- <td width="524"></td>
- <td width="18"></td>
- </tr>
- <tr>
- <td height="48" valign="top"><p><a href="logoutnew.php">Logout</a></p>
- </td>
- <td></td>
- </tr>
- <tr>
- <td height="339" valign="top"><p> </p>
- <p> </p>
- <p> </p></td>
- <td valign="top">
- <p> </p>
- <h2>Your Profile.</h2>
- <?php
- echo "ID = " . $_SESSION["ID"] . " " , '<a href = "editaccount.php">Edit</a> <br/>';
- echo "Email = " . $_SESSION["authenticatedUserEmail"] . " ",'<a href = "editaccount.php">Edit</a><br/>';
- echo "Password = " . $_SESSION["password"]." ",'<a href = "editaccount.php">Edit</a><br/>';
- ?>
- </p></td>
- <td></td>
- </tr>
- <tr>
- <td height="103"> </td>
- <td> </td>
- <td></td>
- </tr>
- </table>
- </body>
- <?php
- }
- ?>
- </html>
- <?php
- include 'connection.php';
- $query=mysqli_query($connection,"SELECT ID, email, password,from users");
- $num=mysqli_num_rows($query);
- if($num>0){
- ?>
- <div id= "form1">
- <table border='1'>
- <tr>
- <th>Email</th>
- <th>Password</th>
- <th>Action</th>
- </tr>
- <?php
- while($row=mysqli_fetch_array($query)){
- extract($row);
- ?>
- <tr>
- <td><?php echo $email; ?></td>
- <td><?php echo $password; ?></td>
- <td> <a href="edit.php?id=<?php echo $id; ?>">Edit</a></td></tr>
- <?php
- }
- ?>
- </table>
- <?php
- }else{
- echo "No records found.";
- }
- ?>
- <?php
- if(isset($_REQUEST['id'])){
- include('connection.php');
- if(isset($_REQUEST['edit'])){
- extract($_REQUEST);
- $query=mysqli_query($connection,"UPDATE users set email='$email', password='$password' where id='$id'");
- if($query){
- echo "<div>Record was edited.</div>";
- }
- }
- $id=$_REQUEST['id'];
- $query=mysqli_query($connection,"SELECT * from users where ID='$id'");
- $num=mysqli_num_rows($query);
- if($num>0){
- $row=mysqli_fetch_assoc($query);
- extract($row);
- ?>
- <form action='' method='post' border='0'>
- <table>
- <tr>
- <td>Email</td>
- <td><input type='text' name='email' value='<?php echo $email; ?>' /></td>
- </tr>
- <tr>
- <td>Password</td>
- <td><input type='password' name='password' value='<?php echo $password; ?>' /> </td>
- </tr>
- <input type='hidden' name='id' value='<?php echo $id ?>' />
- <input type='submit' value='Edit' name="edit" />
- </td>
- </tr>
- </table>
- </form>
- <?php
- }else{
- echo "<div>User with this id is not found.</div>";
- }
- }
- else{
- echo "<div> You are not authorized to view this page";
- }
- echo "<a href='account.php'>Back to account</a>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement