<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created:	10/28/2014	ELL
//
	include ("check_session.php");

	$user_name = $_POST['user_name'];
	$AccessLevel = $_POST['AccessLevel'];
	$email = (isset($_POST['email']) ? $_POST['email'] : "");
	$first_name = (isset($_POST['first_name']) ? $_POST['first_name'] : "");
	$last_name = (isset($_POST['last_name']) ? $_POST['last_name'] : "");
	$table = $_POST['table'];
	
	if ($table == "-not selected-")
	{
		echo "You must select a table first to change the password of a user.  Click <a href=\"manage_page_access.php\" title=\"here\">here</a> to select a table and try again.";
		exit;
	}

	// Change password.
	if ((!$table) || ($table == ""))
		$query = "UPDATE `" . BWB_TABLE_PREFIX . "users` SET `AccessLevel`='$AccessLevel', `email`='$email', `first_name`='$first_name', `last_name`='$last_name' WHERE `UserID`='$user_name'";
	else
		$query = "UPDATE `" . $table . "` SET `AccessLevel`='$AccessLevel', `email`='$email' WHERE `UserID`='$user_name'";
		
	$cnt = $bwb_dbh->exec($query);
	
	$_SESSION['last_user'] = $user_name;
	
	echo "user_name=$user_name@@@@@AccessLevel=$AccessLevel@@@@@email=$email@@@@@first_name=$first_name@@@@@last_name=$last_name";
?>
