"; $baseurl="http://hispowerportal.com/nw/index.php3"; //$sGroupName=ereg_replace("\&.*","",$QUERY_STRING); //$sGroupName=URLdecode($sGroupName); if($grpid){ /*Display a group's newsletter*/ $grouphandler=mysql("thebodyo","Select * from NW_Groups where GroupId='$grpid'"); $pageheader=StripSlashes(mysql_result($grouphandler,0,"Pageheader")); $pagefooter=StripSlashes(mysql_result($grouphandler,0,"Pagefooter")); $groupid=mysql_result($grouphandler,0,"GroupId"); $sGroupName=mysql_result($grouphandler,0,"Name"); if($articleid AND !$tellfriend){ /*Display Article*/ //increment hit counter @mysql("thebodyo","Update NW_Articles set hits=hits+1 where ArticleId=$articleid"); $clsArt=new ClsArticle($utilLib); $clsArt->viewArticle($articleid,$groupid,$pageheader,$pagefooter); }elseif($archive){ /*Show archive page*/ echo $pageheader; $newshandler=mysql("thebodyo","select *,CURDATE()-PublishDate as daysold from NW_Newsletters where PublishDate<=CURDATE() AND GroupId=$groupid ORDER BY daysold"); $numarticles=mysql_num_rows($newshandler); if($numarticles>0){ echo "Select the newsletter you'd like to read, according to its publish date.

"; echo ""; }else{ echo "No Archived newsletters exist."; } echo $pagefooter; }elseif($newsletterid){ /*Show old newsletter*/ $newshandler=mysql("thebodyo","select * from NW_Newsletters where Newsletterid=$newsletterid"); if(mysql_num_rows($newshandler)>0){ $coverpage=StripSlashes(mysql_result($newshandler,0,"CoverPage")); $publishdate=mysql_result($newshandler,0,"PublishDate"); } /*print header*/ echo $pageheader; echo "

Welcome to the ".$sGroupName."'s newsletter
Published $publishdate

\n"; echo $coverpage; $utilLib->listArticles($newsletterid,$groupid); $utilLib->listNewsItems($newsletterid); echo "

Back to Archives\n"; $thisurl=$baseurl."?".$QUERY_STRING; $eurl=base64_encode($thisurl); echo " - Email this page!

\n"; echo $pagefooter; }elseif($tellfriend){ echo $pageheader; $theurl=base64_decode($tellfriend); if($tellfriendsend){ if(!@ereg("\@",$sendemail)){ echo "Invalid Email Address Entered!"; }else{ echo "Mail Sent"; if($fromemail){ $fromemail="From: $fromemail\nReply-To: $fromemail\nX-Mailer: PHP/" . phpversion(); }else{ $fromemail="From: tellafriend@$SERVER_NAME\nReply-To: tellafriend@$SERVER_NAME\nX-Mailer: PHP/" . phpversion(); } mail($sendemail, "A friend has referred you to Hispowerportal.com", $friendtext,$fromemail); } echo "

Back to Newsletter"; }else{ $handler=mysql("thebodyo","Select * from NW_Groups where GroupId=$groupid"); $friendfooter=mysql_result($handler,0,"TellFriendFooter"); $friendtext="Hello, I'm sending you this email to tell you of something interesting I read at Hispowerportal.com.\n\nClick here: $theurl to check it out!\n\n"; if($articleid){ $ahandler=mysql("thebodyo","Select Body,Headline,Author from NW_Articles where ArticleId=$articleid"); $headline=mysql_result($ahandler,0,"Headline"); $author=mysql_result($ahandler,0,"Author"); $body=mysql_result($ahandler,0,"Body"); $friendtext.="$headline written by $author\n\n"; //find good place to cut off synopsis... $count=600; $stoppos=""; while(!$stoppos AND $count<1000){ if(strlen($body)>$count){ if(substr($body,$count,1)==" "){ $stoppos=$count; } $count++; }else{ $stoppos=strlen($body); } } $synopsis=substr($body,0,$stoppos)."..."; $synopsis=eregi_replace("\","",$synopsis); $friendtext.="$synopsis\n\n"; } $friendtext.=$friendfooter; echo "Customize your email and press the send button, to send this email to a friend.

"; echo "
Email to Send to: (required)


Email to Send from: (optional)


"; echo "

Back to Newsletter"; } echo $pagefooter; }else{ /*Display Current Newsletter*/ $newshandler=mysql("thebodyo","select *,CURDATE()-PublishDate as daysold from NW_Newsletters where PublishDate<=CURDATE() AND GroupId=$groupid ORDER BY daysold"); if(mysql_num_rows($newshandler)>0){ $newsletterid=mysql_result($newshandler,0,"NewsletterId"); $coverpage=StripSlashes(mysql_result($newshandler,0,"CoverPage")); $publishdate=mysql_result($newshandler,0,"PublishDate"); /*print header*/ echo $pageheader; echo "

Welcome to the ".$sGroupName."'s newsletter
Published $publishdate

\n"; echo $coverpage; $utilLib->listArticles($newsletterid,$groupid); $utilLib->listNewsItems($newsletterid); echo "

View Complete Archive List\n"; $thisurl=$baseurl."?".$QUERY_STRING; $eurl=base64_encode($thisurl); echo " - Email this page!

"; //echo "Click Here to Join this Email List Interest Group is ".$sGroupName.""; echo $pagefooter; }else{ echo $pageheader; echo "This group has yet to publish their first newsletter. Stay tuned for updates!"; echo $pagefooter; } } }else{ /*Display links to all groups*/ $handler=mysql("thebodyo","Select Name,GroupId from NW_Groups where GroupId!=1"); echo "Choose a group's newsletter to view:

"; $numgroups=mysql_numrows($handler); for($i=0;$i<$numgroups;$i++){ $name=mysql_result($handler,$i,"Name"); $grpid=mysql_result($handler,$i,"GroupId"); echo "$name

"; } } echo "\n"; ?>