'.mysql_error()); } mysql_select_db($mysql_database, $db) or die('Failed to select database
'.mysql_error()); if ($authorized) { $sql = "CREATE TABLE IF NOT EXISTS $mysql_table (id INT UNSIGNED NOT NULL AUTO_INCREMENT, wwb_index INT NOT NULL, wwb_id VARCHAR(255) NOT NULL, wwb_date TIMESTAMP NOT NULL, wwb_title VARCHAR(255), wwb_text TEXT NOT NULL, wwb_reserved VARCHAR(255), PRIMARY KEY(id));"; $result = mysql_query($sql, $db); if (!$result) { die('Invalid query: ' . mysql_error()); } if ($action == 'logout') { setcookie('5newsletters', ''); unset($_COOKIE['5newsletters'], $admin_password); header("Location: ".basename(__FILE__)); exit; } else if ($action == 'save') { $text = get_magic_quotes_gpc() ? trim($_POST['text']) : addslashes(trim($_POST['text'])); $text = str_replace("\\'", "'", $text); $title = get_magic_quotes_gpc() ? trim($_POST['title']) : addslashes(trim($_POST['title'])); $title = str_replace("\\'", "'", $title); if ($id >= 0) { $sql = "UPDATE $mysql_table SET `wwb_text` = '$text', `wwb_title` = '$title', `wwb_date` = '$timestamp' WHERE `id` = '$id'"; mysql_query($sql, $db); } else { $sql = "SELECT * FROM $mysql_table WHERE `wwb_id` = '5newsletters'"; $result = mysql_query($sql, $db); $wwb_index = mysql_num_rows($result); $wwb_index = $wwb_index + 1; $sql = "INSERT $mysql_table (`wwb_index`, `wwb_id`, `wwb_date`, `wwb_text`, `wwb_title`) VALUES ($wwb_index, '5newsletters', '$timestamp', '$text', '$title')"; mysql_query($sql, $db); } } else if ($action == 'movedown' || $action == 'moveup') { $sql = "SELECT * FROM $mysql_table WHERE `id` = '$id'"; $result = mysql_query($sql, $db); if ($data = mysql_fetch_array($result)) { $wwb_index = $data['wwb_index']; } if ($action == 'moveup') $new_index = $wwb_index - 1; else $new_index = $wwb_index + 1; $sql = "UPDATE $mysql_table SET wwb_index = $wwb_index WHERE wwb_index = '$new_index' AND `wwb_id` = '5newsletters'"; mysql_query($sql, $db); $sql = "UPDATE $mysql_table SET wwb_index = $new_index WHERE id = '$id'"; mysql_query($sql, $db); } else if ($action == 'delete') { $sql = "SELECT * FROM $mysql_table WHERE `id` = '$id'"; $result = mysql_query($sql, $db); if ($data = mysql_fetch_array($result)) { $wwb_index = $data['wwb_index']; } $sql = "DELETE FROM $mysql_table WHERE `id` = '$id'"; mysql_query($sql, $db); $sql = "UPDATE $mysql_table SET wwb_index=wwb_index-1 WHERE wwb_index > '$wwb_index' AND `wwb_id` = '5newsletters'"; mysql_query($sql, $db); } else if ($action == 'imagelist') { $ext_to_show = array("gif","jpg","jpeg","jpe","pjpeg"); $files_to_show = array(); if ($handle = opendir($upload_folder)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && is_file($upload_folder.$file)) { $ext = (pathinfo($upload_folder.$file)); if(in_array(strtolower($ext['extension']), $ext_to_show)) { $files_to_show[] = $file; } } } closedir($handle); } echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo 'Image list'."\n"; echo ''."\n"; echo ''."\n"; if (empty($files_to_show)) { echo "No files to show."; } else { sort($files_to_show); foreach ($files_to_show as $file) { echo '
'."\n"; echo '
'."\n"; } } echo ''."\n"; echo ''; exit; } } ?> Counties-Hauraki Nerwsletter \n\n"; } ?>
Northern Division
COUNTIES-HAURAKI - MONTHLY NEWSLETTER
The Monthly Newsletter of the Counties-Hauraki District is full of interesting Masonic articles and news from around the District.

This chatty publication is prefixed by comments from the District Grand Master, and is followed by interesting, and sometimes quirky articles of general masonic interest.

It is also great to see so many photos of the various events being reported on.

A great read.
Click here to read the Division's "Plan on a Page"
\n"; echo "\n"; echo "\n"; echo "\n"; } else if ($action == 'image') { if ($authorized) { echo "
\n"; echo "\n"; echo "Filename:
\n"; echo "\n"; echo "
\n"; echo "
Back to overview
\n"; } } else if ($action == 'upload') { if ($authorized && isset($_FILES['filename'])) { $name = $_FILES['filename']['name']; $type = $_FILES['filename']['type']; $tmp_name = $_FILES['filename']['tmp_name']; $error = $_FILES['filename']['error']; $size = $_FILES['filename']['size']; switch ($error) { case 0: if ($type == 'image/gif' || $type == 'image/jpeg' || $type == 'image/pjpeg') { if ($size <= $max_size) { if (!file_exists($upload_folder. $name)) { if (move_uploaded_file($tmp_name, $upload_folder. $name)) { echo "Image succesfully uploaded!

\n"; echo "Filename:
". $upload_folder. $name. "
\n"; } else { echo "Error: Upload failed, please verify the folder's permissions.\n"; } } else { echo "Error: The image already exists.\n"; } } else { echo "Error: The image is too big.\n"; } } else { echo "Error: Wrong file type, please only use jpg or gif images.\n"; } break; case 1: echo "Error: The uploaded file exceeds the 'upload_max_filesize' directive.\n"; break; case 2: echo "Error: The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.\n"; break; case 3: echo "Error: The uploaded file was only partially uploaded.\n"; break; case 4: echo "Error: No file was uploaded.\n"; break; case 6: echo "Error: Missing a temporary folder.\n"; break; case 7: echo "Error: Failed to write file to disk.\n"; break; case 8: echo "Error: File upload stopped by extension.\n"; break; } } else { echo "Error: No filename specified!
\n"; } echo "

Back to overview
\n"; exit; } else if ($action == 'edit' || $action == 'new') { if ($authorized) { $text = ''; $title = ''; if ($id >= 0) { $sql = "SELECT * FROM $mysql_table WHERE id = '".$id."'"; $result = mysql_query($sql, $db); if ($data = mysql_fetch_array($result)) { $text = $data['wwb_text']; $title = $data['wwb_title']; } } echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
Title:
\n"; echo " \n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; } } else { if ($authorized) { echo "Create new item  "; echo "Upload image  "; echo "Image list  "; echo "Logout

\n"; } $sql = "SELECT * FROM $mysql_table WHERE `wwb_id` = '5newsletters' ORDER BY wwb_index ASC"; $result = mysql_query($sql, $db); $num_rows = mysql_num_rows($result); if ($num_rows > 0) { while ($data = mysql_fetch_array($result)) { echo "" . $data['wwb_title'] . "
\r\n"; echo $data['wwb_text']; echo "
"; echo "
\n"; if ($authorized) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo "
\n"; echo "
\n"; } echo "
\n"; } } else { echo "No news

"; } } ?>