Evo kod contact.php
Code:
<?
//name = yourName_txt
//phone = phone_txt
//email = email_txt
//comments = comments_txt
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'Sa: Web sajta' . "\r\n" .'Reply-To: [email protected]' . "\r\n";
$ToEmail = "[email protected]";
$ToName = "ime sajta";
$ToSubject = "Kontakt sa sajta";
$EmailBody = "<table width='716' height='207' border='1' >
<tr>
<td><font size='2' face='Arial' color='#999999'>Poslao: $yourName_txt \nSenders Email: $email_txt\n Message
Sent:\n$comments_txt</font></td>
</tr>
</table>";
$EmailFooter="\nPoruku poslao: $yourName_txt sa $REMOTE_ADDR ";
$Message = $EmailBody.$EmailFooter;
mail($ToName." <".$ToEmail.">",$ToSubject, $Message, $headers);
Print "_root.Status=success";
?>
<?
//name = yourName_txt
//phone = phone_txt
//email = email_txt
//comments = comments_txt
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'Sa: Web sajta' . "\r\n" .'Reply-To: [email protected]' . "\r\n";
$ToEmail = "[email protected]";
$ToName = "ime sajta";
$ToSubject = "Kontakt sa sajta";
$EmailBody = "<table width='716' height='207' border='1' >
<tr>
<td><font size='2' face='Arial' color='#999999'>Poslao: $yourName_txt \nSenders Email: $email_txt\n Message
Sent:\n$comments_txt</font></td>
</tr>
</table>";
$EmailFooter="\nPoruku poslao: $yourName_txt sa $REMOTE_ADDR ";
$Message = $EmailBody.$EmailFooter;
mail($ToName." <".$ToEmail.">",$ToSubject, $Message, $headers);
Print "_root.Status=success";
?>
ActionScript Cod
Code:
function init()
{
yourName_txt.tabIndex = 1;
phone_txt.tabIndex = 2;
email_txt.tabIndex = 3;
comments_txt.tabIndex = 4;
yourName_txt.text = "";
phone_txt.text = "";
email_txt.text = "";
comments_txt.text = "";
error1 = 1;
error2 = 1;
error3 = 1;
formSuccess = 1;
}
function checkForm()
{
if (yourName_txt.text == "" || yourName_txt.text == "Mora biti popunjeno!")
{
error1 = 1;
yourName_txt.text = "Mora biti popunjeno!";
}
else
{
error1 = 0;
}
if (comments_txt.text == "" || comments_txt.text == "Mora biti popunjeno!")
{
error2 = 1;
comments_txt.text = "Mora biti popunjeno!";
}
else
{
error2 = 0;
}
whereAT = email_txt.text.lastIndexOf("@");
whereDOT = email_txt.text.lastIndexOf(".");
if (whereAT >= whereDOT || whereAT <= 0 || whereDOT <= 0 || email_txt.text == "" || email_txt.text == "email" || email_txt.text == "email required")
{
error2 = 1;
email_txt.text = "Mora biti popunjeno!";
error3 = 1;
}
else
{
error3 = 0;
}
if (error1 == 0 && error2 == 0 && error3 == 0)
{
formSuccess = 0;
}
}
function giveThanks()
{
yourName_txt.text = "";
phone_txt.text = "";
email_txt.text = "";
comments_txt.text = "";
formSuccess = 1;
gotoAndStop(2);
}
function submit()
{
checkForm();
if (formSuccess == 0)
{
var _loc1 = new LoadVars();
_loc1.yourName_txt = yourName_txt.text;
_loc1.phone_txt = phone_txt.text;
_loc1.email_txt = email_txt.text;
_loc1.comments_txt = comments_txt.text;
_loc1.sendAndLoad("contact/contact.php", _loc1, "POST");
giveThanks();
}
}
stop ();
var contactXMLFile = "contact/contactinfo.xml";
var contactXML = new XML();
contactXML.ignoreWhite = true;
contactXML.onLoad = function (success)
{
if (success)
{
contactText = this.firstChild.childNodes[0].firstChild.nodeValue;
info_txt.html = true;
info_txt.styleSheet = _parent.txtCSS;
info_txt.autoSize = "LEFT";
info_txt.htmlText = contactText;
}
else
{
var _loc3 = contactXMLFile + " cannot be loaded";
trace (_loc3);
info_txt.htmlText = _loc3;
}
};
contactXML.load(contactXMLFile);
trans_btn.useHandCursor = false;
trans_btn._alpha = 0;
init();
submit_btn.onRelease = function ()
{
submit();
};
function init()
{
yourName_txt.tabIndex = 1;
phone_txt.tabIndex = 2;
email_txt.tabIndex = 3;
comments_txt.tabIndex = 4;
yourName_txt.text = "";
phone_txt.text = "";
email_txt.text = "";
comments_txt.text = "";
error1 = 1;
error2 = 1;
error3 = 1;
formSuccess = 1;
}
function checkForm()
{
if (yourName_txt.text == "" || yourName_txt.text == "Mora biti popunjeno!")
{
error1 = 1;
yourName_txt.text = "Mora biti popunjeno!";
}
else
{
error1 = 0;
}
if (comments_txt.text == "" || comments_txt.text == "Mora biti popunjeno!")
{
error2 = 1;
comments_txt.text = "Mora biti popunjeno!";
}
else
{
error2 = 0;
}
whereAT = email_txt.text.lastIndexOf("@");
whereDOT = email_txt.text.lastIndexOf(".");
if (whereAT >= whereDOT || whereAT <= 0 || whereDOT <= 0 || email_txt.text == "" || email_txt.text == "email" || email_txt.text == "email required")
{
error2 = 1;
email_txt.text = "Mora biti popunjeno!";
error3 = 1;
}
else
{
error3 = 0;
}
if (error1 == 0 && error2 == 0 && error3 == 0)
{
formSuccess = 0;
}
}
function giveThanks()
{
yourName_txt.text = "";
phone_txt.text = "";
email_txt.text = "";
comments_txt.text = "";
formSuccess = 1;
gotoAndStop(2);
}
function submit()
{
checkForm();
if (formSuccess == 0)
{
var _loc1 = new LoadVars();
_loc1.yourName_txt = yourName_txt.text;
_loc1.phone_txt = phone_txt.text;
_loc1.email_txt = email_txt.text;
_loc1.comments_txt = comments_txt.text;
_loc1.sendAndLoad("contact/contact.php", _loc1, "POST");
giveThanks();
}
}
stop ();
var contactXMLFile = "contact/contactinfo.xml";
var contactXML = new XML();
contactXML.ignoreWhite = true;
contactXML.onLoad = function (success)
{
if (success)
{
contactText = this.firstChild.childNodes[0].firstChild.nodeValue;
info_txt.html = true;
info_txt.styleSheet = _parent.txtCSS;
info_txt.autoSize = "LEFT";
info_txt.htmlText = contactText;
}
else
{
var _loc3 = contactXMLFile + " cannot be loaded";
trace (_loc3);
info_txt.htmlText = _loc3;
}
};
contactXML.load(contactXMLFile);
trans_btn.useHandCursor = false;
trans_btn._alpha = 0;
init();
submit_btn.onRelease = function ()
{
submit();
};