Location: PHPKode > projects > PhpMyInventory > pmi281/deleteUser.php
<?
  Include("Includes/global.inc.php");
  checkPermissions(0, 1800);

  If (!$strError) {
      $errorMessage = "System error: delete. (info: Uid: $editID ,";

      $strSQL1 = "SELECT pk_asset FROM hardware WHERE userID=$editID AND accountID=$accountID";
      $result1 = dbquery($strSQL1);
      while ($row1 = mysql_fetch_array($result1)) {
            $hardwareID = $row1["pk_asset"];
    
            $strSQL2 = "DELETE FROM software WHERE hardware_id=$hardwareID AND accountID=$accountID";
            $result2 = dbqueryWithAlert($strSQL2, $adminEmail, ($errorMessage." Hid: $hardwareID , s)"));    

            $strSQL2 = "DELETE FROM peripherals WHERE fk_asset=$hardwareID AND accountID=$accountID";
            $result2 = dbqueryWithAlert($strSQL2, $adminEmail, ($errorMessage." Hid: $hardwareID , p)"));
    
            $strSQL2 = "DELETE FROM hardware WHERE pk_asset=$hardwareID AND accountID=$accountID";
            $result2 = dbqueryWithAlert($strSQL2, $adminEmail, ($errorMessage." Hid: $hardwareID , h)"));
      }
    
      $strSQL3 = "DELETE FROM tblSecurity WHERE id=$editID AND accountID=$accountID";
      $result3 = dbqueryWithAlert($strSQL3, $adminEmail, ($errorMessage." u)"));
  }

  fillError("User deleted.");
  
  writeHeader("Delete User");

  declareError(TRUE);

  writeFooter();
?>
Return current item: PhpMyInventory