diff options
Diffstat (limited to 'pages/news.php')
-rw-r--r-- | pages/news.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/pages/news.php b/pages/news.php new file mode 100644 index 0000000..9d2f857 --- /dev/null +++ b/pages/news.php @@ -0,0 +1,58 @@ +<div class="header"> + <div class="header_news"> + <div class="header_text">News</div> + </div> +</div> +<a href="rss.xml" class="rss"></a> +<a href="rss.xml" class="rsstitle">Syndicate</a> +<?php + +include_once($UTIL_DIR . "/newsletter.php"); + +if($action == "subscribe") { + + $regexp = "^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$"; + + if($email != "your@email.here" && + ereg($regexp, $email, $regs)) { + $mailinglist = new Mailinglist($DATA_DIR . "/mailinglist.xml"); + $mailinglist->subscribe($email); + echo "<p>You have now been subscribed to the DIE newsletter...</p>\n"; + } else { + echo "<p><strong><em>" . $email . "</em> is not a valid email address...</strong></p>\n"; + } +} + +if($action == "unsubscribe") { + $mailinglist = new Mailinglist($DATA_DIR . "/mailinglist.xml"); + $mailinglist->unsubscribe($email); + echo "<p>You have now been unsubscribed from the DIE newsletter...</p>\n"; +} + +?> +<div class="news_form"> +<form action="?page=news&action=subscribe" method="post"> +<p style="text-align: center;"> +Subscribe to low-traffic mailinglist:<br/> +Email: <input name="email" value="your@email.here"/> +<button type="submit">Subscribe</button> +</p> +</form> +</div> +<?php +include_once($UTIL_DIR."/news.php"); + +$news = new News($DATA_DIR."/news.xml"); + +if($show == "all") { + $news->show(-1, "all"); +} else { + $news->show(4, "main"); +?> + +<div class="more"> +<a href="?page=news&show=all">more >></a> +</div> +<?php +} +?> |