Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(!isset($_SESSION["sess_user"])){
- header("location:login.php");
- } else {
- ?>
- <!doctype html>
- <html>
- <head>
- <title>Profile</title>
- </head>
- <style>
- p {
- background-color: lightblue;
- height: 50%
- }
- </style>
- <body>
- <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>
- </br>
- <form action="" method="POST">
- [Update Password]
- </br>
- </br>
- Current Password:
- </br>
- <input type="password" name="password" required="true" />
- </br>
- </br>
- New Password:
- </br>
- <input type="password" name="new_password" required="true" />
- <input type="submit" value="Submit" name="submit" />
- </form>
- <?php
- //Update Password
- if(isset($_POST["submit"])){
- $con=mysql_connect('localhost','ncc','ncc') or die(mysql_error());
- mysql_select_db('ncc') or die("cannot select DB");
- $password=$_POST['password'];
- $new_password=$_POST['new_password'];
- $owner=$_SESSION["sess_user"];
- $confirm_password = mysql_query("SELECT password FROM login WHERE username='$owner'");
- if($confirm_password == $password){
- $update=mysql_query("UPDATE login SET password='$new_password' WHERE username='$owner'");
- echo "Password Changed!";
- } else {
- echo "Unable to change your password!";
- }
- }
- ?>
- </body>
- </html>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement