PHP
  Home arrow PHP arrow Page 4 - Creating a Mailing List Manager with P...
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Creating a Mailing List Manager with PHP
By: Duncan Lamb
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 39
    1999-12-16

    Table of Contents:
  • Creating a Mailing List Manager with PHP
  • Creating the front page
  • Adding names to the list
  • Editing the names
  • Autoresponders
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating a Mailing List Manager with PHP - Editing the names


    (Page 4 of 6 )


    To edit the names, we’ll use a crude but effective method: direct editing! Incorporating the editing into a form will make it less daunting, however. Observe the following code:

    First, the user should pick the list to edit:

    picklist.php3

    <html><head><title>Pick the list</title></head><body> <center> <br><br> Please pick the list you would like to edit: <br> <form method=post action="editnames.php3"> <select name="List" size=4> <? $fileloc = "lists.txt"; $groups = file("data/lists.txt"); for ($index=0; $index < count($groups); $index++) { $grouplist = split("\|", chop($groups[$index])); ?> <option value="<? echo $grouplist[1] ?>" <? if ($index==0) {echo "selected";} ?>> <? echo $grouplist[0] ?><br> <? } ?> </select> <br><br> <input type="submit" value="Edit list"></form></center> </body></html>
    Then, a form is created to allow editing and deleting of the names:

    editnames.php3

    <html><head><title>Edit Maillist addresses</title></head><body> <form method=post action="writenamefile.php3"> <br> Editing <? echo $List ?>. <br><br> Fix an address by editing in place, or delete an address by deleting the WHOLE line. <b>No blank lines or spaces allowed! </b> <br><br><textarea cols=50 rows=20 name="Body"> <? if (file_exists("data/$List")) {readfile("data/$List");} ?> </textarea> <br><br> <input type="hidden" name="List" value="<? echo $List ?>"> <input type="submit" name="submit" value="Save This List"></FORM> <br><br><a href="addnames.php3">Add names to the list</a>. <br><br><a href="data/log.txt">View Send Log</a>. <br> </body></html>
    The readfile function (line 8) reads in a file and directly sends in to the browser. This places all the addresses for the specified list into a textbox, where they can be deleted or fixed directly. Also, note the warnings about one address to a line, something to remind the administrator about what’s right and wrong. The next script saves all the changes:

    writenamefile.php3

    <html><head><title>Updating file....</title></head><body> <br><br> Changes saved to <? echo $List ?>.<br> <? $myfile = fopen("data/$List","w"); fputs($myfile,$Body); fclose($myfile); ?> <br> <a href="index.php3">Home.</a> </body></html>
    This was just as easy as reading the file in! Since the whole list was in the textbox, it is all included in the variable $Body, newlines and all. Writing $Body to the file saves the entire thing exactly as it looked in the previous form.

    More PHP Articles
    More By Duncan Lamb


       · The code have lot of little mistakes.
       · No it doesn't whoever posted that comment above needs to get a clue.
     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT