Skip to content
Snippets Groups Projects
Commit 10cf5cdb authored by Robert Anderson's avatar Robert Anderson
Browse files

improved readability of code

parent ab3b0039
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,9 @@ printHeader(array( ...@@ -40,7 +40,9 @@ printHeader(array(
if ($_POST['frmaction'] == "delete") { if ($_POST['frmaction'] == "delete") {
# Check a user was selected # Check a user was selected
if (isset($_POST['user_id'])) { if (isset($_POST['user_id'])) {
?> ?>
<p class="pageheader">Delete User</p> <p class="pageheader">Delete User</p>
<form action="user-delete.php" method="post"> <form action="user-delete.php" method="post">
...@@ -54,50 +56,79 @@ if ($_POST['frmaction'] == "delete") { ...@@ -54,50 +56,79 @@ if ($_POST['frmaction'] == "delete") {
<input type="submit" name="confirm" value="no" /> <input type="submit" name="confirm" value="no" />
</div> </div>
</form> </form>
<?php <?php
} else { } else {
?> ?>
<div class="warning">No user selected</div> <div class="warning">No user selected</div>
<?php <?php
} }
# SQL Updates # SQL Updates
} elseif ($_POST['frmaction'] == "delete2") { } elseif ($_POST['frmaction'] == "delete2") {
?> ?>
<p class="pageheader">User Delete Results</p> <p class="pageheader">User Delete Results</p>
<?php <?php
if (isset($_POST['user_id'])) { if (isset($_POST['user_id'])) {
# Check to see if user's attributes are empty # Check to see if user's attributes are empty
$temp = $_POST['user_id']; $userID = $_POST['user_id'];
$sql = "SELECT * FROM ${DB_TABLE_PREFIX}user_attributes WHERE UserID = $temp"; $sql = "SELECT * FROM ${DB_TABLE_PREFIX}user_attributes WHERE UserID = $userID";
$check = $db->query($sql); $res = $db->query($sql);
if ($check->num_rows == 0) { if ($_POST['confirm'] == "yes") {
if ($_POST['confirm'] == "yes") { $res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}users WHERE ID = ".$_POST['user_id']);
$res = $db->exec("DELETE FROM ${DB_TABLE_PREFIX}users WHERE ID = ".$_POST['user_id']); if ($res !== FALSE) {
if ($res !== FALSE) {
?>
<div class="notice">User with ID: <?php print_r($_POST['user_id']);?> deleted</div>
<?php
} else {
?> ?>
<div class="warning">Error deleting user</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div> <div class="notice">User with ID: <?php print_r($_POST['user_id']);?> deleted</div>
<?php <?php
}
} else { } else {
?> ?>
<div class="warning">Delete user aborted</div>
<div class="warning">Error deleting user</div>
<div class="warning"><?php print_r($db->errorInfo()) ?></div>
<?php <?php
} }
} else { } else {
?> ?>
<div class="warning">Attribute list is not empty!</div>
<div class="warning">Delete user aborted</div>
<?php <?php
} }
} else { } else {
?> ?>
<div class="warning">Attribute list is not empty!</div>
<?php
}
} else {
?>
<div class="warning">Invocation error, no user ID selected</div> <div class="warning">Invocation error, no user ID selected</div>
<?php <?php
} }
} }
printFooter(); printFooter();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment