Location: PHPKode > projects > top serious project > bco/admin/admin.php
<?php

require("../include.php");

if ($logged_in == 1) {
	if ($is_admin != 1) {
		bco_error("You are not authorized to access this page.");
	}
} else {
	$redirect = ereg_replace("admin\/", "", $GLOBALS['base_url']);
	header("Location: $redirect" . "login.php?back=". urlencode("admin/admin.php?$_SERVER[QUERY_STRING]"));
	exit;
}

switch($_GET['mode']) {
// Sets a thread to sticky or not.
case "sticky":
	if (bco_sticky($_GET['id'], $_GET['action'])) {
		// The message passed to bco_display_info()
		$msg  = "Successfuly $_GET[action] sticky!<br /><br />";
		$msg .= "<a href=\"$GLOBALS[base_url]../index.php\" class=\"tr1link\">Go back to index.</a>";
		$title = "Success!";
		bco_display_info($msg, $title);
	} else {
		bco_error("Something happened with the sticky query.");
	}
	break;

// Returns reverse lookup information for an ip address.
case "gethost":
	$host = gethostbyaddr($_GET['ip']);
	$msg  = "Host for <strong>$_GET[ip]</strong>: <strong>$host</strong><br /><br />";
	$msg .= "<a href=\"$GLOBALS[base_url]../index.php\" class=\"tr1link\">Go back to index.</a>";
	$title = "IP lookup for $_GET[ip]";
	bco_display_info($msg, $title);
	break;

// Locks or unlocks a thread
case "lock":
	if (bco_set_lock($_GET['id'], $_GET['action'])) {
		$msg  = "$_GET[action] was a success!<br /><br />";
		$msg .= "<a href=\"$GLOBALS[base_url]../index.php\" class=\"tr1link\">Go back to index.</a>";
		$title = "$_GET[action] thread #$_GET[id]";
		bco_display_info($msg, $title);
	} else {
		bco_error("Something happened with the lock query.");
	}
	break;

case "ban":
	if (bco_block_user($_GET['id'], $_GET['action'])) {
		$msg  = "Successfully $_GET[action]" . "ned user #$_GET[id]<br /><br />";
		$msg .= "<a href=\"$GLOBALS[base_url]../index.php\" class=\"tr1link\">Go back to index.</a>";
		$title = "$_GET[action]" . "ned $_GET[id]";
		bco_display_info($msg, $title);
	} else {
		bco_error("Something happened with the ban query.");
	}
	break;

case "change_colors":
	if (bco_change_default_colors($_GET['color_string'])) {
		$msg  = "Successfully changed default colors<br /><br />";
        $msg .= "<a href=\"$GLOBALS[base_url]../index.php\" class=\"tr1link\">Go back to index.</a>";
        $title = "Change default colors.";
		bco_display_info($msg, $title);
	} else {
		bco_error("Something happened with the change_default_colors function.");
	}
	break;
		
default:
	exit("No action specified.");
	break;
}

?>
Return current item: top serious project