Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DOESN'T FUCKING WORK
- <?PHP
- session_start(); //open the session for session variables
- include 'processerrors.php';
- logstats();
- set_error_handler("logmyerror");
- $host = "localhost"; //the host address to connect to
- $user = "root"; //the database user that we connect using
- $pass = "09k6CcsGxBq7p"; //the database user's password
- $db = "LogIn"; //the database to access
- //use the variables declared above to connect to the database
- $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
- //select the specific database to read from
- mysql_select_db($db) or die ("Unable to connect to database...");
- // The query
- // Find the location in the table of the entered username
- $getUser = "SELECT `Password` FROM `users` WHERE `Username`='" . $_POST["txtUsername"] . "'";
- //run the query
- $result = mysql_query($getUser) or die ("Error in query: $query.".mysql_error());
- if(mysql_num_rows($result) == 1) {
- $pwd = mysql_fetch_row($result);
- if($_POST["txtOldPassword"] == $pwd[0]) {
- $updatePass = "UPDATE `users` SET `password`='".$_POST["txtPassword"]."' WHERE `Username`='".$_POST["txtUsername"]."'";
- $newresult = mysql_query($updatePass);
- echo "Success!";
- } else {
- echo "Failed, we found a user with that name, but the password appears to be incorrect.";
- }
- } else {
- echo "Failed, we couldn't find a username with that name.";
- }
- mysql_free_result($result); // free space in memory
- mysql_close($connection); //close the connection
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement