Variables not populating from PHP Script to mail message [duplicate]

The script does run, and I get the email. None of the information in the variables appears in the message, though. I get the plain text (“Query from” in the subject and “From” in the body). I have pasted the PHP script and the HTML form below. I would love to use PHPMail, but I don’t know if it is in the hosting environment I use, and I cannot install it myself. Until I can find out, I am using the native mail() function. Thanks in advance.

PHP Code 
<?php $to = "[email protected]"; 
$subject = "Query from" . htmlspecialchars($_POST['customer']); 
$msgBody = htmlspecialchars($_POST['msgBody']) . " From: "; 
$from = htmlspecialchars($_POST['subAdd']); $message = $from . " " . $msgBody;

if (mail($to, $subject, $message)){
    header("Location: https://bkjdesignspa.com");
}
else{
     echo "<script>window.alert('There was a problem sending the message.')</script>";
}

?>

HTML form

<form id="contactInfo" method="post" action="contactForm.php">                 
    <label>Name</label><br>                 
    <input type="text" placeholder="Name" required><br>                 
    <label>Email</label><br>                 
    <input type="email" id="subAdd" placeholder="Email Address" required><br>                 
    <label>Details</label><br>                 
    <textarea id="msgBody" placeholder="Details of request" style="width: 10em; height: 5em;" required></textarea><br>                                <input type="submit" value="Submit">             
</form><br>

Get previous and next data from glob based on timestamp

I have the following code to sort the items based on a timestamp.

$arr = [];
foreach(glob('*.json') AS $item) {
    $data = json_decode(file_get_contents($item), true);
    $arr[] = [
        'taken' => $data['taken'],
        'file-name' => $data['file-name'],
        'account' => (empty($data['account']) ? null : $data['account'])
    ];
}

usort($arr, function($x, $y) { return $x['taken'] - $y['taken']; });

Here is the content of 4 of these JSON files I have in my folder:

{"hash":"1b668ef9398fe5fc9f68a3ad87d04a77","account":null,"file-name":"DSC00045","place":null,"taken":1663759434,"uploaded":1759397192},{"hash":"bccfb4221adc1e00b4fa34eef309d025","account":null,"file-name":"DSC00170","place":null,"taken":1663760473,"uploaded":1759397201},{"hash":"5aa05170b8e6c21b947db1a20b5a93ac","account":null,"file-name":"DSC00230","place":null,"taken":1663773888,"uploaded":1759397227},{"hash":"8de553beeda575d16377e62e77183507","account":null,"file-name":"DSC00318","place":null,"taken":1547596822,"uploaded":1759397265}

I want to get the previous and next item based on taken (which is the timestamp).

Currently I have made a mess and used the following to get the current item:

foreach($arr_test AS $test) {
    if($test['file-name'] == $get_image) {
        $current = $test;
    }
}

var_dump($current);

$get_item is the variable for (isset($_GET['img']) ? safetag($_GET['img']) : null) which contains the file name.

But now I am stuck. I have no clue what so ever how to get the previous and next item based on the timestamp.

My goal is to sort all items from the first foreach based on taken, and then get current, previous, and next file name based on when the photos were taken no matter how they are sorted in the folder. It’s for a photo gallery.

Scraping booking.com with PHP Curl

I’m trying to setup a simple php script (below) to check when a certain property becomes available on booking.com.
The site seems to work with some pretty simple query parameters – you can just go directly to eg https://www.booking.com/searchresults.en-gb.html?ss=New+York&checkin=2026-03-01&checkout=2026-03-05&group_adults=2 and it will process the search correctly, no need to be logged in, or click through from the previous search page etc.
But the following script just returns empty search results, with no search parameters filled in:

<?php
   
$ch = curl_init();
$timeout = 180;       
$url="https://www.booking.com/searchresults.en-gb.html?ss=New+York&checkin=2026-03-01&checkout=2026-03-05&group_adults=2";
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION , 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);   
$output = curl_exec($ch);
curl_close($ch);  
echo $output;
 
?>

Not sure if it’s down to booking.com implementing some kind of anti-bot protection behind the scenes which is actively blocking it, or if there’s just some simple thing I’m missing?

How to integrate v3 invisible recaptcha to Magento 2.4.6 search

I have integrated recaptcha in search form but the issue is when user directly hit the search url like catalogsearch/result/?q=ring, there also i have integrate recaptcha. Please suggest some method. I have integrated it but when i search for the first time, it refreshes and redirect to homepage. Rest in second time it is working
Code of my form.mini.phtml

    <?php
$helper = $this->helper('MagentoSearchHelperData');
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$scopeConfig   = $objectManager->get(MagentoFrameworkAppConfigScopeConfigInterface::class);
$siteKey       = $scopeConfig->getValue(
    'recaptcha_frontend/type_recaptcha_v3/public_key',
    MagentoStoreModelScopeInterface::SCOPE_STORE
);
?>

<i id="searchIcon" class="search-icon icon-search "></i>
<div id="screen" class="search-screen">
  <div class="container">

    <form class="form minisearch" id="search_mini_form2" action="<?php echo $helper->getResultUrl() ?>" method="get">
      <div class="field search">
        <div class="search-input">
          <input id="search2"
                 data-mage-init='{"quickSearch":{
                      "formSelector":"#search_mini_form2",
                      "url":"<?php echo $block->getUrl('search/ajax/suggest'); ?>",
                      "destinationSelector":"#search_autocomplete"}
                 }'
                 type="text"
                 name="<?php echo $helper->getQueryParamName() ?>"
                 value="<?php echo $helper->getEscapedQueryText() ?>"
                 placeholder="<?php echo __('Search'); ?>"
                 class="search-box input-text"
                 aria-labelledby="search_autocomplete"
                 maxlength="<?php echo $helper->getMaxQueryLength();?>"
                 role="combobox"
                 aria-haspopup="false"
                 aria-autocomplete="both"
                 autocomplete="off"/>
          <div id="search_autocomplete" class="search-autocomplete"></div>
        </div>

        <!-- hidden field for v3 token -->
        <input type="hidden" name="g-recaptcha-response" id="recaptchaResponseSearch" />

        <div class="search-button">
          <button type="submit"
                  class="action search"
                  value="submit"
                  style="display: none;">
              <span><p style="display: none;">Search</p></span>
          </button>
        </div>
      </div>   
    </form>

    <!-- reCAPTCHA v3 API -->
    <script src="https://www.google.com/recaptcha/api.js?render=<?php echo $siteKey ?>"></script>
    <script>
    require(['jquery'], function($) {
        $(document).ready(function() {
            var $form = $('#search_mini_form2');
            var $input = $('#recaptchaResponseSearch');

            if (!$form.length || !$input.length) return;

            // Hook into quickSearch before AJAX request
            $form.on('submit', function(e) {
                e.preventDefault();

                // Generate reCAPTCHA token
                grecaptcha.ready(function() {
                    grecaptcha.execute('<?php echo $siteKey ?>', {action: 'search'}).then(function(token) {
                        $input.val(token);

                        // Now manually trigger quickSearch AJAX
                        if ($form.data('mage-init')) {
                            $form.trigger('search'); // triggers quickSearch submit
                        } else {
                            // fallback to normal submit
                            $form.off('submit'); // prevent loop
                            $form.submit();
                        }
                    });
                });
            });
        });
    });
    </script>

    <span class="close-icon"><i id="closeIcon" class="icon-close"></i></span>
  </div>
</div>

//Code of plugin  is 
namespace CustomSearchCaptchaPlugin;

use MagentoFrameworkAppActionAction;
use MagentoFrameworkAppRequestInterface;
use MagentoFrameworkAppObjectManager;
use MagentoFrameworkControllerResultFactory;
use MagentoStoreModelScopeInterface;

class SearchDispatchPlugin
{
    public function aroundDispatch(Action $subject, Closure $proceed, RequestInterface $request)
    {
        $module     = $request->getModuleName();
        $controller = $request->getControllerName();
        $action     = $request->getActionName();

        // Only for catalogsearch/result/index
        if ($module === 'catalogsearch' && $controller === 'result' && $action === 'index') {
            $token = $request->getParam('g-recaptcha-response');

            // Load dependencies only when needed
            $objectManager  = ObjectManager::getInstance();
            $scopeConfig    = $objectManager->get(MagentoFrameworkAppConfigScopeConfigInterface::class);
            $messageManager = $objectManager->get(MagentoFrameworkMessageManagerInterface::class);
            $resultFactory  = $objectManager->get(ResultFactory::class);

            if (!$token) {
                $siteKey = $scopeConfig->getValue(
                    'recaptcha_frontend/type_recaptcha_v3/public_key',
                    ScopeInterface::SCOPE_STORE
                );

                echo '<html><head><script src="https://www.google.com/recaptcha/api.js?render=' . $siteKey . '"></script>
                <script>
                grecaptcha.ready(function() {
                    grecaptcha.execute("' . $siteKey . '", {action: "search"}).then(function(token) {
                        let url = window.location.href;
                        if(url.indexOf("g-recaptcha-response") === -1) {
                            if(url.indexOf("?") > -1) {
                                url += "&g-recaptcha-response=" + token;
                            } else {
                                url += "?g-recaptcha-response=" + token;
                            }
                            window.location.href = url;
                        }
                    });
                });
                </script></head><body>Please wait... validating search...</body></html>';
                exit;
            }

            // If token exists, verify
            if (!$this->verifyRecaptcha($token, $scopeConfig)) {
                $messageManager->addErrorMessage(__('CAPTCHA verification failed. Please try again.'));
                $resultRedirect = $resultFactory->create(ResultFactory::TYPE_REDIRECT);
                $resultRedirect->setPath('/');
                return $resultRedirect;
            }
        }

        return $proceed($request);
    }

    protected function verifyRecaptcha($token, $scopeConfig)
    {
        $secret = $scopeConfig->getValue(
            'recaptcha_frontend/type_recaptcha_v3/private_key',
            MagentoStoreModelScopeInterface::SCOPE_STORE
        );

        $verifyUrl = 'https://www.google.com/recaptcha/api/siteverify';
        $response  = file_get_contents($verifyUrl . '?secret=' . $secret . '&response=' . $token);
        $result    = json_decode($response, true);

        return isset($result['success'], $result['score'], $result['action']) &&
               $result['success'] === true &&
               $result['score'] >= 0.5 &&
               $result['action'] === 'search';
    }
}

“Docker Compose Laravel setup: Nginx shows 404, phpMyAdmin cannot connect to db”

Laravel + Docker Compose on macOS: Nginx (web, ports 8081:80, volumes ./src:/var/www/html, default.conf root /var/www/html/public, fastcgi_pass app:9000) returns 404 on http://localhost:8081, while phpMyAdmin (8080:80) cannot reach MySQL 8 service db (3307:3306) even with PMA_HOST=db (getaddrinfo / mysqli_real_connect errors). How can I diagnose the network/volume/config issue and fix both 404 and DB login?

phpMyAdmin cannot connect to MySQL in a Docker Compose Laravel stack: all containers (app, web, db, phpmyadmin) are Up; Laravel connects using DB_HOST=db; MySQL is exposed as 3307:3306; phpMyAdmin has PMA_HOST=db; yet login fails with getaddrinfo ENOTFOUND db / php_network_getaddresses. Why does service name resolution or port mapping fail, and what exact configuration is required for phpMyAdmin → MySQL 8 in this setup?

Stuck with Nginx 404 and phpMyAdmin DB connection error in Laravel + Docker Compose: route:list shows / and /author/add, Nginx config sets root /var/www/html/public and try_files … /index.php, but visiting http://localhost:8081 or /author/add returns 404; phpMyAdmin at http://localhost:8080 cannot connect to db (MySQL 8). Compose uses ./src:/var/www/html and 8081:80 / 3307:3306. What am I missing?

Docker Compose Laravel environment on macOS: Nginx (8081:80) serves 404 despite correct default.conf (root /var/www/html/public, try_files, fastcgi_pass app:9000), and phpMyAdmin (8080:80) cannot log in to MySQL service db (3307:3306) with PMA_HOST=db set—DNS resolves intermittently, mysqli_real_connect fails. What are the definitive steps to verify container networking, volumes, and phpMyAdmin/MySQL 8 auth so both issues are resolved?

PHP critical condition – jtl_paypal_commerce, JTL Shop [closed]

I have an online store based on JTL Shop where this error keeps being sent all the time:

“Info: CRITICAL: PHP critical condition found!
Possbile plugin name: jtl_paypal_commerce
2025-10-01 09:20:22.223860 [NOTICE] [986761] [T0] [80.187.122.9:22877-H3:89E3F183CCE72FEF-12#APVH www.domain.de:443] [STDERR] PHP Fatal error: Uncaught TypeError: JTLLanguageLanguageHelper::mappedGetCountryCodeByCountryName(): Argument #1 ($iso) must be of type string, null given, called in /home/bndifoms/domains/domain/public_html/includes/src/Language/LanguageHelper.php on line 180 and defined in /home/bndifoms/domains/domain/public_html/includes/src/Language/LanguageHelper.php:1105”

Has anyone ever had a similar case before? Or perhaps does anyone know a solution / could help?

Thank you in advance.

How can I get the page number within a group of pages – getAliasNumPage()?

A data set is displayed in table format over multiple pages. Based on grouping by a value of a column, my code splits the output into multiple pages – using $pdf->AddPage() when a new grouping by value is encountered.

The partial data set for a grouping by value can span multiple pages. I need to display on each page, the page number ‘within’ the partal data set. I tried the following methods. However, all of them provide the page number of the 1st page of the partial data set regardless of how many pages the partial data set needs.

  • $pdf->getPage()
  • $pdf->PageNo()
  • $pdf->getNumPages()

The $pdf->getAliasNumPage() method returns the current page number while considering every page of the partial data set. This can be used to calculate the page number within the partial data set $pdf->getAliasNumPage() - $pdf->getSectionStartPage() However, it is an ‘alias’ that do not have a value until the PDF file is generated. I think it is calculated during the execution of the writeHTML() method.

Is there anyway to print the page number and reset it at the start of each section (grouping by value)?

An example follows.

Group by value: AAA
    page: 1
        row-1
        row-2
    end of page and end of section (group by value)

Group by value: BBB
    page: 1
        row-1
        row-2
        ...
        row-14
    end of page

    page: 2         <<-- I have a problem printing this page number
        row-15
        row-16
    end of page and end of section (group by value)

Group by value: CCC
    page: 1
        row-17
        row-18
    end of page and end of section (group by value)

My code:

foreach ($report_data as $index => $data_row) :
    if ($newGroupStarts) : 
        // 1. END PREVIOUS SECTION 
        if ($prevFinID !== null) {
            echo "</tbody></table>";
            $html = ob_get_clean();
            $pdf->writeHTML($html, true, false, true, false, '');
        }
        // 2. START NEW SECTION
        $pdf->AddPage();
        ob_start();
    ?>
        <!-- table header -->
        <table cellpadding="3"> 
            <thead> 
                <tr>
                    <td>Page: <?= $pageNumber // I need help populating this page number to reflect the page number within the section ?></td>
                </tr>
                <tr>
                    <th></th>
                    <th></th>
                    <th></th>
                </tr>
            </thead>
        <tbody>
    <?php endif; ?>

    <!-- DATA ROW -->
    <tr>
        <td></td>
        <td></td>
        <td></td>
    </tr>

<?php // more code ..... ?> 
<?php endforeach; ?>
<?php // more code ..... ?> 

html part of message is ignored when sending an e-mail with attachment using mail() in cron job

I’am sending an e-mail via cron job. The attachment works and is added to the e-mail message. However the html part that is referenced with $body2 does not come through.
The code looks like follows:

$body2 = '<!DOCTYPE html><html>...</html>';
$email = '[email protected]';
$attachment = '/path/to/file/file.txt';
$content = file_get_contents($attachment);

$prefix     = "part_"; // This is an optional prefix
$boundary   = uniqid($prefix, true);

// headers
$headers    = implode("rn", [
'From: [email protected]',
'Reply-To: [email protected]',
'X-Mailer: PHP/' . PHP_VERSION,
'MIME-Version: 1.0',
// boundary parameter required, must be enclosed by quotes
'Content-Type: multipart/mixed; boundary="' . $boundary . '"',
'Content-Transfer-Encoding: BINARY',
'This is a MIME encoded message.' // message for restricted transports
 ]);

// message and attachment
$message    = implode("rn", [ 
"--" . $boundary, // header boundary delimiter line
//'MIME-Version: 1.0',
'Content-Type: text/html; charset="utf8"',
'Content-Transfer-Encoding: 8bit',
//$body2 holds the html part of the e-mail
$body2,
'--' . $boundary, // content boundary delimiter line
'Content-Type: application/octet-stream; name="file.txt"',
'Content-Transfer-Encoding: BINARY',
'Content-Disposition: attachment',
$content,
"--" . $boundary . "--" // closing boundary delimiter line
]);

mail($email, $subject, $message, $headers); // send the email

I’ve spent hours with configuring this. I also tried plain text, with the same result. The text as well as the html won’ t show up in the e-mail message. How do i have to set this up, that the html and the attachment come through? Thanks for any hint.

Revolution slider: infinity loop doesn’t apply for mobile [closed]

For some reason mobile version of revolution slider doesn’t allow infinite scroll/swipe when layout type is set to Slider, not Carousel. Carousel solves problem but then it acts as literally carousel, not animated swipes.

Please take a look: https://willajacuzzi.pl/web/apartamenty

Touch:
Mobile Swipe Enabled
Bock Scroll On
Swipe Dir Vertical
Velocity 75

Mouse:
Wheel Listener: Infinity <- this works perfectly on computers

Typed property AppEntityX:X must not be accessed before initialization

I’m trying to upgrade my Symfony from 5.4 to 6.4 and PHP from 7.4 to 8.4. I almost did all changes but I’m currently blocked on this exception :

Typed property AppEntityAppRole::$uniqid must not be accessed before initialization

I already did my researchs and found that private properties must be initialized, so this is what I did :

#[ORMColumn(name: "uniqid", type: "string", length: 50, nullable: false)]
private ?string $uniqid = null;
public function getUniqid(): ?string
{
    return $this->uniqid;
}

public function setUniqid(string $uniqid): self
{
    $this->uniqid = $uniqid;

    return $this;
}

So I don’t understand where comes my error ?

The error trace shows that it comes from the findAll() repository function.

Did I missed something ?

I also cleared the cache but does nothing.

Thanks

API failed to open stream: connection refused [closed]

After installing web application, I added the api key to the built in setting in the admin dashboard. The api was calling and getting data, the next day I get an error code saying “failed to open stream: connection refused? cleared cache and dug into the files and nothing seems to be wrong on the app. Its using File_get_contents

So if it was working yesterday, but not today? I am guessing the server or something or something is blocking it. Unless I was sleepwalking and accidently changed a code while in my sleep?

anyone got any ideas?

Does Xero not provide an API or built-in function to fetch daily data? [closed]

We have a custom system, and we are trying to integrate Xero’s daily sales data into this system. But we are unable to do that.
I would like to confirm whether Xero provides any API or built-in functionality that allows us to fetch daily data (such as daily sales, transactions, or other relevant reports). From my current exploration, I could not find such an option, but I wanted to double-check with your team in case I may have overlooked it.

If this feature is not available, could you kindly suggest an alternative approach or workaround to achieve daily data extraction from Xero?

Netsuite PHP find Sales Order using custom field

Kind of embarrassed to post this here, but I’m at my wits end. I am trying to pull up a Sales Order in Netsuite, searching on a custom filed and using the PHP ToolKit, but have hit a brick wall. I’ve searched records on custom fields before and haven’t had an issue, but this time I’m getting no results. This custom field is a place where we store an outside order number (like if the order came from Amazon or eBay) and I can pull up the record inside of Netsuite (using the GUI) with this custom field. Currently my code looks like this:

$ts = new TransactionSearch();
$tsb = new TransactionSearchBasic();
$oth = new SearchStringCustomField();
$oth->internalId = 69;
$oth->searchValue = '700184356';
$oth->operator = 'is';
$cfl = new SearchCustomFieldList();
$cfl->customField = array($oth);
$tsb->customFieldList = $cfl;
$ts->basic = $tsb;
$request = new SearchRequest();
$request->searchRecord = $ts;
$response = $ns->search($request);

I’ve double and triple checked the id of the custom field and also tried using its name instead of id ($oth->scriptId = 'custbody_custbody_storefront_order'). I get no errors, but also no records are returned. I’m hoping an extra set of eyes can spot what I’m doing wrong.

Custom field name

Filament v4 migration – Livewire SupportValidation error and login redirect not working

I am migrating a project and found an issue I can’t resolve.
Here are the details:

Versions after migration
Filament: v4.0 (from v3.2.117)
PHP: 8.3 (from 8.2)
Laravel: 12.26.3 (from 11.44.0)
Livewire: 3.6.4 (from 3.5.6)

Problem
When loading the login route, I get the following error:

local.ERROR: IlluminateSupportViewErrorBag::put(): 
Argument #2 ($bag) must be of type IlluminateContractsSupportMessageBag, null given, 
called in /vendor/livewire/livewire/src/Features/SupportValidation/SupportValidation.php on line 21

Trace points to SupportValidation->render() and ViewErrorBag->put() receiving null instead of a MessageBag.

Temporary workaround
To bypass this, I temporarily patched SupportValidation and SupportTesting in the vendor/ folder so that a new MessageBag instance is created when getErrorBag() is null. Example (simplified):

if (! $bag instanceof MessageBag) {
    $bag = new MessageBag((array) $bag);
    if (method_exists($this->component, 'setErrorBag')) {
        $this->component->setErrorBag($bag);
    }
}

**With this hack:

The login page renders correctly.

Authentication works (confirmed via browser dev tools and Laravel logs).

But the redirect after login does not happen** — the user stays on the login page even though authentication is successful.

What I tried:

  • Verified that the user is authenticated (Auth::check() returns true).

  • Logs confirm login success (tail -f storage/logs/laravel.log).

  • Without patching the vendor files, the login page never renders (due to the null MessageBag error).

  • With patching, page renders but redirect is broken.

Questions

1 – Is this a known issue with Filament v4 + Livewire 3.6.x during login?

2 – Should I be initializing the MessageBag in a different way rather than patching vendor code?

3 – Why would the redirect fail even though authentication succeeds?

Unfortunately, my project is private, but I can try to create a minimal reproduction repo if needed.

Any help or guidance would be appreciated.