Hello everyone. I have some issues with my contact form. I found it on web and with some modifications I made it work perfectly. But for some reason i stopped to receive the emails even if it says that they’ve been posted. Here is the codes:
test.html
[code]
Αγορά
Ονοματεπώνυμο:
Νομός:
Διεύθυνση:
Τηλ.Επικοινωνίας:
Email:
Παραγγελία-Σχόλια:
Εισάγεται τον κωδικό που βλέπετε.
![]()
[/code]
orders.php
[php]<?php header(“content-type: text/html;charset=utf-8”)
?>
<?php
session_start();
if(isset($_POST["submit"])&&$_POST["captcha"]!=""&&$_SESSION["code"]==$_POST["captcha"])
{
echo "Correct Code Entered";
//Do you stuff
}
else
{
die("Εισάγατε λάθος κωδικό. Προσπαθήστε ξανά.");
}
{
//This page should not be accessed directly. Need to submit the form.
echo "Σφάλμα; Πρέπει να κάνετε αποστόλη την φόρμα.";
}
$name = $_POST['name'];
$state = $_POST['state'];
$address = $_POST['address'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$comments = $_POST['comments'];
//Validate first
if(empty($name)||empty($email)||empty($telephone))
{
echo "Το ονοματεπώνυμο,το τηλέφωνο και το E-mail είναι υποχρεωτικά.";
exit;
}
if(IsInjected($email))
{
echo "Το E-mail σας δεν είναι σωστό.";
exit;
}
$email_from = '
[email protected]';//<== update the email address
$email_subject = "Νέα Παραγγελία-Σχόλιο.";
$email_body = "Έχετε λάβει καινούργιο μύνημα απο $name.\n".
"Αυτό είναι το μύνημα:\n
Ονοματεπώνυμο: $name
Νομός: $state
Διεύθυνση: $address
Τηλ.Επικοινωνίας: $telephone
Email: $email
Σχόλια: $comments
".
$to = "
[email protected]";//<== update the email address
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $email \r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
//done. redirect to thanks page.
header('Location: thanks.html');
// Function to validate against any email injection attempts
function IsInjected($str)
{
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str))
{
return true;
}
else
{
return false;
}
}[/php]
[b]captcha.php[/b]
[php]<?php
session_start();
$code=rand(1000,9999);
$_SESSION["code"]=$code;
$im = imagecreatetruecolor(50, 24);
$bg = imagecolorallocate($im, 22, 86, 165); //background color blue
$fg = imagecolorallocate($im, 255, 255, 255);//text color white
imagefill($im, 0, 0, $bg);
imagestring($im, 5, 5, 5, $code, $fg);
header("Cache-Control: no-cache, must-revalidate");
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>[/php]
Any help would be great.