• Resolved SProost

    (@sproost)


    In the past the snippet sents an email with the ordered goods.

    Since 1,5 week it gives the dutch error Oeps, something went wrong.

    We use WP Mail SMTP to send the mails.

    I cannot figure out where the problem is. I have checked the PHP code on that page and no errors were found.

    We use PHP 8.0
    Wordpress is updated to the lateste version as well all the plugins.

    Please can you help

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Temyk

    (@webtemyk)

    Hello

    Turn on wordpress debugging mode and look at the error logs. Then it will be clear exactly what the problem is. But most likely it is in your snippet code. Have you recently raised the PHP version?

    Thread Starter SProost

    (@sproost)

    the site shows this when Debug is on:
    `Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 7035

    Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 2164

    Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 7035

    Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 2164

    Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 7035

    Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 2164

    Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 7035

    Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 2164

    Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 7035

    Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 2164

    Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 7035

    Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 2164

    Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 7035

    Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 2164

    Notice: spl_autoload_register(): Argument #2 ($do_throw) has been ignored, spl_autoload_register() will always throw in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-content/plugins/invisible-recaptcha/includes/MchLibAutoloader.php on line 53

    Notice: spl_autoload_register(): Argument #2 ($do_throw) has been ignored, spl_autoload_register() will always throw in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-content/plugins/invisible-recaptcha/engine/RequestHandler.php on line 84

    Notice: spl_autoload_register(): Argument #2 ($do_throw) has been ignored, spl_autoload_register() will always throw in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-content/plugins/invisible-recaptcha/engine/Controllers/ModulesController.php on line 104

    Deprecated: Automatic conversion of false to array is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-content/plugins/loginizer/init.php on line 250

    Deprecated: Automatic conversion of false to array is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-content/plugins/loginizer/init.php on line 265

    Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-content/plugins/wordpress-seo/src/conditionals/third-party/elementor-edit-conditional.php on line 22

    Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-content/plugins/wordpress-seo/src/conditionals/third-party/elementor-edit-conditional.php on line 28

    Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/Requests/Cookie/Jar.php on line 63

    Deprecated: Return type of Requests_Cookie_Jar::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/Requests/Cookie/Jar.php on line 73

    Deprecated: Return type of Requests_Cookie_Jar::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/Requests/Cookie/Jar.php on line 89

    Deprecated: Return type of Requests_Cookie_Jar::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/Requests/Cookie/Jar.php on line 102

    Deprecated: Return type of Requests_Cookie_Jar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/Requests/Cookie/Jar.php on line 111

    Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 40

    Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 51

    Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 68

    Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 82

    Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 91

    Warning: Cannot modify header information – headers already sent by (output started at /home/fdelange/domains/tango-events.nl/public_html/wp/wp-content/plugins/loginizer/init.php:250) in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/pluggable.php on line 1421

    Warning: Cannot modify header information – headers already sent by (output started at /home/fdelange/domains/tango-events.nl/public_html/wp/wp-content/plugins/loginizer/init.php:250) in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/pluggable.php on line 1424`

    The PHP version was upgraded aroudn 2 months ago.
    on the 2nd of august it was working fine. This week we get a phone call that ordering wasn’t possible anymore.

    The snippet code is:
    `// start de sessie
    session_start();

    // functie om de /, whitespaces en andere rare karakters weg te halen
    function test_input($data) {
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
    }

    // variabelen aanmaken
    $naam = $email = $bedrijf = $datumb = $datume = $anaam = $straat = $postcode = $postcode2 = $plaats = $telefoon = $opmerking = “”;
    // als er een form gepost is, dan voer je dit stuk code uit
    if ($_SERVER[“REQUEST_METHOD”] === “POST”) {

    if (isset($_POST[“offerte”])) {
    // post variabelen aanmaken
    $naam = test_input($_POST[“naam”]);
    $email = test_input($_POST[“email”]);
    $bedrijf = test_input($_POST[“bedrijf”]);
    $datumb = test_input($_POST[“datumbegin”]);
    $datume = test_input($_POST[“datumeind”]);
    $anaam = test_input($_POST[“anaam”]);
    $straat = test_input($_POST[“straat”]);
    $huisnummer = test_input($_POST[“huisnummer”]);
    $postcode = test_input($_POST[“postcode”]);
    $postcode2 = test_input($_POST[“postcode2”]);
    $plaats = test_input($_POST[“plaats”]);
    $telefoon = test_input($_POST[“telefoon”]);
    $opmerking = test_input($_POST[“opmerking”]);
    // als een van de variabelen leeg is, dan geeft hij dit bericht
    if (empty($naam) || empty($email)) {
    echo “<p><b>U moet alle velden in vullen</b></p><br>”;
    }
    else if (!isset($_POST[“prod”])) {
    echo “<p><b>U heeft geen producten in uw mand!</b></p><br>”;
    }
    else {
    // hier wordt de mail aangemaakt en verstuurd
    $headers = “MIME-Version: 1.0” . “\r\n”;
    $headers .= “Content-type:text/html;charset=UTF-8” . “\r\n”;
    $messageofferte = ‘<html>
    <body>
    <style>
    .pp {
    display: inline;
    }
    </style>
    <p>Uw verzoek voor een offerte voor de volgende producten is verzonden. U krijgt later de offerte via email</p>
    <p class=”pp”>’;
    foreach ($_POST[“prod”] as $product) {
    $input = explode(“_”, $product);
    $pnaam = $input[0];
    $paantal = $input[1];

    $messageofferte .= $pnaam .” X”. $paantal.”<br>”;
    }
    $messageofferte .= “</p>”;
    if (isset($_POST[“datumbegin”]) && isset($_POST[“datumeind”])) {
    $messageofferte .= ‘
    <p>huren voor ‘.$datumb.’ tot en met ‘.$datume.'</p>’;
    }
    $messageofferte .= ‘
    </body>
    </html>’;

    $message = ‘<html>
    <body>
    <style>
    .pp {
    display: inline;
    }
    </style>
    <p class=”pp”>’;
    foreach ($_POST[“prod”] as $product) {
    $input = explode(“_”, $product);
    $pnaam = $input[0];
    $paantal = $input[1];
    $message .='<p>OFERTEAANVRAAG</p>’;
    $message .=’ <p>Producten</p>
    ‘.$paantal .’ X ‘.$pnaam.’ <br>
    ‘;

    }
    $message .= “</p>”;
    if (isset($_POST[“datumbegin”]) && isset($_POST[“datumeind”])) {
    $message .= ‘
    <p>Huurdatums ‘.$datumb.’ tot en met ‘.$datume.'</p>’;
    }
    $message .= ‘

    <p>naam: ‘.$naam.'</p>
    <p>bedrijf: ‘.$bedrijf.'</p>
    <p>straatnaam: ‘.$straat.'</p>
    <p>huisnummer: ‘.$huisnummer.'</p>
    <p>postcode: ‘.$postcode.’ ‘.$postcode2.'</p>
    <p>woonplaats: ‘.$plaats.'</p>
    <p>email: ‘.$email.'</p>
    <p>telefoonnummer: ‘.$telefoon.'</p>
    <p>opmerking: ‘.$opmerking.'</p>
    </body>
    </html>’;

    // als de mail succesvol is verstuurd, dan geeft hij een bericht en delete hij de session
    if (mail(“[email protected]”, $naam . $anaam.” vraagt een offerte aan voor deze producten”, $message, $headers) && mail($email, “Tango events offerte verzoek”, $messageofferte, $headers)) {
    echo “Bedankt voor uw offerteaanvraag. Onze reactie kunt u op korte termijn verwachten. Voor vragen kunt u ons altijd bellen of mailen.<br><a href=https://tango-events.nl/><button>Terug naar home</button></a>”;
    unset($_SESSION[“lijst”]);
    session_destroy();
    exit();
    }
    else {
    // en anders geeft hij dit bericht
    echo “Oeps! Er is iets mis gegaan, probeer later opnieuw”;
    }
    }
    }

    // BESTEL BEGINT HIER
    if (isset($_POST[“bestel”])) {
    // post variabelen aanmaken
    $naam = test_input($_POST[“naam”]);
    $bedrijf = test_input($_POST[“bedrijf”]);
    $email = test_input($_POST[“email”]);
    $datumb = test_input($_POST[“datumbegin”]);
    $datume = test_input($_POST[“datumeind”]);
    $datumdiffb = new DateTime($datumb);
    $datumdiffe = new DateTime($datume);
    $anaam = test_input($_POST[“anaam”]);
    $straat = test_input($_POST[“straat”]);
    $huisnummer = test_input($_POST[“huisnummer”]);
    $postcode = test_input($_POST[“postcode”]);
    $postcode2 = test_input($_POST[“postcode2”]);
    $plaats = test_input($_POST[“plaats”]);
    $telefoon = test_input($_POST[“telefoon”]);
    $opmerking = test_input($_POST[“opmerking”]);
    // als een van de variabelen leeg is, dan geeft hij dit bericht
    if (empty($naam) || empty($email)) {
    echo “<p><b>U moet alle velden in vullen</b></p><br>”;
    }
    else if (!isset($_POST[“prod”])) {
    echo “<p><b>U heeft geen producten in uw mand!</b></p><br>”;
    }
    else {
    // hier wordt de mail aangemaakt en verstuurd
    $headers = “MIME-Version: 1.0” . “\r\n”;
    $headers .= “Content-type:text/html;charset=UTF-8” . “\r\n”;
    $messagebestel = ‘<html>
    <body>
    <style>
    .pp {
    display: inline;
    }
    </style>
    <p>U heeft de volgende producten besteld:</p>
    <p class=”pp”>’;
    // hier word de prijs berekent van elk product
    foreach ($_POST[“prod”] as $product) {
    $input = explode(“_”, $product);
    $pnaam = $input[0];
    $paantal = $input[1];
    $datumdiff = $datumdiffb->diff($datumdiffe);
    $prijs = $input[2] * $paantal / 100 * 121 * $datumdiff->days;
    $prijsround = round($prijs, 2);

    $messagebestel .= $pnaam .” X”. $paantal .” €”. $prijsround .”<br>”;
    }
    $messagebestel .= “</p>”;
    if (isset($_POST[“datumbegin”]) && isset($_POST[“datumeind”])) {
    $messagebestel .= ‘
    <p>huren voor ‘.$datumb.’ tot en met ‘.$datume.'</p>’;
    }
    $messagebestel .= ‘<br><p>Alle bedragen zijn inclusief BTW en exclusief verzendkosten</p>
    </body>
    </html>’;

    $message = ‘<html>
    <body>
    <style>
    .pp {
    display: inline;
    }
    </style>
    <h3>’.$naam.’ wilt deze producten:</h3>
    <p class=”pp”>’;
    foreach ($_POST[“prod”] as $product) {
    $input = explode(“_”, $product);
    $pnaam = $input[0];
    $paantal = $input[1];

    $message .= $pnaam .” X”. $paantal.”<br>”;
    }
    $message .= “</p>”;
    if (isset($_POST[“datumbegin”]) && isset($_POST[“datumeind”])) {
    $message .= ‘
    <p>huren voor ‘.$datumb.’ tot en met ‘.$datume.'</p>’;
    }
    $message .= ‘

    <p>Hier is de email van de klant: ‘.$email.'</p>

    </body>
    </html>’;

    // als de mail succesvol is verstuurd, dan geeft hij een bericht en delete hij de session
    if (mail(“[email protected]”, $naam . $anaam .” heeft deze producten besteld”, $message, $headers) && mail($email, “Tango events bevestiging bestelling”, $messagebestel, $headers)) {
    echo “Bedankt voor uw opdracht. Onze opdrachtbevestiging ontvangt u zo spoedig mogelijk. Voor vragen kunt u ons altijd bellen of mailen<br><a href=https://tango-events.nl/><button>Terug naar home</button></a>”;
    unset($_SESSION[“lijst”]);
    session_destroy();
    exit();
    }
    else {
    // en anders geeft hij dit bericht
    echo “Oeps! Er is iets mis gegaan, probeer later opnieuw”;
    }
    }
    }
    // check of er een remove variabele bestaat en zo ja, dan verwijder je het item en ga je naar a
    if (isset($_POST[“remove”])) {
    unset($_SESSION[“lijst”][$_POST[“remove”]]);
    }
    }

    // als de sessie variabele lijst bestaat, dan pakt hij alle items van de lijst en plaats ze in de form
    if (isset($_SESSION[“lijst”]) && $_SESSION[“lijst”] != array()) {
    $key = 0;
    $iets = 0;
    for ($i=array_key_first($_SESSION[“lijst”]); $key<count($_SESSION[“lijst”]); $i++) {
    b:
    global $wpdb;
    $prodid = $_SESSION[“lijst”][$i][2];
    $statement = “SELECT COUNT(*) FROM $wpdb->term_relationships WHERE object_id = ‘$prodid’ AND term_taxonomy_id = 21”;
    $sql = $wpdb->get_var($statement);
    if ($sql == 0) {
    $iets++;
    }
    if (array_key_exists($i, $_SESSION[“lijst”])){
    echo “<form class=prod method=post action=#><input class=input type=submit value=&#10005><input type=hidden name=remove value=”. $i .”>”. $_SESSION[“lijst”][$i][0] .”<p class=aantal>Aantal: “. $_SESSION[“lijst”][$i][1] .”</p></form>”;
    $key++;
    }
    else {
    $i++;
    goto b;
    }
    }
    }
    else {
    // als de variabele niet bestaat dan geeft hij dit bericht
    echo “U heeft nog geen producten in uw winkelmand.”;

    // hier is de form
    }
    ?>
    <form method=”post” action=”#”>
    <?php
    if (isset($_SESSION[“lijst”]) && $_SESSION[“lijst”] != array()) {
    $key = 0;
    for ($i=array_key_first($_SESSION[“lijst”]); $key<count($_SESSION[“lijst”]); $i++) {
    c:
    if (array_key_exists($i, $_SESSION[“lijst”])){
    echo “<input type=hidden name=prod[“. $key .”] value='”. $_SESSION[“lijst”][$i][0].”_”. $_SESSION[“lijst”][$i][1] .”_”. $_SESSION[“lijst”][$i][3] .”‘>”;
    $key++;
    }
    else {
    $i++;
    goto c;
    }
    }
    }
    ?>
    <br>
    <br>
    <label>Uw naam<input class=”input” name=”naam” type=”text” placeholder=”Vul uw naam hier in”></label><br>
    <label>achter naam<input class=”input” name=”anaam” type=”text” placeholder=”Vul uw achternaam hier in”></label><br>
    <label>bedrijfs naam<input class=”input” name=”bedrijf” type=”text” placeholder=”Vul uw bedrijfsnaam in”></label><br>
    <label>Uw email<input class=”input” name=”email” type=”email” placeholder=”Vul uw email hier in”></label><br>
    <label>straat<input class=”input” name=”straat” type=”text” placeholder=”Vul uw straat hier in”></label><br>
    <label>huisnummer<input class=”input” name=”huisnummer” type=”number” placeholder=”Vul uw huisnummer hier in”></label><br>
    <label>Postcode<input class=”input” name=”postcode” type=”number” placeholder=”postcode cijfers”></label>
    <input class=”input” name=”postcode2″ type=”text” placeholder=”postcode letters”><br>
    <label>Plaats<input class=”input” name=”plaats” type=”text” placeholder=”Vul uw plaats hier in”></label><br>
    <label>Telefoon<input class=”input” name=”telefoon” type=”number” placeholder=”Vul uw telefoon hier in”></label><br>
    <label>Opmerkingen<input class=”input” name=”opmerking” type=”text” placeholder=”Heeft u nog opmerkingen”></label><br>
    <label>Begindatum<input class=”input” name=”datumbegin” type=”date”></label><br><label>Einddatum<input class=”input” name=”datumeind” type=”date”></label><br>
    <?php

    ?>
    <input name=”offerte” class=”input” type=”submit” value=”Offerte aanvragen”><br>
    <input name=”bestel” class=”input” type=”submit” value=”Bestellen”>
    </form>`

    I hope you can help me, because I’m totally lost now.

    Kind regards Sebbie

    Plugin Support Temyk

    (@webtemyk)

    There is not a single error in the log. Only warnings. They cannot cause an error.

    Try to reproduce the problem /error on the site, and then watch the logs

    Thread Starter SProost

    (@sproost)

    This is what I see on the page:

    Warning: session_start(): Session cannot be started after headers have already been sent in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-content/plugins/insert-php/includes/shortcodes/shortcode-php.php(52) : eval()’d code on line 3
    Oeps! Er is iets mis gegaan, probeer later opnieuwU heeft nog geen producten in uw winkelmand.

    and in the left side colom:
    Notice: Functie wpdb::prepare werd verkeerd aangeroepen. Het query-argument wpdb::prepare() moet een waarde bevatten. Lees Foutopsporing in WordPress voor meer informatie. (Dit bericht is toegevoegd in versie 3.9.0.) in /home/fdelange/domains/tango-events.nl/public_html/wp/wp-includes/functions.php on line 5831

    Notice: Functie wpdb::prepare werd verkeerd aangeroepen. Het query-argument wpdb::prepare() moet een waarde bevatten. Lees Foutopsporing in WordPress voor meer informatie. (Dit bericht is toegevoegd in versie 3.9.0.) in /home/fdelange/domains/tango-events.nl/pu

    Can this be caused by an update of WooCommerce?

    Kind regards
    Sebbie Proost

    Plugin Support Temyk

    (@webtemyk)

    A warning related to Woody says that the session cannot be started, since the conclusion has already been made in the code of your snippet. In any case, the problem is not with the Woody plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Snippet not working any more’ is closed to new replies.