Flash Site "contact.php"&"contact.asp",to send Email. Code Gurus, I Need Help!

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by jjjacas, Mar 13, 2008.

  1. jjjacas

    jjjacas New Member

    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    Ok ok, i went back and read what he posted, i noticed the
    PHP:
    mail($_REQUEST['recipient'], $subject"
    So i added it, but look at my current code, is it correct so far? I'm sorry I am a bit confused...

    Code:
    <?
    Error_Reporting(E_ALL & ~E_NOTICE);
     while ($request = current($_REQUEST)) {
         if (key($_REQUEST)!='recipient') {
            $pre_array=split ("&777&",  $request);
            $post_vars[key($_REQUEST)][0]=$pre_array[0];
            $post_vars[key($_REQUEST)][1]=$pre_array[1];
        }
        next($_REQUEST);
    }
     
    reset($post_vars);
    $subject="From ".$post_vars['your_name'][0] ; 
    $headers = "MIME-Version: 1.0\r\n"; 
    $headers.= "Content-Type: text/html;"; 
    $headers.= "Charset=iso-8859-1\r\n"; 
    $headers.= "From: ".$post_vars['your_email'][0]; 
    $message=''; 
    while ($mess = current($post_vars))  
    { 
        if ((key($post_vars)!="i") && (key($post_vars)!="your email here") && (key($post_vars)!="your name here"))  
        { 
             $message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";   
        } 
            next($post_vars); 
    }
    mail($_REQUEST['recipient'], $subject, "
    <html>
    <head>
    <title>Contact letter</title>
    </head>
    <body>
    <br>
    ".$message."
    </body>
    </html>"; 
    [u][b]mail("shigerumiyamoto1@yahoo.com", $subject, $message, $headers);[/b][/u] 
    echo ("Your message was successfully sent!");  
    ?>
    <script>
        resizeTo(300, 300);
    </script>
    Compare the QWOTED code that sunil posted with my surrect contact.php code... the BOLD and underlined line is not in the code that sunil posted, but it is still present in my contact.php, what should i do with it?

    And then, what do i do next? Testing that code, which code, where exactly? please repeat the specific instructions please, I'm really 0% expereince with php or any coding language... :/ again thanks for understanding.
     
    Last edited: Mar 17, 2008
  2. easykey

    easykey New Member

    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    0
    Try the following. This is your original contact.php code from your first post but with your email address instead of what was there originally and the addition of the command to tell us what message is to be sent.

    Send an email and copy what was in the contact.php that is displayed.

    PHP:
    <?
    Error_Reporting(E_ALL & ~E_NOTICE);

     while (
    $request current($_REQUEST)) {
         if (
    key($_REQUEST)!='recipient') {
            
    $pre_array=split ("&777&",  $request);
            
    $post_vars[key($_REQUEST)][0]=$pre_array[0];
            
    $post_vars[key($_REQUEST)][1]=$pre_array[1];
        }
        
    next($_REQUEST);
    }



    reset($post_vars);


    $subject="From ".$post_vars['your_name'][0] ;
    $headers"From: ".$post_vars['your_email'][0] ."\n";
     
    $headers.='Content-type: text/html; charset=iso-8859-1';
     
    $message='';
      while (
    $mess current($post_vars)) {
          if ((
    key($post_vars)!="i") && (key($post_vars)!="your email here") && (key($post_vars)!="your name here")) {

             
    $message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";
        }
        
    next($post_vars);
     }

    print_r($mess);

    mail("shigerumiyamoto1@yahoo.com"$subject,  "
    <html>
    <head>
     <title>Contact letter</title>
    </head>
    <body>
    <br>
      "
    .$message."
    </body>
    </html>" 
    $headers);
    echo (
    "Your message was successfully sent!");

    ?>
    <script>
        resizeTo(300, 300);
    </script>
     
  3. jjjacas

    jjjacas New Member

    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    Ok, i replaced my current contact.php with the one you posted and this is what displayed when the e-mail is sent:
    [​IMG]

    Here is what it sent:
    [​IMG]

    Here is the first(top) email:
    [​IMG]

    Here is the second(bottom) email:
    [​IMG]

    Is that the info that you requested? If not, please explain it so i can understand and cooperate better. :)
     
  4. easykey

    easykey New Member

    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    0
    Well that didn't work... It should've displayed the message in a different format before printing "Your message was successfully sent".

    Try this instead to see what info comes from the email form - as before just send one email and post the contents of contact.php. You don't need to post the email content since this won't have changed.

    PHP:
    <?
    Error_Reporting(E_ALL & ~E_NOTICE);

    print_r($_REQUEST);

     while (
    $request current($_REQUEST)) {
         if (
    key($_REQUEST)!='recipient') {
            
    $pre_array=split ("&777&",  $request);
            
    $post_vars[key($_REQUEST)][0]=$pre_array[0];
            
    $post_vars[key($_REQUEST)][1]=$pre_array[1];
        }
        
    next($_REQUEST);
    }

    reset($post_vars);

    $subject="From ".$post_vars['your_name'][0] ;
    $headers"From: ".$post_vars['your_email'][0] ."\n";
     
    $headers.='Content-type: text/html; charset=iso-8859-1';
     
    $message='';
      while (
    $mess current($post_vars)) {
          if ((
    key($post_vars)!="i") && (key($post_vars)!="your email here") && (key($post_vars)!="your name here")) {

             
    $message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";
        }
        
    next($post_vars);
     }

    mail("shigerumiyamoto1@yahoo.com"$subject,  "
    <html>
    <head>
     <title>Contact letter</title>
    </head>
    <body>
    <br>
      "
    .$message."
    </body>
    </html>" 
    $headers);
    echo (
    "Your message was successfully sent!");

    ?>
    <script>
        resizeTo(300, 300);
    </script>
    The characters seem to be some sort of cookie information so I am guessing its coming from the form. Why you would need it I don't know and seems a bit odd to me. If you do the above we might be able to change the code to show only the info you want.
     
  5. sunils

    sunils New Member

    Messages:
    2,266
    Likes Received:
    0
    Trophy Points:
    0
    Can you just post all the field name i meant the name of each text boxes in you contact form ?
     
  6. jjjacas

    jjjacas New Member

    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    I copied that exact php you asked and overwrote the old contact.php, i sent an emial and this is what is shows:
    [​IMG]
    Is that what you needed?

    Is this what you need to know?

    [​IMG]


    EDIT: Also when i sent the email, in th contact firm i never recieved any email... for some reason? Is that what that code you told me to use suppoessed to do?
     
    Last edited: Mar 19, 2008
  7. sunils

    sunils New Member

    Messages:
    2,266
    Likes Received:
    0
    Trophy Points:
    0
    Is that the name for the fields or is it that you entered to send the email....

    Check the source code for that contact form. or please post it here.
     
  8. easykey

    easykey New Member

    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    0
    Try this now.


    PHP:
    <?
    Error_Reporting(E_ALL & ~E_NOTICE);

     while (
    $request current($_REQUEST)) {
         if (
    key($_REQUEST)!='recipient') {
            
    $pre_array=split ("&777&",  $request);
            
    $post_vars[key($_REQUEST)][0]=$pre_array[0];
            
    $post_vars[key($_REQUEST)][1]=$pre_array[1];
        }
        
    next($_REQUEST);
    }



    reset($post_vars);


    $subject="From ".$post_vars['your_name'][0] ;
    $headers"From: ".$post_vars['your_email'][0] ."\n";
     
    $headers.='Content-type: text/html; charset=iso-8859-1';

    $mess=$_REQUEST['message'];
    $message=substr($mess,0,strlen($mess)-5);

    mail("shigerumiyamoto1@yahoo.com"$subject,  "
    <html>
    <head>
     <title>Contact letter</title>
    </head>
    <body>
    <br>
      "
    .$message."
    </body>
    </html>" 
    $headers);
    echo (
    "Your message was successfully sent!");

    ?>
    <script>
        resizeTo(300, 300);
    </script>
    There's a lot of other info coming from the form which seems unnecessary but just the basic info should be enough for most people!
     
  9. jjjacas

    jjjacas New Member

    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    I posted the contact.php many times... if its not in there, then go to the FIRST page on ym FIRST post and check out teh contents (source code) of contact.ASP... maybe that is what you mean?

    I copied and pasted over my old contact.php and overwrote it with what you posted.

    This is what i got:
    [​IMG]
     
    Last edited: Mar 19, 2008
  10. easykey

    easykey New Member

    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    0
    And did the message look OK now? No strange characters etc...
     
  11. jjjacas

    jjjacas New Member

    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    Um i didn't get ANY email that time or the last two times i think... nope no emails received... what happened this time?

    remember that the contact.php is tied together with the flash site and the contact.asp as well, so changing too much might cause discrepancies..?
     
  12. easykey

    easykey New Member

    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    0
    Strange - I just tested this on my system and it works!!

    I used the data I got you to print out using the print_r($_REQUEST) line - put that into an identical copy of your contact.php form (except for changing the email address to mine) and it worked fine. No dodgy characters etc... So the code must be OK.

    I did it again using your email address - let me know if it got through.

    Note that the mail() function is totally independent of the flash template. The flash template passes some info to the contact.php page which is why I wanted that print of $_REQUEST. This is what comes from the flash template. After that it is just a case of taking what you want and putting it in the mail() function.
     
  13. jjjacas

    jjjacas New Member

    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    It got through...! it landed in the spam forlder though... automaticallly... hm.. what iss the code for my contact.php that you used to work? so i can use it and get it to work? Wow, i can't belive it actually workded!

    so what was it that was giving that wierd extra jumbled up data...?
     
  14. easykey

    easykey New Member

    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    0
    I used exactly the same code but went through my mail server. So the contact.php that I last posted works... If it doesn't work still then there must be another problem not related to the code - mail server or spam checker etc.

    The extra data was deliberately sent by the Flash template - why, I don't know. It might be useful to some people but seems over the top to me.
     
  15. jjjacas

    jjjacas New Member

    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    Ok, i added and replaced the contact.php code with the one that you last posted on page 3.

    And i don't receive any email at all? What happened?

    It worked last week, but over the weekend,now it just doesn't seem to send any mail to my email at all...

    Is the following information that you posted:
    contained withing the last contact.php code that you posted on page 3 that you told me to use?

    Please help.
     
  16. jjjacas

    jjjacas New Member

    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    well now with that last contact.php code you posted(which you told me to use, because it works), i wont receive any emails at all.... here it is...

    PHP:
    <?
    Error_Reporting(E_ALL & ~E_NOTICE);

     while (
    $request current($_REQUEST)) {
         if (
    key($_REQUEST)!='recipient') {
            
    $pre_array=split ("&777&",  $request);
            
    $post_vars[key($_REQUEST)][0]=$pre_array[0];
            
    $post_vars[key($_REQUEST)][1]=$pre_array[1];
        }
        
    next($_REQUEST);
    }



    reset($post_vars);


    $subject="From ".$post_vars['your_name'][0] ;
    $headers"From: ".$post_vars['your_email'][0] ."\n";
     
    $headers.='Content-type: text/html; charset=iso-8859-1';

    $mess=$_REQUEST['message'];
    $message=substr($mess,0,strlen($mess)-5);

    mail("admin@myframeshopgallery.com"$subject,  "
    <html>
    <head>
     <title>Contact letter</title>
    </head>
    <body>
    <br>
      "
    .$message."
    </body>
    </html>" 
    $headers);
    echo (
    "Your message was successfully sent!");

    ?>
    <script>
        resizeTo(300, 300);
    </script>
     
  17. easykey

    easykey New Member

    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    0
    This is why I thought it was strange. I tried the exact same code on my mailserver and it worked fine! I'll try again but on my x10hosting website and see if it still works. If it does you should get a mail from my test. I will use adminATmyframeshopgalleryDOTcom and shigerumiyamoto1ATyahooDOTcom to test...
    Edit:
    .
    Done - I got the email to my address so the contact.php page works and my test proves that there are no problems with the x10 mail server.

    We know the flash template is passing information to contact.php from the print_r($_REQUEST) command you did before.

    So that leaves either a problem with your mail address or there is something else happening when the flash template runs.

    I'm not sure what else I can do for you short of hosting your flash template and testing it again then!!
     
    Last edited: Mar 28, 2008

Share This Page