lostyazilim

PHP Iletişim Formu Türkçe Karakter Sorunu

5 Mesajlar 4.089 Okunma
lstbozum
smsonayhizmeti

Crack Crack WM Aracı Kullanıcı
  • Üyelik 19.07.2011
  • Yaş/Cinsiyet - / E
  • Meslek
  • Konum
  • Ad Soyad ** **
  • Mesajlar 33
  • Beğeniler 2 / 0
  • Ticaret 0, (%0)
Merhabalar,
Maili aldığımda türkçe karakter sorunu yaşıyorum charset girmeyi denedim fakat olmadı buyurun kodlar;


if($_POST){




$adsoyad=$_POST["adsoyad"];

$eposta=$_POST["eposta"];

$mesaj=$_POST["mesaj"];

$konu=$_POST["konu"];

$kime="azatgoktas@hotmail.com";

$sablon="Gönderen:".$adsoyad."
".

"Gönderen eposta:".$eposta."
".

"Konu:".$konu.

"Mesaj:".$mesaj;


$gonder=mail($kime,$konu,$sablon);


if($gonder){

echo"Mesajınız başarıyla iletildi.";

}else{

echo"Mesajınız iletilemedi.";}

}else{

echo '






































Ad Soyad:
E-posta:
Konu:
Mesajınız:


';




}



?>
 

 

wmaraci
reklam

sonbaron sonbaron WM Aracı Kullanıcı
  • Üyelik 23.10.2012
  • Yaş/Cinsiyet 28 / E
  • Meslek Öğrenci
  • Konum Muğla
  • Ad Soyad ** **
  • Mesajlar 48
  • Beğeniler 1 / 8
  • Ticaret 0, (%0)
Örnek :

$adsoyad = iconv("UTF-8","ISO-8859-9",$_POST["adsoyad"]);

Şeklinde bozuk olanları düzenleyin. UTF-8 ile ISO-8859-9 un yeri tam tersi olabilir tam emin değilim olmazsa yerlerini değiştirin.

Edit : Sayfanızın karakter kodlamasından kaynaklanıyor olabilir. Notepad++ kullanıyorsanız üst menüdeki kodlama sekmesinden sayfanın kodlamasını ayarlayabilirsiniz ANSI , UTF-8 gibi. UTF-8 (Bomsuz) olarak değiştir dedikten sonra charseti UTF-8 olarak ayarlarsanızda düzelecektir.
alabacaknet

kişi bu mesajı beğendi.

irisnet irisnet ilyasokay.com Kullanıcı
  • Üyelik 04.08.2014
  • Yaş/Cinsiyet 36 / E
  • Meslek Araştırmacı ve Yazar
  • Konum Ankara
  • Ad Soyad İ** O**
  • Mesajlar 27
  • Beğeniler 1 / 2
  • Ticaret 0, (%0)
Şunu dene bakalım,


if($_POST){




$adsoyad=$_POST["adsoyad"];

$eposta=$_POST["eposta"];

$mesaj=$_POST["mesaj"];

$konu=$_POST["konu"];

$kime="azatgoktas@hotmail.com";

$sablon="Gönderen:".$adsoyad."
".

"Gönderen eposta:".$eposta."
".

"Konu:".$konu.

"Mesaj:".$mesaj;

$basliklar = 'Content-type: text/html; charset=utf-8';



$gonder=mail($kime,$konu,$sablon,$basliklar);


if($gonder){

echo"Mesajınız başarıyla iletildi.";

}else{

echo"Mesajınız iletilemedi.";}

}else{

echo '






































Ad Soyad:
E-posta:
Konu:
Mesajınız:


';




}



?>
alabacaknet

kişi bu mesajı beğendi.

Crack Crack WM Aracı Kullanıcı
  • Üyelik 19.07.2011
  • Yaş/Cinsiyet - / E
  • Meslek
  • Konum
  • Ad Soyad ** **
  • Mesajlar 33
  • Beğeniler 2 / 0
  • Ticaret 0, (%0)

irisnet adlı üyeden alıntı

Şunu dene bakalım,


if($_POST){




$adsoyad=$_POST["adsoyad"];

$eposta=$_POST["eposta"];

$mesaj=$_POST["mesaj"];

$konu=$_POST["konu"];

$kime="azatgoktas@hotmail.com";

$sablon="Gönderen:".$adsoyad."
".

"Gönderen eposta:".$eposta."
".

"Konu:".$konu.

"Mesaj:".$mesaj;

$basliklar = 'Content-type: text/html; charset=utf-8';



$gonder=mail($kime,$konu,$sablon,$basliklar);


if($gonder){

echo"Mesajınız başarıyla iletildi.";

}else{

echo"Mesajınız iletilemedi.";}

}else{

echo '






































Ad Soyad:
E-posta:
Konu:
Mesajınız:


';




}



?>


Böyle oldu çok teşekkürler
 

 

wmaraci
wmaraci

meselar meselar WM Aracı Kullanıcı
  • Üyelik 01.12.2015
  • Yaş/Cinsiyet 46 / E
  • Meslek serbest
  • Konum İstanbul Anadolu
  • Ad Soyad M** A**
  • Mesajlar 2
  • Beğeniler 0 / 0
  • Ticaret 0, (%0)
Bende ilgili yerleri utf-8 şeklinde düzenledim ama olmuyor.

/*
If you see this text in your browser, PHP is not configured correctly on this hosting provider.
Contact your hosting provider regarding PHP configuration for your site.

PHP file generated by Adobe Muse CC 2015.0.0.309
*/

require_once('form_throttle.php');

function process_form($form) {
if ($_SERVER['REQUEST_METHOD'] != 'POST')
die(get_form_error_response($form['resources']['unknown_method']));

if (formthrottle_too_many_submissions($_SERVER['REMOTE_ADDR']))
die(get_form_error_response($form['resources']['too_many_submissions']));

// will die() if there are any errors
check_required_fields($form);

// will die() if there is a send email problem
email_form_submission($form);
}

function get_form_error_response($error) {
return get_form_response(false, array('error' => $error));
}

function get_form_response($success, $data) {
if (!is_array($data))
die('data must be array');

$status = array();
$status[$success ? 'FormResponse' : 'MusePHPFormResponse'] = array_merge(array('success' => $success), $data);

return json_serialize($status);
}

function check_required_fields($form) {
$errors = array();

foreach ($form['fields'] as $field => $properties) {
if (!$properties['required'])
continue;

if (!array_key_exists($field, $_REQUEST) || empty($_REQUEST[$field]))
array_push($errors, array('field' => $field, 'message' => $properties['errors']['required']));
else if (!check_field_value_format($form, $field, $properties))
array_push($errors, array('field' => $field, 'message' => $properties['errors']['format']));
}

if (!empty($errors))
die(get_form_error_response(array('fields' => $errors)));
}

function check_field_value_format($form, $field, $properties) {
$value = get_form_field_value($field, $properties, $form['resources'], false);

switch($properties['type']) {
case 'checkbox':
case 'string':
case 'captcha':
// no format to validate for those fields
return true;

case 'checkboxgroup':
if (!array_key_exists('optionItems', $properties))
die(get_form_error_response(sprintf($form['resources']['invalid_form_config'], $properties['label'])));

// If the value received is not an array, treat it as invalid format
if (!isset($value))
return false;

// Check each option to see if it is a valid value
foreach($value as $checkboxValue) {
if (!in_array($checkboxValue, $properties['optionItems']))
return false;
}

return true;

case 'radiogroup':
if (!array_key_exists('optionItems', $properties))
die(get_form_error_response(sprintf($form['resources']['invalid_form_config'], $properties['label'])));

//check list of real radio values
return in_array($value, $properties['optionItems']);

case 'recaptcha':
if (!array_key_exists('recaptcha', $form) || !array_key_exists('private_key', $form['recaptcha']) || empty($form['recaptcha']['private_key']))
die(get_form_error_response($form['resources']['invalid_reCAPTCHA_private_key']));
$resp = recaptcha_check_answer($form['recaptcha']['private_key'], $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
return $resp->is_valid;

case 'email':
return 1 == preg_match('/^[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i', $value);

case 'radio': // never validate the format of a single radio element; only the group gets validated
default:
die(get_form_error_response(sprintf($form['resources']['invalid_field_type'], $properties['type'])));
}
}

function email_form_submission($form) {
if(!defined('PHP_EOL'))
define('PHP_EOL', '\r\n');

$form_email = ((array_key_exists('Email', $_REQUEST) && !empty($_REQUEST['Email'])) ? cleanup_email($_REQUEST['Email']) : '');

$to = $form['email']['to'];
$subject = $form['subject'];
$message = get_email_body($subject, $form['heading'], $form['fields'], $form['resources']);
require'PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = '*************';
$mail->Port = 587;
//$mail->SMTPSecure = 'tls';
$mail->Username = '**********';
$mail->Password = '*********';
$mail->SetFrom($mail->Username, $adsoyad );
$mail->From = 'info@randiman.us';
$mail->FromName = 'info@randiman.us';
$mail->addAddress($to);
$mail->isHTML(true);

$mail->Subject = $subject;
$mail->Body = $message;

$sent = $mail->send();
// $sent = @mail($to, $subject, $message, $headers); // don't need this

if(!$sent)
die(get_form_error_response($form['resources']['failed_to_send_email']));

$success_data = array(
'redirect' => $form['success_redirect']
);

echo get_form_response(true, $success_data);
}

function get_email_headers($to_email, $form_email) {
$headers = 'From: ' . $to_email . PHP_EOL;
$headers .= 'Reply-To: ' . $form_email . PHP_EOL;
$headers .= 'X-Mailer: Adobe Muse CC 2015.0.0.309 with PHP' . PHP_EOL;
$headers .= 'Content-type: text/html; charset=utf-8' . PHP_EOL;

return $headers;
}

function get_email_body($subject, $heading, $fields, $resources) {
$message = '';
$message .= '';
$message .= '' . encode_for_form($subject) . '';
$message .= '';
$message .= '

' . $heading . '

';
$message .= '';

$sorted_fields = array();

foreach ($fields as $field => $properties) {
// Skip reCAPTCHA from email submission
if ('recaptcha' == $properties['type'])
continue;

array_push($sorted_fields, array('field' => $field, 'properties' => $properties));
}

// sort fields
usort($sorted_fields, 'field_comparer');

foreach ($sorted_fields as $field_wrapper)
$message .= '';

$message .= '
' . encode_for_form($field_wrapper['properties']['label']) . ':' . get_form_field_value($field_wrapper['field'], $field_wrapper['properties'], $resources, true) . '
';
$message .= '

';
$message .= '
' . sprintf($resources['submitted_from'], encode_for_form($_SERVER['SERVER_NAME'])) . '
';
$message .= '
' . sprintf($resources['submitted_by'], encode_for_form($_SERVER['REMOTE_ADDR'])) . '
';
$message .= '';

return cleanup_message($message);
}

function field_comparer($field1, $field2) {
if ($field1['properties']['order'] == $field2['properties']['order'])
return 0;

return (($field1['properties']['order'] < $field2['properties']['order']) ? -1 : 1);
}

function is_assoc_array($arr) {
if (!is_array($arr))
return false;

$keys = array_keys($arr);
foreach (array_keys($arr) as $key)
if (is_string($key)) return true;

return false;
}

function json_serialize($data) {

if (is_assoc_array($data)) {
$json = array();

foreach ($data as $key => $value)
array_push($json, '"' . $key . '": ' . json_serialize($value));

return '{' . implode(', ', $json) . '}';
}

if (is_array($data)) {
$json = array();

foreach ($data as $value)
array_push($json, json_serialize($value));

return '[' . implode(', ', $json) . ']';
}

if (is_int($data) || is_float($data))
return $data;

if (is_bool($data))
return $data ? 'true' : 'false';

return '"' . encode_for_json($data) . '"';
}

function encode_for_json($value) {
return preg_replace(array('/([\'"\\t\\\\])/i', '/\\r/i', '/\\n/i'), array('\\\\$1', '\\r', '\\n'), $value);
}

function encode_for_form($text) {
$text = stripslashes($text);
return htmlentities($text, ENT_QUOTES, 'UTF-8');// need ENT_QUOTES or webpro.js jQuery.parseJSON fails
}

function get_form_field_value($field, $properties, $resources, $forOutput) {
$value = $_REQUEST[$field];

switch($properties['type']) {
case 'checkbox':
return (($value == '1' || $value == 'true') ? $resources['checkbox_checked'] : $resources['checkbox_unchecked']);

case 'checkboxgroup':
if (!is_array($value))
return NULL;

$outputValue = array();

foreach ($value as $checkboxValue)
array_push($outputValue, $forOutput ? encode_for_form($checkboxValue) : stripslashes($checkboxValue));

if ($forOutput)
$outputValue = implode(', ', $outputValue);

return $outputValue;

case 'radiogroup':
return ($forOutput ? encode_for_form($value) : stripslashes($value));

case 'string':
case 'captcha':
case 'recaptcha':
case 'email':
return encode_for_form($value);

case 'radio': // never validate the format of a single radio element; only the group gets validated
default:
die(get_form_error_response(sprintf($resources['invalid_field_type'], $properties['type'])));
}
}

function cleanup_email($email) {
$email = encode_for_form($email);
$email = preg_replace('=((||0x0A/%0A|0x0D/%0D|\\n|\\r)\S).*=i', null, $email);
return $email;
}

function cleanup_message($message) {
$message = wordwrap($message, 70, "\r\n");
return $message;
}
?>
 

 

wmaraci
Konuyu toplam 3 kişi okuyor. (0 kullanıcı ve 3 misafir)
Site Ayarları
  • Tema Seçeneği
  • Site Sesleri
  • Bildirimler
  • Özel Mesaj Al