-
do you have to have mysql to use a php file?
im trying to use a php file to work with my swf website to allow me to have text sent via email. i know nothing about mysql and next to nothing about php.
because its not working with my swf, index.html, and email.php files loaded to my web directory, do i have to do something with mysql to get it the php and swf to work together?
im getting more and more lost trying to resolve my last problem with my website
-
Juvenile Delinquent
You shouldn't need MySQL for what you are trying to accomplish. Have you checked if your webhost have php (and if it's turned on)?
Create a file called info.php and put the following line in:
<?PHP phpinfo() ?>
Then upload it to your website and go to http://www.yourwebsite.com/info.php
-
i think that worked. it gives me a bunch of php info. what do i do now
www.parkagencywest.com/info.php
-
If you want to send mail using PHP, you are going to need the php mail function. The php docs are here:
http://php.net/mail
-
can you guys take a look at this code and see if they match up
Code:
var sendData_lv:LoadVars = new LoadVars();
var receiveData_lv:LoadVars = new LoadVars();
var formValidated:Boolean;
var errorMessages:Array = new Array();
receiveData_lv.onLoad = function():Void{
trace(this.sent);
if(this.sent == "OK"){
message0_txt.text = "Thank you for your Request, I will be intouch with you shortly";
}else{
message0_txt.text = this.sent;
}
}
submit_btn.onRelease = function() {
//this clears the error text field if they have been populate previously
clearTextFields();
errorMessages.length = 0; //empty the array so next time the submit button is clicked the array is not already populated
formValidated = checkForm();
if (formValidated) {
//the form is valid and so now we can send details to our PHP file
//populate LoadVars object with the field values
sendData_lv.name = name_txt.text;
sendData_lv.email = email_txt.text;
sendData_lv.phone = phone_txt.text;
sendData_lv.request = request_txt.text;
//trace(sendData_lv.email);
//trace("valid");
sendData_lv.sendAndLoad("email1.php"+new Date().getTime(), receiveData_lv);
} else {
//populate textfields with the error messages
for (var i = 0; i<errorMessages.length; i++) {
_root["message"+i+"_txt"].text = errorMessages[i];
trace(errorMessages[i]);
}
}
};
function checkForm():Boolean {
//check whether the name field is empty
if (name_txt.text == "") {
errorMessages.push("Please enter your name.");
}
if (email_txt.text == "") {
errorMessages.push("Please enter your email address.");
} else if (email_txt.text.indexOf("@") == -1 || email_txt.text.indexOf(".") == -1) {
errorMessages.push("Please enter a valid email address.");
}
if (request_txt.text == "") {
errorMessages.push("Please enter Request information");
}
//if at this point the array is empty i.e has length 0, then this in effect means the form has passed all checks
if (errorMessages.length == 0) {
return true;
} else {
return false;
}
}
function clearTextFields():Void {
for (var i = 0; i<errorMessages.length; i++) {
_root["message"+i+"_txt"].text = "";
;
}
}
PHP Code:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$request = $_POST['request'];
$subject = 'Request from your website';
$headers = "From: $name <$email>\n";
$headers .= "Reply-To: $name <$email>\n";
//ENTER YOUR EMAIL ADDRESS HERE
$to = 'wsmith@parkagencywest.com';
//---------------------------
$success = mail($to, $subject, $request, $headers);
if($success){
echo '&sent=OK';
}else{
echo '&sent=Error';
}
?>
-
Not sure what you mean by 'match up?' It looks fairly good but you're going to have to debug it yourself.
Also, your PHP script is just waiting to be exploited by the botnet. You should validate your inputs to make sure that people aren't injecting mail headers. You might consider using PHPMailer().
-
Originally Posted by sneakyimp
Not sure what you mean by 'match up?' It looks fairly good but you're going to have to debug it yourself.
Also, your PHP script is just waiting to be exploited by the botnet. You should validate your inputs to make sure that people aren't injecting mail headers. You might consider using PHPMailer().
at this point im so pissed off about this not working i dont really care about the exploits more than having this actually work. it should be as simple as uploading the php file and having it work automatically. as of now when i click the submit button in my site it does nothing... working is number 1 for me and 2nd can be security. im trying to explain this as direct as possible so somebody can go "oh yea you need to do....."
-
FK'n_dog
try adding the "POST" method to the LoadVars.sendAndLoad.
and add ? to the url to append the timestamp for online cache avoidance.
using the timestamp requires the files to be tested on your server.
(imo.. there is no need for a timestamp variable here)
sendData_lv.sendAndLoad("email1.php?"+new Date().getTime(), receiveData_lv, "POST");
without timestamp -
sendData_lv.sendAndLoad("email1.php", receiveData_lv, "POST");
Last edited by a_modified_dog; 01-24-2008 at 06:58 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|