SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict IsaacV's Avatar
    Join Date
    Jan 2002
    Location
    Saint Petersburg
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Help Me: Email Script, have coder's block

    Id like an account creation code, please
    --Isaac

    PHP Code:
    <?php

    /**************************************
    *      EMAIL DISTRIBUTION SYSTEM
    *              by Isaac D.
    ***************************************/
    /*
    *  DATABASE SCHEMA
    CREATE TABLE mason_emails
    (
     ID int(10) NOT NULL auto_increment,
     name varchar(80) NOT NULL,
     email varchar(80) NOT NULL,
     INDEX email(email),
     PRIMARY KEY (ID)
    );
    *
    */
    //<--------------------------------------->
    //<             CONFIGURATION             >
    $path "C:\\blahblah\\blahblah\";
    $fname = "emails";
    $ext = ".txt";

    //<                                       >
    //<--------------------------------------->
    function printHeader(
    $title)
    {
    ?>
    <html>
     <head>
        <title>EDS - 
    $title</title>
    <meta http-equiv="
    Content-Type" content="text/htmlcharset=iso-8859-1" />
    <meta name="
    generator" content="EDS" />
        <basefont face="
    arial" />
     <style>
    BODY {     scrollbar-3d-light-color:#ffffff;
               scrollbar-arrow-color:#ffffff;
               scrollbar-base-color:white;
               scrollbar-dark-shadow-color:#000099;
               scrollbar-face-color:#000099;
               scrollbar-highlight-color:#ffffff;
               scrollbar-shadow-color:white}
     </style>
     </head>
    <body bgcolor="
    #FFFFFF" text="#000099" link="#000099" vlink="#000099" alink="#FFFFFF">
        
    <table cellpadding="3" cellspacing="0" border="1" width="100%" bordercolor="#336699" bordercolorlight="#336699" bordercolordark="#FFFFFF">
         <
    tr Valign="top">
          <
    td>
    <?
    php
    }
    function 
    printSecHeader($title)
    {
    ?>
       <tr>
         <td bgcolor="steelblue" colspan="2"><font size="1"><b><font size="2" face="Arial" color="white">$title</font></b></font></td>
       </tr>
    <?php
    }
    function 
    makeOptOpen($title$description="")
    {
    ?>
    <tr valign='top'><td bgcolor="lightsteelblue" width="25%"> <!-- Options Section:  <?php print $title?> -->
                <b><big><font color="steelblue" face="Arial"><?php print $title?></font></big></b><br />
                <?php print $description?>       </td>
           <td bgcolor="#EFEFEF">
    <?php
    }
    function 
    makeOptClose()
    {
    ?>
           </td>
    </td></tr>
    <?php
    }
    function 
    printFooter()
    {
    ?>

       </table><br clear="all" />
    </body>
    </html>
    <?php
    }
    function 
    printAddForm()
    {
        global 
    $HTTP_POST_VARS$i$atn;
        if(!
    $i$i 0;
        
    ?>
      <fieldset title="Add Emails" style="position : absolute; top:20 left:10">
      <legend name="Add"></legend>
       <form action="<?php print$HTTP_SERVER_VARS["PHP_SELF"]."?atn=add"?>" method="post">
        <blockquote>
           <input type="text" name="i" value="<?php print $i?>" /> <input type="submit" name="elemnumber" Value="Generate" />
        </blockquote>
        <blockquote>
        <?php
           $total 
    $i
           
    for($i 0$i $total$i++)
           {
         
    ?>
           <input type="text" name="email<?php print $i?>" />
           <input type="text" name="name<?php print $i?>" /><?php
           
    }
         
    ?>
        </blockquote>
        <blockquote>
          <input type="submit" name="submit" Value="submit" />
        </blockquote>
       </form>
      </fieldset>
       <?php
    }

    function 
    ewrite($entry)
    {
        
    $thefile $path.$fname.$ext;
        
    $fp fopen($thefile,"a");
        
    $result fwrite($fp,$entry);
        if(!
    $result)
            return 
    false;
        else
            
    fclose($fp);
    }
    function 
    eread()
    {
        
    $thefile $path.$fname.$ext;
        
    $fp fopen($thefile,"r");
        
    $emails fread($fpfilesize($thefile));
        
    fclose($fp);
        
    }
    function ()
    {
    }
    /*
    function ()
    {
    }
    */
    if(!$HTTP_POST_VARS["atn"])
        
    $atn "home";
    if(!
    $HTTP_POST_VARS["i"])
        
    $i 3;
     else
        
    $i $HTTP_POST_VARS["i"]

    if(isset(
    $atn) && $atn == "add")
    {
        if(isset(
    $submit))
        {
            if(!
    $email1 || !$name1)
        {
            
    ?><big>&raquo;</big><font color="red">You forget to fill in 1 or more required fields.</font>
                <?php
        
    }
            
    extract($HTTP_POST_VARS);
        for(
    $i 0; ; $i++)
        {
            
        }
        }
        
    printHeader("Add Emails");
        
        
    printAddForm();
        
        
    printFooter();

    }

    ?>
    I can't think of what to do to make it accept entries for multiple emails, can someone help?
    Last edited by IsaacV; Jun 5, 2002 at 20:38.
    Pants.
    Join the NYFlava Fashions Contest

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    one thing i'd like to point out is that your code is long and also un-syntax-highlighted (yes i'm beeching about it cos you've been here quite a while and should now how it plays out, isaac )...

    that aside, i guess maybe you want to accept user input in the form of first_email@domain.com, second_email@domain.com, third_email@domain.com

    if i'm on the right track, you should find the explode() function useful... anyway, if you could explain what you really want, we'll be on it

  3. #3
    SitePoint Addict IsaacV's Avatar
    Join Date
    Jan 2002
    Location
    Saint Petersburg
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh hey Redemption

    I meant to say that on my home page on the web site I'll have a little form that you submit your email to and it writes it to a file on the server. On the administration end, I want to be able to make it so that you can specify the number of forms you have to enter emails, so that it generates more than 1 for and I can enter in more than 1 email and it writes it to file. Then when I want to send an email, I just type in the HTML and fire it off and it sends an email to them based on the flatfile individually. It sounds pretty simple by unfortunately, I have coders block and it isn't going away. Can someone get me pointed in the right direction with this one?
    Pants.
    Join the NYFlava Fashions Contest

  4. #4
    SitePoint Addict IsaacV's Avatar
    Join Date
    Jan 2002
    Location
    Saint Petersburg
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone? Anyone at all? Anyone?
    Hello?
    Pants.
    Join the NYFlava Fashions Contest

  5. #5
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    normally i would try hard to decipher what you're trying to do but i'm feeling a little lazy today ... could you explain what you're trying to do again, in a step-by-step manner? sorry


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •