<?php
session_start();
if (!isset($_SESSION['FirstName'])) {
	die('0');
}

include ('includes/db1config.php');
include ('../includes/mysql_connect.php');

if (isset($_GET['blog_id']) && !empty($_GET['blog_id'])) {
	$blogId = trim($_GET['blog_id']);
	$sql = "SELECT * 
			FROM blog_categories
			WHERE recordkey NOT IN (
				SELECT catkey
				FROM blog_cat_ref
				WHERE blogkey = '".mysql_real_escape_string($blogId)."'
			)
			ORDER BY category_name";
	$result = mysql_query($sql) or die(mysql_error());

	$categories = array('categories' => array());

	while ($row = mysql_fetch_assoc($result)) {
		$categories['categories'][] = $row;
	}

	echo json_encode($categories);
	die();
}

die('0');
?>