Alttaki kodlar ile oluşan bir form sisteminden mesaj gönderildiğinde gelen maile TR karakterler gönderilmiyor. Bu sisteme nasıl biz düzenleme yapmak lazımdır.
Ana Sayfa contact.php
<?php
// for javascript in header file
define('IN_CONTACT', true);
define('IN_DNP', true);
require_once('./includes/global.php');
// ################################################################
$mode = sanitize($_GET['mode']);
$mode = (!in_array($mode, array('general', 'domain'))) ? 'general' : $mode;
// Are we contacting about a certain domain?
if ($mode == 'domain')
{
// Valid ID?
$domainid = (is_string($_GET['d'])) ? sanitize($_GET['d']) : intval($_GET['d']);
if (!is('domain', $domainid))
{
redirect('index.php');
}
// Pull the domain and it's status.
$getdomain = get_value('contact', $domainid);
if (count($getdomain) == 0)
{
redirect('index.php');
}
$domain = $getdomain['domain'];
$status = $getdomain['status'];
unset($getdomain);
// Has the domain been sold, or is it not for sale?
if (in_array($status, array('Sold', 'Not For Sale')))
{
redirect('index.php');
}
}
$result = '';
// ################################################################
// Process the form and send the email..
require_once('./includes/recaptcha.class.php');
$recaptcha = recaptcha::getInstance();
$recaptcha_error = NULL;
if (!empty($_POST['submit']))
{
$name = sanitize($_POST['sender_name']);
$email = sanitize($_POST['sender_email']);
// If this is concerning a domain, we'll check for an offer.
if ($mode == 'domain')
{
$offer = sanitize(str_replace($config->get('currency'), '', $_POST['sender_offer']));
$offer = preg_replace('#\.[0-9]{2}$#', '', $offer);
$offer = preg_replace('#([^0-9,]+)#', '', $offer);
}
else
{
// Otherwise, we need an email subject.
$subject = sanitize($_POST['sender_subject']);
}
// Email body/message...
$message = str_replace("\r\n", "\n", $_POST['sender_message']);
$message = wordwrap(sanitize($message, false), 75);
// reCAPTCHA - Just say no, to spam. :)
$recaptcha_challenge = sanitize($_POST['recaptcha_challenge_field']);
$recaptcha_response = sanitize($_POST['recaptcha_response_field']);
/**
* Create a session value for name, email, and message.
* This way, if there's an error, a user won't lose what they've entered.
*/
$_SESSION['form'] = array(
'name' => $name,
'email' => $email,
'message' => $message
);
// Holds any errors that may happen with entered data
$errors = array();
// We need to make sure all data is there/valid...
if (empty($name) OR is('injection', $name))
{
$errors[] = 'Your name is required.';
}
if (empty($email))
{
$errors[] = 'Your email is required.';
}
if (empty($message))
{
$errors[] = 'A message is required.';
}
if (!is('email', $email) OR is('injection', $email))
{
$errors[] = 'Email is invalid.';
}
if ($mode == 'general' AND empty($subject))
{
$errors[] = 'A subject is required.';
}
if (is('spam', $message))
{
$errors[] = 'Sorry, but your message seemed a bit like spam.';
}
if (count($errors) > 0)
{
$result .= 'The following errors occurred:<br /><ul>';
foreach ($errors AS $error)
{
$result .= "<li>$error</li>\n";
}
$result .= '</ul>';
unset($errors);
}
else
{
$resp = $recaptcha->check_answer(get_ip(), $recaptcha_challenge, $recaptcha_response);
if (!$resp->is_valid)
{
$recaptcha_error = $resp->error;
$result .= 'reCAPTCHA: Incorrect. Try again.';
}
else
{
$recaptcha_error = NULL;
$params = array(
'name' => $name,
'email' => $email,
'ip' => get_ip(),
'message' => $message
);
if ($mode == 'domain')
{
$params['domain'] = $domain;
$params['offer'] = (empty($offer) ? 'n/a' : $offer);
}
else
{
$params['subject'] = $subject;
}
require_once('./includes/emailer.class.php');
$emailer = emailer::getInstance();
$emailer->set_params($config->get('contactemail'), $email, ($mode == 'domain' ? "Domain Inquiry: $domain" : "Inquiry: $subject"));
$emailer->use_template($params, ($mode == 'domain' ? 'email.tpl' : 'email_general.tpl'));
if ($emailer->send())
{
$result .= "$name your message was sent. Your E-mail is important to us. We will try to reply within 2 business days. Thank you.";
// Reset the session array
$_SESSION['form'] = array(
'name' => '',
'email' => '',
'message' => ''
);
}
else
{
$result .= 'There seems to have been a problem sending the E-mail. Please try again.';
}
}
}
}
else
{
$_SESSION['form'] = array(
'name' => '',
'email' => '',
'message' => ''
);
}
// ################################################################
// Output page
$pagetitle = ($mode == 'domain') ? "Inquiring about $domain" : 'General Inquiry';
if ($mode == 'domain')
{
include("$template/contact.php");
}
else
{
include("$template/contact_general.php");
}
?>Tema contact.php<?php include ("header.php"); ?>
<div class="wrap">
<div class="container main">
<div class="bigintro">
<span class="toptitles">Contact</span>
<?php if ($result != ''): ?>
<div id="result"><?php echo $result; ?></div>
<?php endif; ?>
<form action="./contact.php?mode=general" method="post" style="display: inline;" onsubmit="return validate_form('general');">
<table class="pretty" style="width:908px;" cellspacing="0">
<tbody>
<tr class="odd">
<td class="one"><label for="sender_name">Name:*</label></td>
<td class="two"><input type="text" name="sender_name" id="sender_name" maxlength="100" value="<?php echo $_SESSION['form']['name']; ?>" /></td>
</tr>
<tr class="even">
<td class="one"><label for="sender_email">E-mail:*</label></td>
<td class="two"><input type="text" name="sender_email" id="sender_email" maxlength="100" value="<?php echo $_SESSION['form']['email']; ?>" /></td>
</tr>
<tr class="odd">
<td class="one"><strong>Domain:</strong></td>
<td class="two"><?php echo $domain; ?></td>
</tr>
<tr class="even">
<td class="one"><label for="sender_offer">Offer:*</label></td>
<td class="two"><input type="text" name="sender_offer" id="sender_offer" maxlength="10" /> <small>(optional - only <code>0-9</code> and <code>,</code> accepted. Eg: 1,000 (<?php echo $config->get('currency'); ?>1,000))</small></td>
</tr>
<tr class="odd">
<td class="one"><label for="sender_subject">Subject:*</label></td>
<td class="two">Domain Purchase Offer - <?php echo $domain['domain']; ?></td>
</tr>
<tr class="even">
<td valign="top" class="one"><label for="sender_message">Message:*</label></td>
<td class="two"><textarea name="sender_message" id="sender_message" rows="4" cols="35"><?php echo $_SESSION['form']['message']; ?></textarea></td>
</tr>
<tr class="odd">
<td valign="top" colspan="2" class="one"><div align="center"><?php echo $recaptcha->get_html($recaptcha_error); ?></div></td>
</tr>
<tr class="even">
<td colspan="2" class="two"><div align="center"><input type="submit" name="submit" value="Submit" class="button" /></div></td>
</tr>
</tbody>
</table>
</form>
<br />
</div><!--/bigintro-->
</div><!--/main-->
</div><!--/wrap-->
<?php include ("footer.php"); ?>Tema contact_general.php<?php include ("header.php"); ?>
<div class="wrap">
<div class="container main">
<div class="bigintro">
<span class="toptitles">Contact</span>
<?php if ($result != ''): ?>
<div id="result"><?php echo $result; ?></div>
<?php endif; ?>
<form action="./contact.php?mode=general" method="post" style="display: inline;" onsubmit="return validate_form('general');">
<table cellspacing="0" class="pretty" style="width:908px;">
<tbody>
<tr>
<td class="one"><label for="sender_name">Name:*</label></td>
<td class="two"><input type="text" name="sender_name" id="sender_name" maxlength="100" value="<?php echo $_SESSION['form']['name']; ?>" /></td>
</tr>
<tr>
<td class="one"><label for="sender_email">E-mail:*</label></td>
<td class="two"><input type="text" name="sender_email" id="sender_email" maxlength="100" value="<?php echo $_SESSION['form']['email']; ?>" /></td>
</tr>
<tr>
<td class="one"><label for="sender_subject">Subject:*</label></td>
<td class="two"><input type="text" name="sender_subject" id="sender_subject" maxlength="100" value="<?php echo $_SESSION['form']['subject']; ?>" />
</td>
</tr>
<tr>
<td valign="top" class="one"><label for="sender_message">Message:*</label></td>
<td class="two"><textarea name="sender_message" id="sender_message" rows="4" cols="35"><?php echo $_SESSION['form']['message']; ?></textarea></td>
</tr>
<tr>
<td valign="top" colspan="2" class="one"><div align="center"><?php echo $recaptcha->get_html($recaptcha_error); ?></div></td>
</tr>
<tr>
<td colspan="2" class="two"><div align="center"><input type="submit" name="submit" value="Submit" class="button" /></div></td>
</tr>
</tbody>
</table>
</form>
<br />
</div><!--/bigintro-->
</div><!--/main-->
</div><!--/wrap-->
<?php include('footer.php'); ?>Tema makeoffer-form.php<?php
// for javascript in header file
define('IN_CONTACT', true);
define('IN_DNP', true);
require_once('./includes/global.php');
// ################################################################
$mode = sanitize($_GET['mode']);
$mode = (!in_array($mode, array('general', 'domain'))) ? 'general' : $mode;
// Are we contacting about a certain domain?
if ($mode == 'domain')
{
// Valid ID?
$domainid = (is_string($_GET['d'])) ? sanitize($_GET['d']) : intval($_GET['d']);
if (!is('domain', $domainid))
{
redirect('index.php');
}
// Pull the domain and it's status.
$getdomain = get_value('contact', $domainid);
if (count($getdomain) == 0)
{
redirect('index.php');
}
$domain = $getdomain['domain'];
$status = $getdomain['status'];
unset($getdomain);
// Has the domain been sold, or is it not for sale?
if (in_array($status, array('Sold', 'Not For Sale')))
{
redirect('index.php');
}
}
$result = '';
// ################################################################
// Process the form and send the email..
require_once('./includes/recaptcha.class.php');
$recaptcha = recaptcha::getInstance();
$recaptcha_error = NULL;
if (!empty($_POST['submit']))
{
$name = sanitize($_POST['sender_name']);
$email = sanitize($_POST['sender_email']);
// If this is concerning a domain, we'll check for an offer.
if ($mode == 'domain')
{
$offer = sanitize(str_replace($config->get('currency'), '', $_POST['sender_offer']));
$offer = preg_replace('#\.[0-9]{2}$#', '', $offer);
$offer = preg_replace('#([^0-9,]+)#', '', $offer);
}
else
{
// Otherwise, we need an email subject.
$subject = sanitize($_POST['sender_subject']);
}
// Email body/message...
$message = str_replace('\r\n', '\n', $_POST['sender_message']);
$message = wordwrap(sanitize($message, false), 75);
// reCAPTCHA - Just say no, to spam. :)
$recaptcha_challenge = sanitize($_POST['recaptcha_challenge_field']);
$recaptcha_response = sanitize($_POST['recaptcha_response_field']);
/**
* Create a session value for name, email, and message.
* This way, if there's an error, a user won't lose what they've entered.
*/
$_SESSION['form'] = array(
'name' => $name,
'email' => $email,
'message' => $message
);
// Holds any errors that may happen with entered data
$errors = array();
// We need to make sure all data is there/valid...
if (empty($name) OR is('injection', $name))
{
$errors[] = 'Your name is required.';
}
if (empty($email))
{
$errors[] = 'Your email is required.';
}
if (empty($message))
{
$errors[] = 'A message is required.';
}
if (!is('email', $email) OR is('injection', $email))
{
$errors[] = 'Email is invalid.';
}
if ($mode == 'general' AND empty($subject))
{
$errors[] = 'A subject is required.';
}
if (is('spam', $message))
{
$errors[] = 'Sorry, but your message seemed a bit like spam.';
}
if (count($errors) > 0)
{
$result .= 'The following errors occurred:<br /><ul>';
foreach ($errors AS $error)
{
$result .= '<li>$error</li>\n';
}
$result .= '</ul>';
unset($errors);
}
else
{
$resp = $recaptcha->check_answer(get_ip(), $recaptcha_challenge, $recaptcha_response);
if (!$resp->is_valid)
{
$recaptcha_error = $resp->error;
$result .= 'reCAPTCHA: Incorrect. Try again.';
}
else
{
$recaptcha_error = NULL;
$params = array(
'name' => $name,
'email' => $email,
'ip' => get_ip(),
'message' => $message
);
if ($mode == 'domain')
{
$params['domain'] = $domain;
$params['offer'] = (empty($offer) ? 'n/a' : $offer);
}
else
{
$params['subject'] = $subject;
}
require_once('./includes/emailer.class.php');
$emailer = emailer::getInstance();
$emailer->set_params($config->get('contactemail'), $email, ($mode == 'domain' ? 'Domain Inquiry: $domain' : 'Inquiry: $subject'));
$emailer->use_template($params, ($mode == 'domain' ? 'email.tpl' : 'email_general.tpl'));
if ($emailer->send())
{
$result .= '$name your message was sent. Your E-mail is important to us. We will try to reply within 2 business days. Thank you.';
// Reset the session array
$_SESSION['form'] = array(
'name' => '',
'email' => '',
'message' => ''
);
}
else
{
$result .= 'There seems to have been a problem sending the E-mail. Please try again.';
}
}
}
}
else
{
$_SESSION['form'] = array(
'name' => '',
'email' => '',
'message' => ''
);
}
?>email.tpl=====================================================================
This is an automated message from DNS Portfolio.
=====================================================================
A visitor to your portfolio has found a domain that interests them:
{domain}
--------------------------------------------
Name : {name}
Email: {email}
Offer: {offer}
IP : {ip}
--------------------------------------------
Message:
{message}email_general.tpl
=====================================================================
This is an automated message from DNS Portfolio.
=====================================================================
A visitor to your portfolio has sent you a general inquiry.
--------------------------------------------
Name : {name}
Email : {email}
Subject: {subject}
IP : {ip}
--------------------------------------------
Message:
{message}