Location: PHPKode > projects > LySite > lysite/newsletter.php

       Brad Landis (hide@address.com)

   Copyright (C) 2005 Brad Landis

   This program is free software; you can redistribute it
   and/or modify it under the terms of the GNU General
   Public License as published by the Free Software
   Foundation; either version 2 of the License, or (at your
   option) any later version.

   This program is distributed in the hope that it will be
   useful, but WITHOUT ANY WARRANTY; without even the
   implied warranty of MERCHANTABILITY or FITNESS FOR A
   PARTICULAR PURPOSE.  See the GNU General Public License
   for more details.
   You should have received a copy of the GNU General Public
   License along with this program; if not, write to the
   Free Software Foundation, Inc., 51 Franklin Street, Fifth
   Floor, Boston, MA  02110-1301, USA.

$subtitle = "Newsletter Archives";

if($_GET['month']) {
	$query = "SELECT * FROM email_archives WHERE month='$_GET[month]' LIMIT 1";
	if($results = mysql_query($query)) {
		if(mysql_num_rows($results) > 0) {
			$line = mysql_fetch_assoc($results);
			echo "<h2>".date("F Y",strtotime($line['month']))."</h2>\n";
			echo nl2br($line['message']);
		} else {
			notice("Could not find message.");
} else {
	echo "<h2>Newsletter Archives</h2>\n";
	$query = "SELECT month FROM email_archives WHERE month<=NOW() ORDER BY month DESC";
	if($results = mysql_query($query)) {
		if(mysql_num_rows($results)>0) {
			while($line = mysql_fetch_assoc($results)) {
				echo "<a href='newsletter.php?month=$line[month]'>".date("F Y",strtotime($line['month']))."</a><br>\n";
		} else {
			notice("No newsletters found");
	notice("To sign up for the newsletter, you need to have an account. Click on 'Monthly Only' on 'Settings' or when you register. The email should be mailed on the first of each month.\n");

Return current item: LySite