Advertisement
Guest User

Untitled

a guest
Jan 25th, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 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);
  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=:uname");
  22. $stmt->execute(array(":uname"=>$username));
  23. $count = $stmt->rowCount();
  24.  
  25. if($count==0){
  26.  
  27. $stmt = $db_con->prepare("UPDATE * SET password='$password_change_sha1' WHERE login_user WHERE username=:uname" );
  28.  
  29.  
  30. $stmt->bindParam(":newpass",$password_change_sha1);
  31. $stmt->bindParam(":uname",$username_sha1);
  32.  
  33. //$stmt->bindParam(":jdate",$joining_date);
  34.  
  35. if($stmt->execute())
  36. {
  37. echo "registered";
  38. }
  39. else
  40. {
  41. echo "Query could not execute !";
  42. }
  43.  
  44. }
  45. else{
  46.  
  47. echo "1"; // not available
  48. }
  49.  
  50. }
  51. catch(PDOException $e){
  52. echo $e->getMessage();
  53. }
  54. }
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement