Şimdi Ara

Php Iletişim Formunda Küçük Bir Düzenleme !

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir - 2 Masaüstü
5 sn
2
Cevap
0
Favori
494
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Merhaba arkadaşlar;

    Php iletişim formumda değiştirmek istediğim bir yer var ama bir türlü yapamadım.
    Sorun şu: Web sitesinden mail göndermek isteyince formu doldurmadan direk GÖNDER tuşuna basınca form kullanıcıya UYARI mesajı gösteriyor.(isminizi girin,mail adresinizi girin vb..)

    Ancak benim php formumda bu ingilizce ve ben türkçeye çevirdiğim zaman uyarı yerine NULL yazıyor.
    Bu sorunu nasıl çözebilirim...

     
    <?php
    if(!session_id()) {
    session_start();
    }
    error_reporting(0);

    if (isset($_REQUEST['action'])) {
    if ($_REQUEST['action'] == "contact_form_request") {

    $ourMail = "xxx@hotmail.com";

    $required_fields = array("name", "email", "message");
    $pre_messagebody_info = "";
    $errors = array();
    $data = array();
    parse_str($_REQUEST['values'], $data);

    //check for required and assemble message

    if (!empty($data)) {
    foreach ($data as $key => $value) {
    $name = strtolower(trim($key));
    if (in_array($name, $required_fields)) {
    if (empty($value)) {
    $errors[$name] = "Please enter your " . $name . "!";
    }
    }

    if ($name == "email") {
    if (!check_email_address($value)) {
    $errors[$name] = "You've entered invalid email address!";
    }
    }
    }
    }

    //***

    $verify = $_SESSION['verify'];
    if ($verify != md5($data['verify'])) {
    $errors["verify"] = "The verification code you've entered is wrong!";
    }

    //***
    $result = array(
    "is_errors" => 0,
    "info" => ""
    );
    if (!empty($errors)) {
    $result['is_errors'] = 1;
    $result['info'] = $errors;
    echo json_encode($result);
    exit;
    }

    $pre_messagebody_info.="<strong>Gönderen</strong>" . ": " . $data['name'] . "<br />";
    $pre_messagebody_info.="<strong>E-mail Adresi</strong>" . ": " . $data['email'] . "<br />";

    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers.= 'Content-type: text/html; charset=UTF-8859-9' . "\r\n";
    $headers.= "From: ".$data['email']."\r\n";

    $after_message = "\r\n<br />--------------------------------------------------------------------------------------------------\r\n<br /> Bu email web sitenizdeki iletişim formundan gönderilmiştir...";

    if (mail($ourMail, "Web sitenizden email aldınız...", $pre_messagebody_info .="<strong>Mesajı</strong>" . ": " . $data['message'] .$after_message, $headers)) {
    $result["info"] = "success";
    } else {
    $result["info"] = "server_fail";
    }

    echo json_encode($result);
    exit;
    }
    }

    function check_email_address($email) {
    // First, we check that there's one @ symbol,
    // and that the lengths are right.
    if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
    // Email invalid because wrong number of characters
    // in one section or wrong number of @ symbols.
    return false;
    }
    // Split it into sections to make life easier
    $email_array = explode("@", $email);
    $local_array = explode(".", $email_array[0]);
    for ($i = 0; $i < sizeof($local_array); $i++) {
    if
    (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&
    вâ€+Ğ„'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
    return false;
    }
    }
    // Check if domain is IP. If not,
    // it should be valid domain name
    if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
    $domain_array = explode(".", $email_array[1]);
    if (sizeof($domain_array) < 2) {
    return false; // Not enough parts to domain
    }
    for ($i = 0; $i < sizeof($domain_array); $i++) {
    if
    (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|
    вâ€+Ğ„([A-Za-z0-9]+))$", $domain_array[$i])) {
    return false;
    }
    }
    }
    return true;
    }
    ?>







  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.