Advertisement
Guest User

Untitled

a guest
May 18th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4. include("../php/Session.class.php");
  5. $sess = new Session();
  6. $sess->Init();
  7. $cookie = isset($_COOKIE["session"]);
  8. if($cookie)
  9. {
  10. $cookie = $_COOKIE["session"];
  11. $account = $sess->Verify($cookie);
  12. }
  13.  
  14. $pass1=$_POST['passwordText']; //name of input
  15. echo $pass1;
  16.  
  17. $pass=$_POST['oldPass']; //name of input
  18. echo $pass;
  19. echo $account['username'];
  20.  
  21. $dbh = new mysqli("localhost","username","password","sqlserver");
  22. $checkforpass = "SELECT password FROM accounts WHERE username='".$account['username']."'";
  23.  
  24. $checkforpass = $dbh->query($checkforpass); //make query
  25. $checkforpass = $checkforpass->fetch_assoc(); //prepare sql
  26. $checkforpass = $checkforpass['password'];
  27.  
  28. echo $checkforpass;
  29.  
  30. if($checkforpass==$pass)
  31. {
  32. echo 'they got the password!';
  33.  
  34. $change = "UPDATE accounts SET password=".$pass1." WHERE username='".$account['username']."'";
  35. //$change = $dbh->query($change);
  36. $dbh->query($change); //make query
  37. $dbh->close();
  38.  
  39. //change password
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement