<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 9/10/2008
// Revised: 2/10/2012	ELL
// Added table prefix handling.
	
	include ("check_session.php");
		
	$page_name = $_REQUEST['page_name'];
	$owner = $_REQUEST['owner'];
	$author = $_REQUEST['author'];
	$lanquage = $_REQUEST['lanquage'];
	$copyright = $_REQUEST['copyright'];
	$description = $_REQUEST['description'];
	$abstract = $_REQUEST['abstract'];
	$keywords = $_REQUEST['keywords'];
	$subject = $_REQUEST['subject'];
	if (isset($_REQUEST['robots_index']))
		$robots_index = 1;
	else
		$robots_index = 0;
	if (isset($_REQUEST['robots_follow']))
		$robots_follow = 1;
	else
		$robots_follow = 0;
	$robots_revisit = $_REQUEST['robots_revisit'];
		

	if ($page_name)
	{
		$query = "SELECT * FROM " . BWB_TABLE_PREFIX . "meta_tags WHERE page_name = '$page_name'";
		$result = $bwb_dbh->query($query);
		if ($row = $result->fetch(PDO::FETCH_ASSOC))
			$query = "UPDATE `" . BWB_TABLE_PREFIX . "meta_tags` SET `owner` = '$owner', `author` = '$author', `lanquage` = '$lanquage', `copyright` = '$copyright', `description` = '$description', `abstract` = '$abstract', `keywords` = '$keywords', `subject` = '$subject', `robots_index` = $robots_index, `robots_follow` = $robots_follow, `robots_revisit` = $robots_revisit WHERE `page_name` = '$page_name'";
		else
			$query = "INSERT INTO `" . BWB_TABLE_PREFIX . "meta_tags` (`page_name`, `owner`, `author`, `lanquage`, `copyright`, `description`, `abstract`, `keywords`, `subject`, `robots_index`, `robots_follow`, `robots_revisit`) VALUES ('$page_name', '$owner', '$author', '$lanquage', '$copyright', '$description', '$abstract', '$keywords', '$subject', $robots_index, $robots_follow, $robots_revisit)";
		$cnt = $bwb_dbh->exec($query);
		
		header("Location: edit_meta_tags.php?selected_page_name=$page_name&metatags_saved=1");
	}		
	else
		header("Location: edit_meta_tags.php");
		
?>
