Advertisement
Guest User

wholecode

a guest
Feb 10th, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2.  
  3. mysql_connect("localhost","user", "pw") or die(mysql_error);
  4. mysql_select_db("dbname");
  5.  
  6. $pass = mysql_real_escape_string(htmlspecialchars($_POST['pass']));
  7. $pass2 = mysql_real_escape_string(htmlspecialchars($_POST['pass2']));
  8. $code = $_POST['code2'];
  9. $sql = mysql_query("SELECT email FROM pw_ask WHERE code='$code'");
  10. $row = mysql_fetch_array($sql);
  11. $email = $row['email'];
  12.  
  13. if($pass == $pass2)
  14. {
  15. $pass3 = md5($pass);
  16.  
  17. mysql_query("UPDATE users SET password='$pass3' , newpw_code='' where email='$email'");
  18. mysql_query("DELETE FROM pw_ask where code='$code'");
  19.  
  20. header("location:index.php?ret=pw");
  21. }
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement