<?php
////////////////////////////////////////////////////////////////////////
// Restrict Page Access //
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 4/9/2010
// Revised: 2/10/2012	ELL
// Added table prefix handling.
	
	include ("check_session.php");

	
	$query = "SELECT page_name FROM " . BWB_TABLE_PREFIX . "page_data";
	$result = $bwb_dbh->query($query);
	while($row = $result->fetch(PDO::FETCH_ASSOC))
	{
		$page_name = $row["page_name"];
		if (isset($_POST[$page_name]))
			$restricted = 1;
		else
			$restricted = 0;
			
		$query2 = "UPDATE " . BWB_TABLE_PREFIX . "page_data SET restricted = $restricted WHERE page_name = '$page_name'";
		$cnt = $bwb_dbh->exec($query2);
	}
	
	header("Location: restrict_editing_access.php?page_restrictions_saved=1");
?>