Advertisement
Guest User

password fix i think

a guest
Aug 24th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <?php
  2. if ($_POST['change_pw']){
  3. $username = mysql_real_escape_string($_POST['username']);
  4. $password = mysql_real_escape_string($_POST['password']);
  5. if(empty($username)){
  6. echo '<div class = "alert">You have not entered a username??</div>';
  7. }
  8.  
  9. else if(empty ($password)){
  10. echo '<div class = "alert">You have not entered a password??</div>';
  11. }
  12.  
  13. else if(!isset($username) || !ctype_alpha($_POST['username'])){
  14. echo '<div class = "alert">Username can only contain letters.</div>';
  15. }
  16. mysql_query( "UPDATE users SET password = '" . $core->hashed($password) ."' WHERE username = '{$username}'" );
  17. mysql_query($q_editn);
  18. echo '<div class = \'alert\'>Password changed successfully.</div><meta http-equiv="refresh" content="3;url={url}/index.php?url=hk&change_password"/>';
  19. }
  20. }?>
  21. <br>
  22. <form method = "post">
  23. <input type = "text" name = "username" value = "<?php echo $_POST['username']; ?>" placeholder = "Username"></br></br>
  24. <input type = "password" name = "password" placeholder = "Password"></br></br>
  25. <input type = "submit" name = "change_pw">
  26. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement