Jump to content

terminate account error


droidus

Recommended Posts

i have the following php code to delete an account.  The only problem is, I enter the right password, and it does nothing. I enter the wrong password, and i get "bad".  why isn't my success code/message executing?

 

thanks in advance!

 

<?php
// BEGIN TERMINATION OF ACCOUNT
if(isset($_POST['terminate'])) {
   if (empty($_POST['terminatePassword'])) {
      $errors_terminate = "<div class='errors'>Please type in your account password to continue.</div>";
   }
   $password = md5($_POST['terminatePassword']);
   mysql_select_db($database_uploader, $uploader);    
         $query = "SELECT * FROM members WHERE uname = '$_SESSION[user]' AND pword='$password'";
         $result = mysql_query($query) or die(mysql_error());
      
   if (mysql_num_rows($result) > 0) {
      $row = mysql_fetch_array($result) or die(mysql_error());
      
      if ((($row['pword']) == $password) && ($row['uname'] == $_SESSION['user'])) {  
         "Your account has been successfully deleted.  Goodbye!";
         mysql_close($result);
      }
      else { 
         echo "We are sorry, but the password you have entered is not valid.";
         mysql_close($result);
      } 
   } else echo "bad";
}
?>

 

MOD EDIT: code tags added.

Link to comment
https://forums.phpfreaks.com/topic/240344-terminate-account-error/
Share on other sites

When posting code, enclose it within the forum's

 . . . 

BBCode tags.

 

Where is the code for the form you're using? have you tried a print_r() of the $_POST array to make sure it contains what you'd expect it to contain?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.