Jump to content

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.