Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2016
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. DOESN'T FUCKING WORK
  2.  
  3. <?PHP
  4. session_start(); //open the session for session variables
  5. include 'processerrors.php';
  6. logstats();
  7. set_error_handler("logmyerror");
  8. $host = "localhost"; //the host address to connect to
  9. $user = "root"; //the database user that we connect using
  10. $pass = "09k6CcsGxBq7p"; //the database user's password
  11. $db = "LogIn"; //the database to access
  12.  
  13. //use the variables declared above to connect to the database
  14. $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
  15. //select the specific database to read from
  16. mysql_select_db($db) or die ("Unable to connect to database...");
  17. // The query
  18. // Find the location in the table of the entered username
  19. $getUser = "SELECT `Password` FROM `users` WHERE `Username`='" . $_POST["txtUsername"] . "'";
  20.  
  21.  
  22. //run the query
  23. $result = mysql_query($getUser) or die ("Error in query: $query.".mysql_error());
  24.  
  25. if(mysql_num_rows($result) == 1) {
  26. $pwd = mysql_fetch_row($result);
  27. if($_POST["txtOldPassword"] == $pwd[0]) {
  28. $updatePass = "UPDATE `users` SET `password`='".$_POST["txtPassword"]."' WHERE `Username`='".$_POST["txtUsername"]."'";
  29. $newresult = mysql_query($updatePass);
  30. echo "Success!";
  31. } else {
  32. echo "Failed, we found a user with that name, but the password appears to be incorrect.";
  33. }
  34. } else {
  35. echo "Failed, we couldn't find a username with that name.";
  36. }
  37.  
  38. mysql_free_result($result); // free space in memory
  39. mysql_close($connection); //close the connection
  40.  
  41.  
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement