Right. One thing I suggest is proper indentation, e.g.,
<?php
ob_start();
require_once "Includes/config.php";
require_once "Includes/connectDB.php";
include"Includes/header.php";
confirm_is_admin();
$lid = $_GET['lid'];
$yr = $_GET['yr'];
$gid = $_GET['gid'];
$pid = $_GET['pid'];
$pn = $_GET['pn'];
if (is_admin())
{
$aid = $_GET['aid'];
$query = "DELETE FROM articles WHERE article_id = ?";
$statement = $databaseConnection->prepare($query);
$statement->bind_param('i', $aid);
$statement->execute();
$statement->store_result();
if ($statement->error)
{
die('Database query failed: ' . $statement->error);
}
// TODO: Check for == 1 instead of > 0 when State names become unique.
$deletionWasSuccessful = $statement->affected_rows > 0 ? true : false;
if ($deletionWasSuccessful)
{
header("Location: articlelist.php?lid=" . urlencode($lid) .
"&yr=" . urlencode($yr) . "&gid=" . urlencode($gid) .
"&pid=" . urlencode($pid) . "&pn=" . urlencode($pn));
exit();
}
else
{
echo "Failed deleting Article";
}
}
else
{
header("Location: articlelist.php?lid=" . urlencode($lid) .
"&yr=" . urlencode($yr) . "&gid=" . urlencode($gid) .
"&pid=" . urlencode($pid) . "&pn=" . urlencode($pn));
exit();
}
include "Includes/footer.php";
ob_flush();
Notice that I got rid of all the PHP opening/closing tags, using just one opening tag (and not a short tag either), with no closing tag since that is unnecessary here. I added blank lines to separate some logical sections of the code and broke some long line statements into multiple lines. With the indentation, it is easier to see matching if/else statements.
One thing to do is to take NogDog's advice of using absolute URLs for the location header. Another thing to do is to use [man]isset[/man] or [man]empty[/man] to check that incoming variables like $_GET['lid'] actually exist before using them.