Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1.     <?php
  2.  
  3.     session_start();
  4.     if(isset($_SESSION['s_logged_n']) && $_SESSION['s_logged_n'] == 'true'){
  5.  
  6.     $username = $_SESSION['s_username'];
  7.  
  8.     if(isset($_POST['update'])){
  9.  
  10.     $id = $_GET['id'];
  11.  
  12.     include "config.php";
  13.  
  14.     $password = addslashes(trim($password));
  15.     $password_confirm = addslashes(trim($password_confirm));
  16.  
  17.     if ($password == $password_confirm){
  18.  
  19.     $password = md5($password);
  20.  
  21.     $query = "UPDATE users SET password = '$password' WHERE user_id = '$id' AND username = '$username' LIMIT 1";
  22.     $result = mysql_query($query);
  23.  
  24.     if($result){
  25.     echo "You have successfully edited your password";
  26.     } else {
  27.  
  28.     echo "There was an error editing your password";
  29.     }
  30.     } else {
  31.  
  32.     echo "Your passwords don't match each other";
  33.     }
  34.     }
  35.     } else {
  36.     echo "You must be logged in to access this area";
  37.     }
  38.     ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement