home *** CD-ROM | disk | FTP | other *** search
/ Neil's C++ Stuff / 2002-11-php_neilstuff_com.zip / news / _desc.php next >
Text File  |  2004-01-11  |  4KB  |  107 lines

  1. <?    global $addr, $mt, $vfy;
  2.     require_once('news/newslist.php');
  3.  
  4. if ($vfy != '')
  5. {
  6.     $nl = LoadNewsList('news/recip.xml');
  7.  
  8.     $i = $nl->Find($addr);
  9.     if ($i < 0)
  10.     {
  11.         echo("The address \"$addr\" hasn't been subscribed.");
  12.     }
  13.     else
  14.     {
  15.         if ($nl->code[$i] == $vfy)
  16.         {
  17.             $nl->Verify($i);
  18.  
  19.             echo("The address \"$addr\" has been verified and will receive the NeilStuff Newsletter.");
  20.  
  21.             for ($ni = 0; $ni < $map->len; $ni++)
  22.             {
  23.                 if ($map->map[$ni]->par >= 0)
  24.                 {
  25.                     if (isset($map->map[$map->map[$ni]->par]->u) &&
  26.                         $map->map[$map->map[$ni]->par]->u == 'news')
  27.                     {
  28.                         $letter = $map->map[$ni]->id;
  29.                         break;
  30.                     }
  31.                 }
  32.             }
  33.  
  34.             if ($ni >= $map->len)
  35.             {
  36.                 echo('The latest newsletter could not be located so you will not receive a NeilStuff Newsletter until the next one is posted.  If you feel this is in error, please email me. ');
  37.             }
  38.             else
  39.             {
  40.                 if ($nl->SendNews($letter, $i) == false)
  41.                 {
  42.                     echo('Could not send the latest newsletter to you, bad!');
  43.                 }
  44.                 else
  45.                 {
  46.                     echo('You should receive the last posted newsletter in your email soon.');
  47.                 }
  48.             }
  49.             $nl->Save('news/recip.xml');
  50.         }
  51.         else if ($nl->code[$i] == '')
  52.         {
  53.             echo("The address \"$addr\" has already been verified and will receive the NeilStuff Newsletter");
  54.         }
  55.         else
  56.         {
  57.             echo("The verification code you submitted for \"$addr\" was incorrect.");
  58.         }
  59.     }
  60. }
  61. else if ($addr != '')
  62. {
  63.     $nl = LoadNewsList('news/recip.xml');
  64.  
  65.     $i = $nl->Find($addr);
  66.  
  67.     if (!isset($rvfy))
  68.     {
  69.         if ($i >= 0)
  70.         {
  71.             echo("The address \"$addr\" has already been subscribed, but is not yet verified.  If you have the verification code, type it in below:<BR><FORM NAME=vfy METHOD=POST ACTION=\"" . me() . "\"><INPUT TYPE=HIDDEN NAME=addr VALUE=\"$addr\"><INPUT TYPE=HIDDEN NAME=mt VALUE=\"$mt\">Verification Code: <INPUT TYPE=TEXT NAME=vfy> <INPUT TYPE=SUBMIT VALUE=\"Verify\"></FORM><BR><FORM NAME=rvfy METHOD=POST ACTION=\"" . me() . "\"><INPUT TYPE=HIDDEN NAME=addr VALUE=\"$addr\"><INPUT TYPE=HIDDEN NAME=rvfy VALUE=\"1\"><INPUT TYPE=SUBMIT VALUE=\"Resend confirmation message & verification code\">");
  72.             exit;
  73.         }
  74.  
  75.         $i = $nl->AddNew($addr, $mt);
  76.         if ($i < 0)
  77.         {
  78.             echo("Could not subscribe \"$addr\"!");
  79.             exit;
  80.         }
  81.     }
  82.  
  83.     $nl->SendVfy($i);
  84.     $nl->Save('news/recip.xml');
  85.     
  86.     echo("You have been sent an email containing a verification code<SUP>*</SUP>.  You need this to verify that you can, in fact, receive mail at the address you specified.  If you do not verify the address you will not be sent the NeilStuff Newsletter.<BR><BR><SUP>*</SUP> If you do not receive an email within 24 hours (at <I>most</I>!), come back and try re-subscribing.");
  87.  
  88. }
  89. else
  90. {
  91.     $page = '';
  92.     
  93.     $page .= "<IMG SRC=\"gfx/me/licker.gif\" WIDTH=200 HEIGHT=250 ALT=\"Licker\" BORDER=0 ALIGN=RIGHT>";
  94.     
  95.     $page .= "The NeilStuff Newsletter includes useful content on learning C++ as well as site updates and possibly other projects of mine.  At most I'll be sending out one newsletter a week, but most of the time it ends up being every three months! :)  If you would like to receive the newsletter in your email, fill out the information below to subscribe.  Your email address will <I>not</I> be compromised or used for <I>anything</I> except this newsletter.<BR><BR>";
  96.  
  97.     $page .= "<FORM NAME=subscribe METHOD=POST ACTION=\"" . me() . "\">\n";
  98.     $page .= "Email Address: <INPUT MAXLENGHT=64 TYPE=TEXT NAME=addr><BR>";
  99.     $page .= "Preferred Format: <INPUT TYPE=RADIO NAME=mt VALUE=\"text\" CHECKED=TRUE>Plain Text <INPUT TYPE=RADIO NAME=mt VALUE=\"html\"> HTML<BR><INPUT TYPE=SUBMIT VALUE=\"Submit\"></FORM><BR>";
  100.  
  101.     $page .= "<FONT SIZE=-1>When you submit your I.P. address and the current time will be logged.  This is in case you're subscribing someone else's address and they want to find out who was trying to subscription bomb them.  A confirmation email will be sent to the address you fill in.  It will contain an unlocking used to solidify the subscription.<BR><BR>";
  102.  
  103.     $page .= "A note on the format.  If your email client supports HTML, then that's what you should select.  It will be easier to read and <I>will not contain anything that the plain text version doesn't</I>.  Simply translated: you won't see banners and images and applets and script and crap ... it'll just be basic HTML.</FONT>";
  104.  
  105.     echo($page);    
  106. }
  107. ?>