cancel
Showing results for 
Search instead for 
Did you mean: 

CGI-bin and php files

eversleybuildin
Newbie
Posts: 6
Registered: ‎31-03-2008

CGI-bin and php files

I have created a website in flash with a contact form. When the user hits the submit button the actionscript sends the information to a php file. I have placed this in the cgi-bin but it does not work. Where am I going wrong?
16 REPLIES 16
chillypenguin
Community Veteran
Posts: 4,729
Registered: ‎04-04-2007

Re: CGI-bin and php files

PHP should not be in the cgi-bin folder.
pierre_pierre
Grafter
Posts: 19,757
Registered: ‎30-07-2007

Re: CGI-bin and php files

eversleybuildin
Newbie
Posts: 6
Registered: ‎31-03-2008

Re: CGI-bin and php files

Quote from: chillypenguin
PHP should not be in the cgi-bin folder.

Do I need to place a script in the cgi-bin to send an email to me with the information collected in the form?
Peter_Vaughan
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: CGI-bin and php files

Just use what you have set-up but put the php file somewhere else like in it's own directory within the root directory and change the flash file to know about the new php location.
eversleybuildin
Newbie
Posts: 6
Registered: ‎31-03-2008

Re: CGI-bin and php files

Quote from: Peter
Just use what you have set-up but put the php file somewhere else like in it's own directory within the root directory and change the flash file to know about the new php location.

Thank you, I have tried this, but it hasn't worked. The script in the php file works because I had already tested it on a completely different server and I received emails. I'm not sure why it isn't working on a PlusNet server
Peter_Vaughan
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: CGI-bin and php files

Do you specify a from address when sending as that is a requirement when sending email on PNs web servers.
You could also post the php code (masking any email addresses) and we may be able to tell you why it does not work.
Nick_Russell
Grafter
Posts: 555
Registered: ‎10-05-2007

Re: CGI-bin and php files

Quote from: chillypenguin
PHP should not be in the cgi-bin folder.

Thanks for this...very helpful!
eversleybuildin
Newbie
Posts: 6
Registered: ‎31-03-2008

Re: CGI-bin and php files

Quote from: Peter
Do you specify a from address when sending as that is a requirement when sending email on PNs web servers.
You could also post the php code (masking any email addresses) and we may be able to tell you why it does not work.

I hadn't specified a from address, maybe this is what the problem is.
In the actionscript within the flash file I have a get URL which points to the php file, and the code for this is below,

<?
$destination="xxxx@xxxx.xxx";
$name=$_POST['name1'];
$email=$_POST['email'];
$company=$_POST['company'];
$number=$_POST['number'];
$comments=$_POST['message1'];
$subject="Message from website" ;
$mes="Name : $name\n
Email: $email\n
Company: $company\n
Phone: $number\n
Comments: $comments\n";
mail($destination,$subject,$mes);
?>
This has worked on other servers, do I need to add script to make it work on a PN server?
Thank you in advance for your help
Peter_Vaughan
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: CGI-bin and php files

Yes, you do need a from as it is an additional security measure PlusNet have on their ccgi servers.
$headers = "From: mailaddr@username.plus.com\r\n";
mail($destination,$subject,$mes,$headers);
See if that helps.
eversleybuildin
Newbie
Posts: 6
Registered: ‎31-03-2008

Re: CGI-bin and php files

I have tried the above but unfortunately it hasn't worked.  I placed the headers variable just before destination line. The from email address, just to be extremely clear, is the one that is used on the webspace i.e info@username.plus.com,yes?
Any further help would be appreciated!
Thank you
Peter_Vaughan
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: CGI-bin and php files

What is the getURL line and corresponding code before/after if you set the variables there.
I don't use flash but a quick look at the getURL() function means...
If you are using the POST option in getURL() then the parameters are passed via the $_POST[] array.
If you are using the GET option in getURL() and pass the parameters as part of the url (file.php?param1=aaa&param2=bbb) then they will be passed in the $_GET[] array.
eversleybuildin
Newbie
Posts: 6
Registered: ‎31-03-2008

Re: CGI-bin and php files

This is the code used in actionscript sitting in the flashfile, this script is on the submit button
} else {
_parent.loadVariables("http://www.xxxxxxxxxxxxxx.co.uk/xxxxx.php", "POST");
_parent.gotoAndStop(2);
}
}
The php that I quoted earlier sits in the xxxx.php file, exactly as it is written below(with the $headers addition) without any other code in there.
Any ideas?
Thanks
longtooth
Newbie
Posts: 9
Registered: ‎18-08-2007

Re: CGI-bin and php files

Quote from: chillypenguin
PHP should not be in the cgi-bin folder.

Please, what should be in the cgi.bin folder?
Peter_Vaughan
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: CGI-bin and php files

cgi-bin is for things like perl and shell scripts.