Forum służy wyłącznie jako archiwum. Nie można tworzyć nowych wątków i postów.
Tani hosting

[php] Problem z dojściem maila z formularza kontaktowego
johannstrauss Offline
Użytkownik

Liczba postów: 1
Reputacja: 0
Post: #1
[php] Problem z dojściem maila z formularza kontaktowego 07-01-2018 00:48
[font="Lucida Grande", "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif]Witam[/font]

[font="Lucida Grande", "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif]Mail "niby" zostaje wysłany, jednak na poczcie nic nie widzę...[/font]

Kod:
<?php


//        Who you want to recieve the emails from the form. (Hint: generally you.)
$sendto = 'kamilkowalczyk@kghn.pl';

//        The subject you'll see in your inbox
$subject = 'Contact from website';

//        Message for the user when he/she doesn't fill in the form correctly.
$errormessage = 'May we suggest:';

//        Message for the user when he/she fills in the form correctly.
$thanks = "Thanks for the email! We'll get back to you as soon as possible!";

//        Message for the bot when it fills in in at all.
$honeypot = "You filled in the honeypot! If you're human, try again!";

//        Various messages displayed when the fields are empty.
$emptyname =  'Entering your name?';
$emptyemail = 'Entering your email address?';
$emptymessage = 'Entering a message?';

//       Various messages displayed when the fields are incorrectly formatted.
$alertname =  'Entering your name using only the standard alphabet?';
$alertemail = 'Entering your email in this format: <em>name@example.com</em>?';
$alertmessage = "Making sure you aren't using any parenthesis or other escaping characters in the message? Most URLS are fine though!";

//Setting used variables.
$alert = '';
$pass = 0;

// Sanitizing the data, kind of done via error messages first. Twice is better!
function clean_var($variable) {
    $variable = strip_tags(stripslashes(trim(rtrim($variable))));
  return $variable;
}

//The first if for honeypot.
if ( empty($_REQUEST['last']) ) {

    // A bunch of if's for all the fields and the error messages.
    if ( empty($_REQUEST['name']) ) {
        $pass = 1;
        $alert .= "<li>" . $emptyname . "</li>";
    } elseif ( preg_match( "/[{}()*+?.\\^$|]/", $_REQUEST['name'] ) ) {
        $pass = 1;
        $alert .= "<li>" . $alertname . "</li>";
    }
    if ( empty($_REQUEST['email']) ) {
        $pass = 1;
        $alert .= "<li>" . $emptyemail . "</li>";
    } elseif ( !preg_match("/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/", $_REQUEST['email']) ) {
        $pass = 1;
        $alert .= "<li>" . $alertemail . "</li>";
    }
    if ( empty($_REQUEST['message']) ) {
        $pass = 1;
        $alert .= "<li>" . $emptymessage . "</li>";
    } elseif ( preg_match( "/[][{}()*+?\\^$|]/", $_REQUEST['message'] ) ) {
        $pass = 1;
        $alert .= "<li>" . $alertmessage . "</li>";
    }

    //If the user err'd, print the error messages.
    if ( $pass==1 ) {

        //This first line is for ajax/javascript, comment it or delete it if this isn't your cup o' tea.
    echo "<script>$(\".message\").show(); </script>";
    echo '<h4>' . $errormessage . '</h4>';
    echo '<ul class="small mdash no-bottom">'.$alert.'</ul>';

    // If the user didn't err and there is in fact a message, time to email it.
    } elseif (isset($_REQUEST['message'])) {
        
        //Construct the message.
       $message = "From: " . clean_var($_REQUEST['name']) . "\n";
        $message .= "Email: " . clean_var($_REQUEST['email']) . "\n";
       $message .= "Message: \n" . clean_var($_REQUEST['message']);
       $header = 'From:'. clean_var($_REQUEST['email']);
        
//Mail the message - for production
        // mail($sendto, $subject, $message, $header);
//This is for javascript, 
        echo "<script>$(\".message\").show(); $(':input').clearForm() </script>";
        echo '<h4 class="no-bottom">' . $thanks . '</h4>';

        die();

//Echo the email message - for development
        //echo "<br/><br/>" . $message;

    }
    
//If honeypot is filled, trigger the message that bot likely won't see.
} else {
    echo "<script>$(\".message\").show(); </script>";
    echo $honeypot;
}
?>
Cytuj
Diabeł Online
Użyszkodnik


Liczba postów: 777
Reputacja: 666
paulik560 Offline
Użytkownik

Liczba postów: 1
Reputacja: 0
Post: #2
RE: [php] Problem z dojściem maila z formularza kontaktowego 11-01-2018 13:42
a kto tam dochodzi

____________________
http://www.cheapestescorts.com
Cytuj


Skocz do:


Użytkownicy przeglądający ten wątek: 1 gości