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

jjjacas

New Member
Messages
18
Reaction score
0
Points
0
Hi everyone I am a new girl here, i recently bought a pretty and fantastic template to showcae my Paintings and Art and to promote my Frame Shop. The Site is a Dynamic Flash Photo Gallery done almost entirely in Flash. I am able to customize it through a .htm file by editing preset text and replacing preset images with my own. It also contains an admin panel for uploading images to my gallery which is VERY nifty.

But BEFORE i do any more of that.
I need help getting a Contact Form to work correctly and to send to an email address. Please...

The Contact Form is made up of TWO files(which are made to specifically work and fit in my Template, so i guess i cant exchange the code with new code,i must edit what is already there to make it work):
contact.asp
contact.php


The thing is,I CANT just find a Contact/Email Tutorial and copy it because the Contact/Email Form is already preset into my Template. I guess i must change some code in the two files that make it WORK.

But i do not know how to go from there.... I know absolutely nothing about HTML or PHP or SMTP or anything to get a Form to send emails. Please help me.... :(

Here is my site:
http://jamneajacas.x10hosting.com
I have not modified anything in my X10 hosting, i have ADD-FREE. And ONLY Upgraded PHP to Intermediate (to fix WYSIWYG fatal errors).

Here is the code that is inside each of the files:

CONTACT.ASP=
Code:
<%
    for i=1 to 7
         message=Request("message")
    next
         message=message + Request("message")    
        smtpServer = "enter your SMTP SERVER HERE"
        smtpPort = 25
        

        name = Request("Your_Name:")
        Set myMail = CreateObject("CDO.Message") 
        myMail.Subject = "from " & name
        myMail.From = Request("Your_Email:")
        myMail.To = Request("recipient")
        myMail.HTMLBody = "<html><head><title>Contact letter</title></head><body><br>" & message & "</body></html>"
        myMail.Configuration.Fields.Item("[URL]http://schemas.microsoft.com/cdo/configuration/sendusing[/URL]") = 2
        myMail.Configuration.Fields.Item("[URL]http://schemas.microsoft.com/cdo/configuration/smtpserver[/URL]") = smtpServer
        myMail.Configuration.Fields.Item("[URL]http://schemas.microsoft.com/cdo/configuration/smtpserverport[/URL]") = smtpPort
        myMail.Configuration.Fields.Update 
        myMail.Send
    
%>
CONTACT.PHP=
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= "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($_REQUEST['recipient'], $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>
I already tried entering my email into the "your email here" and "your_email" sections with no success... I apologize i am a complete newbie when it comes to Web Site Code.

What Server/Hosting side Optoins and .php and .asp code do I have to change to get this form to work? Can a girl get some help Please?
 
Last edited:

Sohail

Active Member
Messages
3,055
Reaction score
0
Points
36
I don't think ASP works with Flash, but i do know the PHP does. So that's why you need to convert the documnet right?
 
Last edited:

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
Sorry i cant get your problem. Put your email address in the place specified in the template and test the site. Post the error that you are getting. More over your site was not scrollable for me to see the submit button. Most bottom part of the site cannot be seen in my system.
 

easykey

New Member
Messages
45
Reaction score
0
Points
0
Do you mean you are not getting any mail? There does not seem to be any errors reported when using the form.

Know nothing about asp but in your php form the mail() function sends the mail to $_REQUEST['recipient']. You can add echo $_REQUEST['recipient']; as the first line in contact.php to see where mail() is wanting to send the message. Perhaps this is something preset in the flash template that you need to edit.
 

jjjacas

New Member
Messages
18
Reaction score
0
Points
0
@ sunils

Ah i see... how do i make my site scrollable? The template came that way, to see the bottom, i have to go to 1280x1024 Resolution.

And i did already put my email into the place specified, I mentioned it at the bottom of my post. But i did not receive any email from it.

@ easykey

Correct, i am not receiving any mail, I'm not sure why when i put my email in the required spots i still did not receive anything. But it still says that "You're message was sent!" when i hit "submit" to try and send something to my mail...

Preset in the flash template, i don't think so. The main.fla and .swf in the site i don't have to edit. I can edit all content through a xxxxx_main.html. And that file says nothing about email.

The only two files that say anything about mail are the contact.asp and contact.php, so if theres any code i must change its in those two files. Things is i already tried putting my email in the "your email here" and "your_email" spots, but nothing works.

I will attempt to add the line you mentioned

echo $_REQUEST['recipient'];

to the top of contact.php and see if that helps. Anyone else know how to get this forum working?
 

easykey

New Member
Messages
45
Reaction score
0
Points
0
The 'your_email' and 'your_name' fields will tell you where the email is from - you are interested in the field that tells the server where the email is going to. This is the first part of the mail() function in the contact.php page.

If there is nothing (or something wrong) in $_REQUEST['recipient'] then you can always change it in contact.php to your email address enclosed in "" i.e.
PHP:
mail("info@somewhere.com", $subject etc....

If $_REQUEST['recipient'] is OK then there must be a problem on the x10hosting mail server. It's important to know what is in that field...
 

jjjacas

New Member
Messages
18
Reaction score
0
Points
0
Do you mean you are not getting any mail? There does not seem to be any errors reported when using the form.

Know nothing about asp but in your php form the mail() function sends the mail to $_REQUEST['recipient']. You can add echo $_REQUEST['recipient']; as the first line in contact.php to see where mail() is wanting to send the message. Perhaps this is something preset in the flash template that you need to edit.
Ok i tried adding that line like you said and this is what i got... it shows the email its sending to , right??



But that email is not in the contact.php or contact.asp? I'm guessing if i find th code where that email is located , i can change it to my email, will that work?

Can anyone help me find where that code is located?

Here is an image of the public_html directory in my hosting:

Maybe the code for that email is located in a file besides contact.php and contact.asp, since as you can see, that email is not in the code for those two files.
 
Last edited:

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
I have made a small adjustment in the coding

This was your coding
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);
 }

mail($_REQUEST['recipient'], $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>

I have marked some coding within the /***********/. Replace that coding by the coding which i have given below.

PHP:
$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);
}
$message = "<html><head> <title>Contact letter</title></head><body><br>".$message."</body></html>";

mail("put your email address here double quotes is needed", $subject, $message, $headers);
echo ("Your message was successfully sent!");


Replace the text in mail() function it with your email address in which you want to receive the mails. (within double quotes.)

I think this will do the job.
 
Last edited:

jjjacas

New Member
Messages
18
Reaction score
0
Points
0
The 'your_email' and 'your_name' fields will tell you where the email is from - you are interested in the field that tells the server where the email is going to. This is the first part of the mail() function in the contact.php page.

If there is nothing (or something wrong) in $_REQUEST['recipient'] then you can always change it in contact.php to your email address enclosed in "" i.e.
PHP:
mail("info@somewhere.com", $subject etc....

If $_REQUEST['recipient'] is OK then there must be a problem on the x10hosting mail server. It's important to know what is in that field...
Thanks, i did not knwo those feild were for the person SENDING the email. Thanks for letting me know.

I didnt have a
PHP:
mail("info@somewhere.com", $subject etc....
part in my code. But sunil helped me out and now the email works! :D

My only concern is that i left the
PHP:
$_REQUEST['recipient']
code in there to see where it sent to, and i still shows up as...


but it DID send to my mail. Here is a picture.


@ Sunil, Thank you very much for helping me fix it, how did you kow?

By the way I have 3 more questions they are easy ones. ;)

1. How can i repay you guys for helping me?
2. What is that extra text and numbers in teh emial that was sent? What does it mean, any way to get rid of it?
3. My site doesn't have a scroolbar, how can i add one?

Thank you oh-so very much for what you
ve done so far fellas!! :bowdown:
 

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
Thanks, i did not knwo those feild were for the person SENDING the email. Thanks for letting me know.

I didnt have a
PHP:
mail("info@somewhere.com", $subject etc....
part in my code. But sunil helped me out and now the email works! :D

The mail function was there in your coding itself. He just gave you that part alone, but i gave the instruction what to do.
By the way I have 3 more questions they are easy ones. ;)

1. How can i repay you guys for helping me?
2. What is that extra text and numbers in teh emial that was sent? What does it mean, any way to get rid of it?
3. My site doesn't have a scroolbar, how can i add one?

Thank you oh-so very much for what you
ve done so far fellas!! :bowdown:

About the three question, here are the answers,

(1).By saying a big thank you, you can repay us.
(2).About the extra text that you get may be due to the message thing that is being sent.
please this line in your code.

$message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";

First try this code instead of that line

$message.="&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";

check still if you get that extra text
otherwise use this code

$message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;<br>";

if still its there, let me think for some time about that. But i am sure that it is this line that is adding that extra text in the mail that you receive.

(3).Let me think about this also.
 

easykey

New Member
Messages
45
Reaction score
0
Points
0
Your site doesn't seem to work anymore. Tried in Firefox and IE and both just freeze. Eventually I get an error message:


---------------------------
Adobe Flash Player 9
---------------------------
A script in this movie is causing Adobe Flash Player 9 to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?
---------------------------
Yes No
---------------------------

Whether I click Yes or No the site just hangs until the error message comes up again. The only way out is to quit the browser through Task Manager!!
 

jjjacas

New Member
Messages
18
Reaction score
0
Points
0
Your site doesn't seem to work anymore. Tried in Firefox and IE and both just freeze. Eventually I get an error message:


---------------------------
Adobe Flash Player 9
---------------------------
A script in this movie is causing Adobe Flash Player 9 to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?
---------------------------
Yes No
---------------------------

Whether I click Yes or No the site just hangs until the error message comes up again. The only way out is to quit the browser through Task Manager!!
I usually does that right after i update any .php or .asp or add afile to teh Publi_html folder... you have to wait about 1 minute for that ot to happen. no worries...

sunils said:
(2).About the extra text that you get may be due to the message thing that is being sent.
please this line in your code.

$message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";

First try this code instead of that line

$message.="&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";

check still if you get that extra text
otherwise use this code

$message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;<br>";

if still its there, let me think for some time about that. But i am sure that it is this line that is adding that extra text in the mail that you receive.

(3).Let me think about this also.
Heres the info you asked for... Thanks again for the help with these extra issues. :)

When i used this:
$message.="&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";
I got this (still there):


When i used the second one:
$message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;<br>";
I got this (nothing, and a wierd email name...):
 
Last edited:

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
Use these two statements

echo $mess;
echo current($post_vars);

after the while loop finishes and before the mail() function.
 

jjjacas

New Member
Messages
18
Reaction score
0
Points
0
Where exactly is the while loop finish and before what mail function? I know absolutely nothing about PHP...

So, do i have to use any of these shown below?
sunils said:
(2).About the extra text that you get may be due to the message thing that is being sent.
please this line in your code.

$message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";

First try this code instead of that line

$message.="&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";

check still if you get that extra text
otherwise use this code

$message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;<br>";

if still its there, let me think for some time about that. But i am sure that it is this line that is adding that extra text in the mail that you receive.
 

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
I have taken a jist of the coding and posted here.

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>" , $headers);
echo ("Your message was successfully sent!");

Now do you see a line like this
/*****************************************/

now that the place which i meant. Now instead of that line
put this statement first.

echo $mess;

Now get the message that is printed on your browser when you execute this script.

Now use this statement and do as i have said for the other statement.
echo current($post_vars);

Get me the message that is being displayed on the screen, so that i can analyse the problem better and come out with a solution.
 

jjjacas

New Member
Messages
18
Reaction score
0
Points
0
ok thans for clarifying,

first i used this statement:
sunils said:
echo $mess;

And put it here:


THEN i used the second statement:
sunils said:
echo current($post_vars);

And put it here:



here is the text posted on my browser when the code was executed while sending 3 emails (2 with the first statement and 1 with the second statement, as you will see below) The message as you can see was teh same.

But eh emails sent were a little strange

They were missing some data, like the name of the sender, and the message, the emails were totally empty:

 

easykey

New Member
Messages
45
Reaction score
0
Points
0
Sunil is trying to track whether your code is adding the characters or the x10 mail server (I think). If so then he wanted to see what is displayed in contact.php. Note that these statements should not affect the actual email sent - they are only displaying variables that are used in making the email.

Since $mess is an array you should put:

PHP:
print_r($mess);

and not:

PHP:
echo $mess;

Replace it, send an email again and post what is displayed on the contact.php page displayed.

The PHP mail() function is used here to send html mail. Although thats very common, I've never used it like this but have often used it to send plain text mail. If things still don't work then I can give you simpler code for a plain text mail. But we do still need to see what is in $mess as above to construct a new mail() function.
 

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
thanks easykey, that was the thing which i meant. Sorry, forgot about the array there.

I need the screen shot of contact.php after executing the script.
 

bassel12

New Member
Messages
2
Reaction score
0
Points
0
Help with guestbook or blog or forum .. whatever u wanna call it

hey guys ... IM SICK OF BROWSING THROUGH PHP SCRIPTS TUTORIAL , i jjust want anyone of u guys to give me a php based code for a guest book .. i just want a page for editing the post and a page for displaying the other posts .. or whatever u have .. im sure u've got like a million scripts waiting for someone to stick them on his page .. plz help !
 
Top