if ( isset($_POST['submitpass']) || isset($_POST['accesspw']) ) { // if tools pw is submitted
include('laketoolsdb_info.php');
$entered_pw=$_POST['accesspw'];
if ($entered_pw == $tools_password) { // correct pw
$_SESSION["tools_authority"] = "true";
} // correct pw
else {
echo "password failed";
}
} // if tools pw is submitted
else if (isset($_POST['submitemail'])) { // if email is submitted
include('submit_email.php');
} // if email is submitted
else if (isset($_POST['removeemail'])) { // else if remove email is submitted
include('remove_email.php');
} // else if remove email is submitted
else if (isset($_POST['submitadtool'])) { // if address tool is selected
$toolselected=$_POST['addresstool'];
if ($toolselected == "syncdbtoocpa") {
include('sync_db_to_ocpa.php');
}
else if ($toolselected == "syncdbtoocpa2") {
include('sync_db_to_ocpa.php');
}
else if (($toolselected == "ownerlabels") || ($toolselected == "residentlabels")) {
include('gen_csv_addresses.php');
}
else if ($toolselected == "browseaddresses") {
include('display_address_table.php');
}
else if ($toolselected == "browsecanaladdresses") {
include('display_address_table.php');
}
else if ($toolselected == "synccanaldbtoocpa") {
include('sync_db_to_ocpa.php');
}
} // if address tool is selected
else if (isset($_POST['submitemtool'])) { // if email tool is selected
$toolselected=$_POST['emailtool'];
if ($toolselected == "browseemail") {
// get emails from db and put in session variables
include('lakemembersdb_info.php');
// connnect to the db
$con = mysql_connect($hostname,$db_username, $db_password) or die ("");
mysql_select_db($database, $con) or die( "");
// table name
$usertable=registered_members;
// Select all the rows in the markers table
$query = "SELECT * FROM `$usertable` ORDER BY name";
$result = mysql_query($query, $con);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
// Iterate through the rows, adding _SESSION vars for each
$index=0;
while ($row = @mysql_fetch_assoc($result)){
// ADD new _SESSION var
$string = $row['name'];
$varname = "email_name".$index;
$_SESSION[$varname] = $string;
$string = $row['first'];
$varname = "email_first".$index;
$_SESSION[$varname] = $string;
$string =$row['email'];
$varname = "email".$index;
$_SESSION[$varname] = $string;
$index++;
}
$_SESSION["numofemailrows"]=$index;
if ($index > 0)
$_SESSION["displayemlist"] = "true";
// close db connection
mysql_close();
}
else if ($toolselected == "sendemail") {
// get emails from db and put in session variables
include('lakemembersdb_info.php');
// connnect to the db
$con = mysql_connect($hostname,$db_username, $db_password) or die ("");
mysql_select_db($database, $con) or die( "");
// table name
$usertable=registered_members;
// Select all the rows in the markers table
$query = "SELECT * FROM `$usertable` WHERE 1";
$result = mysql_query($query, $con);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
// Iterate through the rows, adding _SESSION vars for each
$index=0;
while ($row = @mysql_fetch_assoc($result)){
// ADD new _SESSION var
$string = $row['email'];
$varname = "email".$index;
$_SESSION[$varname] = $string;
$index++;
}
$_SESSION["numofemailrows"]=$index;
if ($index > 0)
$_SESSION["sendemlist"] = "true";
// close db connection
mysql_close();
// dump url to send email
// $numofemails=$_SESSION["numofemailrows"];
// $string = $_SESSION[email0];
// $string .=",";
// for ($i=2; $i<=$numofemails; $i++) {
// $varname = "email".($i-1);
// $string .= $_SESSION[$varname];
// if ($i < $numofemails)
// $string .=",";
// }
// echo '
//
// /* only display once */
// unset($_SESSION["sendemlist"]);
}
} // if email tool is selected
else if (isset($_POST['submitboardtool'])) { // if board tool is selected
$toolselected=$_POST['boardtools'];
if ($toolselected == "announcement") {
// get current announcement from db and put in session variables
include('lakemembersdb_info.php');
// connnect to the db
$con = mysql_connect($hostname,$db_username, $db_password) or die ("");
mysql_select_db($database, $con) or die( "");
// table name
$usertable=Announcement;
// Select all the rows in the markers table
$query = "SELECT * FROM `$usertable` WHERE `id`='1'";
$result = mysql_query($query, $con);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
$row = @mysql_fetch_assoc($result);
$string = $row['announce'];
if (!$string)
$string = "Coming Soon.";
$_SESSION["announce"] = $string;
// close db connection
mysql_close();
} // announcement selected
else if ($toolselected == "updatehoapage") {
// get current hoapage from db and put in session variables
include('lakemembersdb_info.php');
// connnect to the db
$con = mysql_connect($hostname,$db_username, $db_password) or die ("");
mysql_select_db($database, $con) or die( "");
// table name
$usertable=Announcement;
// Select all the rows in the markers table
$query = "SELECT * FROM `$usertable` WHERE `id`='2'";
$result = mysql_query($query, $con);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
$row = @mysql_fetch_assoc($result);
$string = $row['announce'];
if (!$string)
$string = "Check back with us later.";
$_SESSION["hoapage"] = $string;
$_SESSION["displayedithoapage"] = "true";
// close db connection
mysql_close();
} // hoa page selected
else if ($toolselected == "updateboardinfo") {
include('lakemembersdb_info.php');
// connnect to the db
$con = mysql_connect($hostname,$db_username, $db_password) or die ("");
mysql_select_db($database, $con) or die( "");
// table name
$usertable=board_info_table;
// Select all the rows in the board table
$query = "SELECT * FROM `$usertable` WHERE 1";
$result = mysql_query($query, $con);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
// Iterate through the rows, adding _SESSION vars for each
$index=1;
while ($row = @mysql_fetch_assoc($result)){
// ADD new _SESSION var
$string = $row['position'];
$varname = "position".$index;
$_SESSION[$varname] = $string;
$string = $row['name'];
$varname = "name".$index;
$_SESSION[$varname] = $string;
$string = $row['email'];
$varname = "email".$index;
$_SESSION[$varname] = $string;
$string = $row['phone'];
$varname = "phone".$index;
$_SESSION[$varname] = $string;
$index++;
}
$index=$index - 1;
$_SESSION["numofpositions"]=$index;
$_SESSION["displayeditboard"] = "true";
}
} // if board tool is selected
else if (isset($_POST['submitannounce'])) { // if new announcemnt submitted
// values sent from form
$string=$_POST['newan'];
// put announcement in db
include('lakemembersdb_info.php');
// connnect to the db
$con = mysql_connect($hostname,$db_username, $db_password) or die ("");
mysql_select_db($database, $con) or die( "");
// table name
$usertable=Announcement;
$t=time();
$date = date("Y-m-d",$t);
date_default_timezone_set('America/New_York');
$time = date("H:i:s",$t);
$index = 1;
// Update data in database
$sql="UPDATE `$usertable` SET announce='$string', date='$date', time='$time' WHERE id='$index'";
$result=mysql_query($sql, $con);
if (!$result) {
die('Error: ' . mysql_error());
}
// close db connection
mysql_close();
} // if new announcemnt submitted
else if (isset($_POST['submithoapage'])) { // if new hoa page content submitted
// values sent from form
$string=$_POST['newhoa'];
// put announcement in db
include('lakemembersdb_info.php');
// connnect to the db
$con = mysql_connect($hostname,$db_username, $db_password) or die ("");
mysql_select_db($database, $con) or die( "");
// table name
$usertable=Announcement;
$t=time();
$date = date("Y-m-d",$t);
date_default_timezone_set('America/New_York');
$time = date("H:i:s",$t);
$index = 2;
// Update data in database
$sql="UPDATE `$usertable` SET announce='$string', date='$date', time='$time' WHERE id='$index'";
$result=mysql_query($sql, $con);
if (!$result) {
die('Error: ' . mysql_error());
}
// close db connection
mysql_close();
} // if new announcemnt submitted
else if ( (isset($_POST['submitboard1'])) ||
(isset($_POST['submitboard2'])) ||
(isset($_POST['submitboard3'])) ||
(isset($_POST['submitboard4'])) ||
(isset($_POST['submitboard5'])) ||
(isset($_POST['submitboard6'])) ||
(isset($_POST['submitboard7'])) ||
(isset($_POST['submitboard8'])) ||
(isset($_POST['submitboard9'])) ||
(isset($_POST['submitboard10'])) ) {
// put update in db
include('lakemembersdb_info.php');
// connnect to the db
$con = mysql_connect($hostname,$db_username, $db_password) or die ("");
mysql_select_db($database, $con) or die( "");
// table name
$usertable=board_info_table;
if (isset($_POST['submitboard1']))
$index = 1;
else if (isset($_POST['submitboard2']))
$index = 2;
else if (isset($_POST['submitboard3']))
$index = 3;
else if (isset($_POST['submitboard4']))
$index = 4;
else if (isset($_POST['submitboard5']))
$index = 5;
else if (isset($_POST['submitboard6']))
$index = 6;
else if (isset($_POST['submitboard7']))
$index = 7;
else if (isset($_POST['submitboard7']))
$index = 7;
else if (isset($_POST['submitboard8']))
$index = 8;
else if (isset($_POST['submitboard9']))
$index = 9;
else if (isset($_POST['submitboard10']))
$index = 10;
// values sent from form
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
// Update data in database
$sql="UPDATE `$usertable` SET name='$name', email='$email', phone='$phone' WHERE id='$index'";
$result=mysql_query($sql, $con);
if (!$result) {
die('Error: ' . mysql_error());
}
// close db connection
mysql_close();
}
else if (isset($_GET['passkey'])) {
include('cfm.php');
}
?>