PHP Pre-Made Email Sender To Chosen E-Mail

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by dquigley, Jan 22, 2009.

  1. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    Hello everyone and good day,

    I have an idea for a php script that I would like help with or any information on ones that may be similar.

    I would like to have a php script that allows members of a site to login to there account and then enter an email address, or more then 1, into some kind of form, then once they submit it will send those email adresses a premade form that is on the server, for example say someone likes a site and wants to invite there friend, I would like to make it easy for them to do so with a premade message script, just pop in the email and submit.

    If anyone can do this for me, or would like to help, I'd greatly appreciate it, right now I only have a little over 100 credits but I would gladly pay you more if we can come to an agreement.

    Thanks guys, and have a good day.
     
  2. nightscream

    nightscream New Member

    Messages:
    948
    Likes Received:
    0
    Trophy Points:
    0
    just a simple form with input boxes, if they click submit they script will send an email to the email adresses with a link to a form?
     
  3. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    Let me try to explain a bit better.

    You enter blah@blah.com

    Hit submit

    An email is sent to blah@blah.com

    The email reads, (whatever I edit the message to say) Hello Blah, John has invited you to join such and such click here to sign up.

    Hope that helps you understand.

    It would also be nice if they could send up to like 5, 10, or so emails at a time, to make it easier on themselves.
     
    Last edited: Jan 22, 2009
  4. John Klyne

    John Klyne Community Advocate Community Support

    Messages:
    964
    Likes Received:
    7
    Trophy Points:
    18
    using my name as an example huh....I get what you are trying to get done, I just can't be of help scripting anything, there should be something out there that is already developed but I am not sure.
     
  5. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    Yeah, if someone can't help me I will do it myself, and actually I use John as what I call a "common name" no offense, when I have to refer to a random, anonymous, or unknown person I usually use names like John, Smith, Joe, Bob. I'm not sure why : P
     
  6. xPlozion

    xPlozion New Member

    Messages:
    868
    Likes Received:
    1
    Trophy Points:
    0
    well, i'm not gonna make the whole thing, but i'm gonna give you parts that can help out ;)

    when they enter the email addresses, they normally seperate them by either a comma `,`, a semicolon `;` or a plain space ` `.

    say you have more than 1 email in that list, with php, you would do $emails = explode (',', $form_emails);

    then do a foreach: foreach ($emails = $v) {}, and then do the mail() with the content you want, $v being a single email.




    i don't use the mail command that much, but you may be able to send an email to multiple email accounts without disclosing the other emails it's being sent to.
     
  7. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    Yes, it would have to be done in a way that does not show other email addresses thank you. If I cannot find someone to do this for me I will attempt to do it myself, thanks.
     
  8. xPlozion

    xPlozion New Member

    Messages:
    868
    Likes Received:
    1
    Trophy Points:
    0
    i would suggest you take this time to attempt it yourself, and if there's a problem, come and ask for help. that way you learn how to do it and you learn from any mistakes you made ;)
     
  9. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    So I got one and I edited it, the form shows however it isnt sending the email. Let me post the coding here and someone can tell me why it isnt sending the email.
    Edit:
    HTML:
    <html> 
    <head>
    <title>Tell A Friend</title>
    <script language="javascript">
    <!--
    
    function reset() {
    document.tellafriend.name.value="";
    document.tellafriend.email.value="";
    document.tellafriend.friendmail1.value="";
    document.tellafriend.friendmail2.value="";
    document.tellafriend.friendmail3.value="";
    document.tellafriend.friendmail4.value="";
    document.tellafriend.friendmail5.value="";
    document.tellafriend.friendmail6.value="";
    document.tellafriend.friendmail7.value="";
    document.tellafriend.friendmail8.value="";
    document.tellafriend.friendmail9.value="";
    document.tellafriend.friendmail10.value="";
    }
    
    function validate() {
    
    
    if (document.tellafriend.friendmail1.value.length==0) {
    alert("please enter your friend's email address");
    return false;
    }
    
    if (document.tellafriend.email.value.length==0) {
    alert("please enter your email address");
    return false;
    }
    if (document.tellafriend.name.value.length==0) {
    alert("please enter your name");
    return false;
    }
    
    document.tellafriend.submit()
    return true;
    }
    
    //-->
    </script>
    </head>
    <body onLoad="reset()" topmargin="0" leftmargin="0"> 
    <center>
    </center>
    <table width="450" cellpadding="0" cellspacing="0" align="center"> 
    <tr valign="top"> 
    <td valign="middle" align="center"> 
    <p>Refer A Friend</p> 
    <form name="tellafriend" action="tellafriend.php" method="post" onSubmit="return checkfields()"> 
    <div align="center">
    <center>
    <table border="0" cellpadding="10" cellspacing="0">
    <tr>
    <td> Your Full Name:</td>
    <td>
    <input size="30" name="name" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Your Email:</td>
    <td>
    <input size="30" name="email" maxlength="45">
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <p align="center">Enter the recipients here:</td>
    </tr>
    <tr>
    <td>Email 1:</td>
    <td>
    <input size="30" name="friendmail1" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 2:</td>
    <td>
    <input size="30" name="friendmail2" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 3:</td>
    <td>
    <input size="30" name="friendmail3" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 4:</td>
    <td>
    <input size="30" name="friendmail3" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 5:</td>
    <td>
    <input size="30" name="friendmail3" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 6:</td>
    <td>
    <input size="30" name="friendmail3" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 7:</td>
    <td>
    <input size="30" name="friendmail3" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 8:</td>
    <td>
    <input size="30" name="friendmail3" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 9:</td>
    <td>
    <input size="30" name="friendmail3" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 10:</td>
    <td>
    <input size="30" name="friendmail3" maxlength="45">
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <p align="center">
    The email that is sent will contain your name and email address. <br>
    <input onClick="validate();" type="button" value="Click Here To Send">
    
    </td>
    </tr>
    </table>
    </center>
    </div>
    </form>
    </td>
    </tr> 
    <tr valign="top"> 
    <td valign="middle" align="center">&nbsp; 
    
    </td>
    </tr> 
    </table>
    </body>
    </html> 
    Edit:
    PHP:
    <?php


    // This following statement must be left intact.
    // Copyright (c) Michael Bloch and Taming The Beast.  
    // Tell-A-Friend script V 1.3  Updated September 20 2006
    // Taming the Beast.net - http://www.tamingthebeast.net
    // Free Web Marketing and Ecommerce articles and tools
    // By using this code you agree to indemnify Taming the Beast
    // from any liability that might arise from its use. 
    // The preceding statement be left intact. 

    if(count($_POST)) {
    # This section nukes nasty code that a malicious
    # party may attempt to inject into the form

    foreach(array('friendmail1','friendmail2','friendmail3','friendmail4','friendmail5','friendmail6','friendmail7','friendmail8','friendmail9','friendmail10','email','name') as $key$_POST[$key] = strip_tags($_POST[$key]);
    if(!
    is_secure($_POST)) { die("Asta la vista Hacker");}

    # This section sends an email to you when 
    # the form is used

    // Your email address (for copies to be sent to you)
    $emailto "tellafriend@dollarstoriches.com"

    // Your email subject text
    $esubject "A page has been sent"

    // The email text for copies sent to you
    $emailtext "
    $_POST[name] has used the tell-a-friend form. Their email address is $_POST[email]

    The people they have recommended your site to are:

    $_POST[friendmail1]
    $_POST[friendmail2]
    $_POST[friendmail3]
    $_POST[friendmail4]
    $_POST[friendmail5]
    $_POST[friendmail6]
    $_POST[friendmail7]
    $_POST[friendmail8]
    $_POST[friendmail9]
    $_POST[friendmail10]

    "
    ;

    # This sends the email to you

    @mail("$emailto"$esubject$emailtext"From: $_POST[email]");

    # This section sends to the recipients

    // Target page after successful submission
    // Change thankyou.htm to suit

    $thankyoupage "tellafriend.php"

    // Change the subject text below to suit

    $tsubject "A web site recommendation from $_POST[name]";

    // Change the text below for the email 
    // Don't change any "$_POST[value]" items

    $ttext "
    Hello,

    A friend or colleague of yours, 
    $_POST[name] , whose email address is $_POST[email] thought you may like to visit our site. 

    $_POST[name] has used our Tell-a-Friend form to send you this email.

    http://www.dollarstoriches.com/?ref={userid}

    "
    ;

    # This emails the recommendation to the addresses submitted
    @mail("$_POST[friendmail1],$_POST[friendmail2],$_POST[friendmail3],$_POST[friendmail4],$_POST[friendmail5],$_POST[friendmail6],$_POST[friendmail7],$_POST[friendmail8],$_POST[friendmail9],$_POST[friendmail10]"$tsubject$ttext"FROM: $_POST[email]");

    # After successful processing, the thank you page
    header("Location: $thankyoupage");
    exit;

    }

    # Don't change anything below

    function is_secure($ar) {
    $reg "/(Content-Type|Bcc|MIME-Version|Content-Transfer-Encoding)/i";
    if(!
    is_array($ar)) { return preg_match($reg,$ar);}
    $incoming array_values_recursive($ar);
    foreach(
    $incoming as $k=>$v) if(preg_match($reg,$v)) return false;
    return 
    true;
    }

    function 
    array_values_recursive($array) {
    $arrayValues = array();
    foreach (
    $array as $key=>$value) {
    if (
    is_scalar($value) || is_resource($value)) {
    $arrayValues[] = $value;
    $arrayValues[] = $key;
    }
    elseif (
    is_array($value)) {
    $arrayValues[] = $key;
    $arrayValues array_merge($arrayValuesarray_values_recursive($value));
    }
    }
    return 
    $arrayValues;
    }
    ?>
     
    Last edited: Jan 22, 2009
  10. xPlozion

    xPlozion New Member

    Messages:
    868
    Likes Received:
    1
    Trophy Points:
    0
    ok, i don't like that example, so i'm gonna provide you with what i would have done:

    PHP:
    <html>
    <head>
    <title>Tell a Friend</title>
    </head>

    <body>

    <?php
    if (!isset($_POST['send_email']))
    {
    ?>

    <form action="<?php echo $_SERVER['PHP_SELF'?>" method="post">
      <fieldset>
        <legend>Tell a Friend</legend>
        <input name="sender_name" type="text" /> Your Name<br />
        <input name="sender_email" type="text" /> Your Email<br />
        <input name="to_email" type="text" /> Recipients Email (separated by a comma)<br /><br />
        <input name="send_email" type="submit" value="Send" />
      </fieldset>
    </form>

    <?php
    }
    else
    {

      if (!empty(
    $_POST['sender_name']) && !empty($_POST['sender_email']) && !empty($_POST['to_email']))
      {

        
    $subject 'the subject';
        
    $message 'hello';
        
    $headers 'From: '.$_POST['sender_name'].' <'.$_POST['sender_email'].'>' "\r\n" .
          
    'X-Mailer: PHP/' phpversion() . "\r\n" .
          
    'Message-Id: <'.md5(uniqid(microtime())).'@'.$_SERVER['SERVER_NAME'].'>';

        
    $to_email_array explode (','$_POST['to_email']);
        foreach (
    $to_email_array AS $email)
        {
          
    mail($email$subject$message$headers);
        }

        echo 
    'All email\'s sent';
      }
      else
      {
        echo 
    'You left a field empty';
      }
    }
    ?>

    </body>
    </html>
     
  11. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0

    Hmm I like your version too, it's very hard for me to decide which one I like better, the one that I made has a nice layout, but yours allows emails seperated by commas...

    Well thanks for the help, Im gonna give you some credits and rep for helping.


    *edit*

    Now I just need to figure out why the original one isn't sending the emails.
     
    Last edited: Jan 23, 2009
  12. xPlozion

    xPlozion New Member

    Messages:
    868
    Likes Received:
    1
    Trophy Points:
    0
    lol, you don't have to keep the layout, as mine was a very generic basic form. you can code it up, but make sure the inputs are there with the proper name ;)
     
  13. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    Well I like yours coding wise, however I like this look better

    [​IMG]

    I know you are very busy so if you cant edit it I will see if someone else can do it. Thanks for all the help.
     
  14. xPlozion

    xPlozion New Member

    Messages:
    868
    Likes Received:
    1
    Trophy Points:
    0
    try this:
    PHP:
    <html>
    <head>
    <title>Tell a Friend</title>
    </head>

    <body>

    <?php
    if (!isset($_POST['send_email']))
    {
    ?>
    <table width="450" cellpadding="0" cellspacing="0" align="center"> 
      <tr valign="top"> 
        <td valign="middle" align="center"> 
          <p>Refer A Friend</p> 
          <form action="<?php echo $_SERVER['PHP_SELF'?>" method="post">
            <div style="text-align:center;">
              <table border="0" cellpadding="10" cellspacing="0">
                <tr>
                  <td> Your Full Name:</td>
                  <td>
                    <input name="sender_name" type="text" />
                  </td>
                </tr>
                <tr>
                  <td>Your Email:</td>
                  <td>
                    <input name="sender_email" type="text" />
                  </td>
                </tr>
                <tr>
                  <td>Enter the recipients here (seperate by a comma):</td>
                  <td>
                    <input name="to_email" type="text" />
                  </td>
                </tr>
              </table>
            </div>
          </form>
        </td>
      </tr>
    </table>

    <?php
    }
    else
    {

      if (!empty(
    $_POST['sender_name']) && !empty($_POST['sender_email']) && !empty($_POST['to_email']))
      {

        
    $subject 'the subject';
        
    $message 'hello';
        
    $headers 'From: '.$_POST['sender_name'].' <'.$_POST['sender_email'].'>' "\r\n" .
          
    'X-Mailer: PHP/' phpversion() . "\r\n" .
          
    'Message-Id: <'.md5(uniqid(microtime())).'@'.$_SERVER['SERVER_NAME'].'>';

        
    $to_email_array explode (','$_POST['to_email']);
        foreach (
    $to_email_array AS $email)
        {
          
    mail($email$subject$message$headers);
        }

        echo 
    'All email\'s sent';
      }
      else
      {
        echo 
    'You left a field empty';
      }
    }
    ?>

    </body>
    </html>
     
  15. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    Hmm, I do like that one, but I kinda want to take up the whole page.

    Is there any way to separate the email recipients into 10 boxes?

    I do like the comma feature, since that allows easier sending, however I think the look is more important in THIS situation, not only that but limiting each send to only 10 ppl helps deter spam since they cant send 100 emails at a time.
     
  16. xPlozion

    xPlozion New Member

    Messages:
    868
    Likes Received:
    1
    Trophy Points:
    0
    HTML:
    <html> 
    <head>
    <title>Tell A Friend</title>
    </head>
    
    <body topmargin="0" leftmargin="0"> 
    <center>
    </center>
    <table width="450" cellpadding="0" cellspacing="0" align="center"> 
    <tr valign="top"> 
    <td valign="middle" align="center"> 
    <p>Refer A Friend</p> 
    <form name="tellafriend" action="tellafriend.php" method="post"> 
    <div align="center">
    <center>
    <table border="0" cellpadding="10" cellspacing="0">
    <tr>
    <td> Your Full Name:</td>
    <td>
    <input size="30" name="sender_name" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Your Email:</td>
    <td>
    <input size="30" name="sender_email" maxlength="45">
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <p align="center">Enter the recipients here:</td>
    </tr>
    <tr>
    <td>Email 1:</td>
    <td>
    <input size="30" name="to_email[]" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 2:</td>
    <td>
    <input size="30" name="to_email[]" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 3:</td>
    <td>
    <input size="30" name="to_email[]" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 4:</td>
    <td>
    <input size="30" name="to_email[]" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 5:</td>
    <td>
    <input size="30" name="to_email[]" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 6:</td>
    <td>
    <input size="30" name="to_email[]" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 7:</td>
    <td>
    <input size="30" name="to_email[]" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 8:</td>
    <td>
    <input size="30" name="to_email[]" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 9:</td>
    <td>
    <input size="30" name="to_email[]" maxlength="45">
    </td>
    </tr>
    <tr>
    <td>Email 10:</td>
    <td>
    <input size="30" name="to_email[]" maxlength="45">
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <p align="center">
    The email that is sent will contain your name and email address. <br>
    <input type="submit" value="Click Here To Send" name="send_mail">
    
    </td>
    </tr>
    </table>
    </center>
    </div>
    </form>
    </td>
    </tr> 
    <tr valign="top"> 
    <td valign="middle" align="center">&nbsp; 
    
    </td>
    </tr> 
    </table>
    </body>
    </html> 
    tellafriend.php
    PHP:
    if (!empty($_POST['sender_name']) && !empty($_POST['sender_email']) && !empty($_POST['to_email']) && isset($_POST['send_mail']))
    {

      
    $subject 'the subject';
      
    $message 'hello';
      
    $headers 'From: '.$_POST['sender_name'].' <'.$_POST['sender_email'].'>' "\r\n" .
        
    'X-Mailer: PHP/' phpversion() . "\r\n" .
        
    'Message-Id: <'.md5(uniqid(microtime())).'@'.$_SERVER['SERVER_NAME'].'>';

      for (
    $i=0;$i<10;$i++)
      {
        
    mail($_POST['to_email'][$i], $subject$message$headers);
      }

      echo 
    'All email\'s sent';
    }
    else
    {
      echo 
    'You left a field empty';
    }
    the way that works is that on the input, the brackets [] are transformed into an array by php automatically, so instead of exploding the email string to an array, we've compiled one automatically
     
    Last edited: Jan 23, 2009
  17. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    Well crud, The script is working that you posted, however I am using an index frame kinda thing and when I use that it does not seem to work.

    Basically the point of this page was to keep only logged in users using the form, however it seems it is stopping the script from sending the mail, any clue why? I Actually copied this script as it was being used by another thing on my site, I simply changed the bottom part where it asks where to redirect or w/e im sure most of the script isnt rlly needed.

    PHP:
    <?php
    #-----------------------------------------------------------------------------#
    #---------------------------- Script4Profit.com ------------------------------#
    #--------------------------- nXn Matrix AutoPayment --------------------------#
    #---------- http://www.Script4Profit.com - elwin@Script4Profit.com -----------#
    #------------------- Copyright © 2007 Elwin HG - Indonesia  ------------------#
    #-----------------------------------------------------------------------------#
        
    require_once("../config_inc.php");
        require_once(
    "../includes/globals_inc.php");
        require_once(
    "../includes/member_login_inc.php");
        require_once(
    "../includes/member_level_inc.php");

        
    $max_show 50 ;
        
    $page $_GET['page'];
        if (!IsSet(
    $page)) {
            
    $page 1;
        }
        
    $start_num = ($page-1) * $max_show ;
        
    $end_num $start_num $max_show ;
        
    $dbres mysql_query("SELECT * FROM files ORDER BY dl_hit DESC");
        
    $total mysql_num_rows($dbres);
        
    $n ;
        
    $no $start_num;
        
    $content "";
        
    $page_num "";
        if (
    $total 0) {
            while (
    $row mysql_fetch_array($dbres)) {
                if (
    $n $start_num and $n <= $end_num) {
                    
    $no++;
                    
    $content .= "<tr onmouseover=\"javascript:style.backgroundColor='#E6FFFA'\" onmouseout=\"javascript:style.backgroundColor='#FFFFFF'\">\n";
                    
    $content .= "<td class=\"box2\" align=\"center\" valign=\"top\">$no</td>\n";
                    
    $content .= "<td class=\"box2\"><b><font color=\"#008080\">$row[ftitle]</font></b><br>$row[fdesc]<br> Size: $row[fsize]</td>";
                    
    $content .= "<td class=\"box2\" align=\"center\"><a href=\"download.php?id=$row[id]\" target=\"_blank\">
                        <img border=\"0\" src=\"../images/dload.gif\" alt=\"Download 
    $row[ftitle]\"></a></td>\n";
                    
    $content .= "</tr>\n";
                } else {
                    echo(
    "") ;
                }
                
    $n $n ;
            }
            
    $number_pages $total $max_show ;
            
    $c ;
            while (
    $c $number_pages) {
                
    $page_num .= " <a href=\"?page=$c\"> $c</a>";
                
    $c $c ;
            }
        } else {
            
    $content "";
            
    $page_num "-";
        }
        
    $show_array = array(
        
    'pagenum' => $page_num,
            
    'content' => $content,
            
    'total' => $total );
        
    display_member_page("member_reccomend.html"$show_array);
    ?>

    I was thinking. The site is dolarstoriches.com, once logged in you are in the dollarstoriches.com/members/ section, although it shows that you are in that section only the php files that redirect to dollarstoriches.com/theme/en/ are located. Those php files basically show a big frame around the files in the theme/en/ folder which is where the tellafriend form and php file are, however in the /member/ folder I have a php file that I posted above that is supposed to redirect to the members_reccomend.html form file in /theme/en/ Maybe because of that redirection it isnt working and I need to fix something?

    Sorry if all that sounds confusing I did my best to explain.
    Edit:
    I fixed it by going into the html form and redirecting

    PHP:
    <form name="tellafriend" action="tellafriend.php" method="post"
    Into

    PHP:
    <form name="tellafriend" action="../theme/en/tellafriend.php" method="post"
    I wasn't totally sure WHY it worked that way, but I kinda had a hunch that that was what I had to do to fix the problem, it almost seems like the form was stuck in the /members/ directory instead of where I put it. Guess that php file doesnt rlly point as much as it pulls : P
    Edit:
    Ok so now everything is working except the php I tried to implement is now showing up.

    Here is what the email showed
    and here is the php

    PHP:
    <?php

    if (!empty($_POST['sender_name']) && !empty($_POST['sender_email']) && !empty($_POST['to_email']) && isset($_POST['send_mail']))
    {

      
    $subject 'You Have Recieved An Invitation';
      
    $message 'Hello,

    A friend or colleague of yours, $_POST[sender_name] , whose email address is $_POST[sender_email] thought you may like to visit our site. 

    $_POST[name] has used our Tell-a-Friend form to send you this email.

    http://www.dollarstoriches.com/?ref={userid} '
    ;

      
    $headers 'From: '.$_POST['sender_name'].' <'.$_POST['sender_email'].'>' "\r\n" .
        
    'X-Mailer: PHP/' phpversion() . "\r\n" .
        
    'Message-Id: <'.md5(uniqid(microtime())).'@'.$_SERVER['SERVER_NAME'].'>';

      for (
    $i=0;$i<10;$i++)
      {
        
    mail($_POST['to_email'][$i], $subject$message$headers);
      }

      echo 
    'All email\'s sent';
    }
    else
    {
      echo 
    'You left a field empty';
    }  
    ?>
     
    Last edited: Jan 23, 2009
  18. t2t2t

    t2t2t New Member

    Messages:
    690
    Likes Received:
    0
    Trophy Points:
    0
    PHP doesn't look for variables inside ' and '. Fix:
    PHP:
    <?php

    if (!empty($_POST['sender_name']) && !empty($_POST['sender_email']) && !empty($_POST['to_email']) && isset($_POST['send_mail']))
    {

      
    $subject 'You Have Recieved An Invitation';
      
    $message 'Hello,

    A friend or colleague of yours, '
    .$_POST[sender_name].' , whose email address is '.$_POST[sender_email].' thought you may like to visit our site. 

    '
    .$_POST[name].' has used our Tell-a-Friend form to send you this email.

    http://www.dollarstoriches.com/?ref={userid} '
    ;

      
    $headers 'From: '.$_POST['sender_name'].' <'.$_POST['sender_email'].'>' "\r\n" .
        
    'X-Mailer: PHP/' phpversion() . "\r\n" .
        
    'Message-Id: <'.md5(uniqid(microtime())).'@'.$_SERVER['SERVER_NAME'].'>';

      for (
    $i=0;$i<10;$i++)
      {
        
    mail($_POST['to_email'][$i], $subject$message$headers);
      }

      echo 
    'All email\'s sent';
    }
    else
    {
      echo 
    'You left a field empty';
    }  
    ?>
     
  19. dquigley

    dquigley New Member

    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    Your the man, thank you. I'll go fix it right now, thanks a bunch!
    Edit:
    I had one more question, in the php side of this I tried to call some function, or variable, w/e its called it was
    And I called it here

    It is not working correctly. I have another php file that my site came with and it calls that and it works correctly, Ill post that file and maybe thatll help.

    Ok so this file right here is index.php(makes sure only members who are logged in can view page), which then calls member_home.html(content)


    Index.php
    PHP:
    <?php
        
    require_once("../config_inc.php");
        require_once(
    "../includes/globals_inc.php");
        require_once(
    "../includes/member_login_inc.php");
        require_once(
    "../includes/member_level_inc.php");
        
    display_member_page("member_home.html");
    ?>
    Member_home.html
    PHP:
    <p align="center"><font color="#00CC99"><b>H O M E</b></font></p>
    <
    p align="center"><b>Welcome To The Members Area {name}</b></p>
    <
    p align="center">&nbsp;</p>
    <
    p align="left">Your Referral URL : <a target="_blank" href="http://{program_url}/?ref={userid}">http://{program_url}/?ref={userid}</a></p>
    <p align="left">Referral Hits: <font color="#FF0000"><u>{stats}</u></font></p>
    <
    p align="left">Promote your referral URL to start your downline and make money.</p>
    <
    p align="left">&nbsp;</p>
    <
    p align="center"><strong>Premade Promotion Methods</strong>:</p>
    <
    p align="center">&nbsp;</p>
    <
    p align="center"><strong>Send emails to your friendscolleagues, and relatives :</strong><br>
      <
    textarea rows="11" name="letter" cols="57">Dear Friends...

    I want to know what your goals are this year.

    - . Do 
    You Want To Have Fancy Cars?
    - . 
    A Big House?
    - . 
    Successful Business?
    - . 
    Financial Freedom?
    - . 
    Wealth And A Easy Life?

    So... How do you get all this?

    - . 
    Lots Of Luck?
    - . 
    College Degree?
    - . 
    Years Of Hard Work?

    Could this happen to you?

    At {program_nameyou can start making money for just $10!

    Your potential income will be $46,860.00 a year, for each account!

    That's more then enough to give you everything you want!

    Visit my site :
    http://{program_url}/?ref={userid}


    Good luck!


    {name}
    http://{program_url}/?ref={userid}

          </textarea>
      <br>
    &nbsp;</p>
    <p align="center"> <strong>Use our banners in forum signatures or on your website:</strong><br>
      <img src="../images/banner.gif" alt="Dollars To Riches" width="468" height="60" border="0"><br>
      <textarea rows="2" name="code" cols="56"><a href="http://{program_url}/?ref={userid}" target="_top">
    <img border="0" src="http://{program_url}/images/banner.gif" alt="{program_name}" width="468" height="60"></textarea>
    </p>
    <p align="center">&nbsp;</p>
    <p align="center"><img src="../images/banner2.gif" alt="Dollars To Riches" width="468" height="60" border="0" /><br />
      <textarea rows="2" name="code2" cols="56"><a href="http://{program_url}/?ref={userid}" target="_top">
    <img border="0" src="http://{program_url}/images/banner2.gif" alt="{program_name}" width="468" height="60" /></a></textarea>
    </p>
    <p align="center">&nbsp;</p>
    <p align="center">&nbsp;</p>
    <p align="center"><b>Congratulations! and Good Luck!</b></p>
    Also the required files from the php, are needed im guessing, let me find which ones look relevant and I will post it.
    Edit:
    This is the only file that seemed relevant, if im wrong correct me.

    member_level_inc.php
    PHP:
    <?php
        defined
    '_VALID_MOS_' ) or die( 'Restricted Access' );
        if (
    $_SESSION['userlevel'] == '1' && $_SESSION['expired_time'] < $timenow) {
            
    mysql_query("UPDATE members SET expired='1',userlevel='0' WHERE userid='{$_SESSION['userid']}'");
            
    $_SESSION['userlevel'] = "0";
            
    $_SESSION['expired'] = "1";
        }
        if (
    $_SESSION['expired'] != 0) {
            
    $exptime $timenow $_SESSION['conf_expdays'] * 3600 24;
            
    $show_array = array(
            
    'startdate' => strftime($_SESSION['conf_date_format'], $timenow),
                
    'enddate' => strftime($_SESSION['conf_date_format'], $exptime)
            );
            
    display_member_page("member_expired.html"$show_array);
        }
        if (
    $_SESSION['userlevel'] != '1') {
            
    display_member_page("member_upgrade.html"$show_array);
        }
    ?>
     
    Last edited: Jan 23, 2009
  20. xPlozion

    xPlozion New Member

    Messages:
    868
    Likes Received:
    1
    Trophy Points:
    0
    it appears that by the looks of it, that it's either a defined variable, or that page passes through a template system and they get replaced with the proper value.

    in the email form try $_SESSION['userid'] instead of {userid}, and maybe protect it and only allow registered users to send the email (if your script doesn't do so from a higher level)

    PHP:
    if (!empty($_SESSION['userid']))
    {
      
    // is logged in so show the content
    }
    else
    {
      
    // is not logged in, show show a message saying that you need to be logged in
    }
    also, replace
    PHP:
    $_POST[name].' has used our Tell-a-Friend form to send you this email.

    http://www.dollarstoriches.com/?ref={userid} '
    ;
    with
    PHP:
    $_POST[name].' has used our Tell-a-Friend form to send you this email.

    http://www.dollarstoriches.com/?ref='
    .$_SESSION['userid'];
    since variables wont be parsed in apostrophes.
     
    Last edited: Jan 23, 2009

Share This Page