Guest User

Untitled

a guest
Jun 13th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. <?php
  2. if(isset($_SESSION['validuser']))
  3. {
  4. $sess = $_SESSION['validuser'];
  5. include('../sa_config.php');
  6. if(isset($_POST['current'])) { $current = $_POST['current']};
  7. if(isset($_POST['new'])) { $new = $_POST['new']};
  8. if(isset($_POST['confirm'])) { $confirm = $_POST['confirm']};
  9. if($new == $confirm)
  10. {
  11. @mysql_connect($server, $user, $pass) or die('connection error!');
  12. @mysql_select_db($db) or die('database error!');
  13. $query = "SELECT * FROM admin where $user='$sess' limit 1";
  14. $result = @mysql_query($query) or die('Query Error');
  15. $num = @mysql_num_rows($result);
  16. if($num == 1)
  17. {
  18. $row = mysql_fetch_array($result);
  19. $uid = $row[0];
  20. $u = $row[1];
  21. $p = $row[2];
  22. if($current == $p)
  23. {
  24. $query = "UPDATE admin SET pass='$new' where id='$uid' and user='$u'"
  25. mysql_query($query);
  26. }
  27. else
  28. {
  29. echo "Your current password is not correctly";
  30. }
  31. }
  32. else
  33. {
  34. echo "Your current password is not correctly";
  35. }
  36. }
  37. else
  38. {
  39. echo "Your new password and confirm not match";
  40. }
  41. }
  42. else
  43. {
  44. header("location:index.php");
  45. }
  46.  
  47. ?>
Add Comment
Please, Sign In to add comment