Advertisement
Guest User

Untitled

a guest
Jan 25th, 2016
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php
  2.  
  3. require_once 'dbconfig.php';
  4.  
  5. if($_POST)
  6. {
  7. $password_change = $_POST['password_change'];
  8. $password_old = $_POST['password_old'];
  9. $username_ch = $_POST['username'];
  10.  
  11. // $joining_date =date('Y-m-d H:i:s');
  12.  
  13. $username_sha1= sha1($username_ch);
  14. $password_change_sha1 = sha1($password_change);
  15. $password_old_sha1 = sha1($password_old);
  16.  
  17.  
  18. try
  19. {
  20.  
  21. $stmt = $db_con->prepare("SELECT * FROM login_user WHERE username='$username_sha1'");
  22. $stmt->execute(array($username_sha1=>$username));
  23. $count = $stmt->rowCount();
  24.  
  25. if($count>=1){
  26.  
  27. $stmt = $db_con->prepare("UPDATE login_user SET password='$password_change_sha1' WHERE username='$username_sha1'" );
  28.  
  29.  
  30.  
  31.  
  32. //$stmt->bindParam(":jdate",$joining_date);
  33.  
  34. if($stmt->execute())
  35. {
  36. echo "registered";
  37. }
  38. else
  39. {
  40. echo "Query could not execute !";
  41. }
  42.  
  43. }
  44. else{
  45.  
  46. echo "1"; // not available
  47. }
  48.  
  49. }
  50. catch(PDOException $e){
  51. echo $e->getMessage();
  52. }
  53. }
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement