Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.43 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if(!isset($_SESSION["sess_user"])){
  4.     header("location:login.php");
  5. } else {
  6. ?>
  7. <!doctype html>
  8. <html>
  9. <head>
  10. <title>Profile</title>
  11. </head>
  12. <style>
  13. p {
  14.     background-color: lightblue;
  15.     height: 50%
  16. }
  17. </style>
  18. <body>
  19. <p><a | href="member.php">Home Menu |</a> <a href="services.php">Services |</a> <a href="pet_register.php">Register Pet |</a> <a href="billing.php">Billing |</a>  <a href="profile.php">My Profile |</a> <a href="logout.php">Logout</a></p>
  20. </br>
  21.  
  22. <form action="" method="POST">
  23.     [Update Password]
  24.     </br>
  25.     </br>
  26.     Current Password:
  27.     </br>                      
  28.     <input type="password" name="password" required="true" />
  29.     </br>
  30.     </br>
  31.     New Password:
  32.     </br>                  
  33.     <input type="password" name="new_password" required="true" />
  34.     <input type="submit" value="Submit" name="submit" />
  35. </form>
  36. <?php
  37. //Update Password
  38. if(isset($_POST["submit"])){
  39.     $con=mysql_connect('localhost','ncc','ncc') or die(mysql_error());
  40.     mysql_select_db('ncc') or die("cannot select DB");
  41.     $password=$_POST['password'];
  42.     $new_password=$_POST['new_password'];
  43.     $owner=$_SESSION["sess_user"];
  44.     $confirm_password = mysql_query("SELECT password FROM login WHERE username='$owner'");
  45.  
  46.     if($confirm_password == $password){
  47.     $update=mysql_query("UPDATE login SET password='$new_password' WHERE username='$owner'");
  48.     echo "Password Changed!";
  49.     } else {
  50.     echo "Unable to change your password!";
  51.     }
  52. }
  53.  
  54. ?>
  55. </body>
  56. </html>
  57. <?php
  58. }
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement