<?php
/*****************************************************************
************* BKWORKS PRO PHP V 0.5 BETA 1 ***********************
******************** BRYAN KOOIENGA ******************************
****************** DECEMBER 20, 2007 *****************************
*****************************************************************/
include('include/functions.php');
if(!defined("INDEX")) {
header("location: ../../?view=home"); # If the template's not calling the script, then send the browser to the homepage.
}
if(is_admin("$username")) { // if the user is an administrator
$account = $_GET['account']; # Pull the data from the browser address
#################################################################
# GET ACCOUNT STATUS FROM THE DATABASE #
#################################################################
$query = "SELECT acct_status, site_url FROM sites WHERE site_number = '" . $account . "'";
$results = mysql_query($query) or die("Can't query because " . mysql_error());
$num_rows = mysql_num_rows($results);
if($num_rows == 0) { # User doesn't exist
echo "We could not a user $account in the database.";
} else { // else 3
$results = mysql_fetch_object($results); # pull the data
$is_suspended = $results -> acct_status;
if($is_suspended == 1) { // if the user is suspended, then
$query = "UPDATE sites SET acct_status = '0' WHERE site_number = '$account'"; # re-activate their account
echo "Account " . $results -> site_url . " is no longer suspended.";
} /* else 4 */ else { # they aren't suspended, then
$query = "UPDATE sites SET acct_status = '1' WHERE site_number = '$account'"; # suspend them
echo "Account " . $results -> site_url . " is now suspended.";
} // end 4
mysql_query($query) or die("Can't query because " . mysql_error());
echo "<br>\n <a href=\"" . $_SERVER['HTTP_REFERER'] . "\">Click here to go back.</a>";
} // end 3
} else { // else 2
echo '<h3>ACCESS IS DENIED</h3>';
} // end 2
?>