how to convert this block of code into a php version

  <script>

// Javascript program to check if all array elements are
// same or not.

function areSame(arr)
{
    // Put all array elements in a HashSet
    let s = new Set(arr);

    // If all elements are same, size of
    // HashSet should be 1. As HashSet contains only distinct values.
    return (s.size == 1);
}
 
// Driver code
let arr=[1, 2, 3, 2];
if (areSame(arr))
        document.write("All Elements are Same");
    else
        document.write("Not all Elements are Same");

// This code is contributed by patel2127

Sort WooCommerce Products By Meta Key As Default Option

I’m trying to sort my WooCommerce Shop Page/homepage by a custom field (like_amount) in descending order. “Like_amount” contains the number of likes a product has, but some products do not have likes.

The current code I have works when I visit https://example.com/?orderby=like_amount, or select the “Sort by Likes” option I created. However, it does not work when I visit the homepage (which is also the Shop page) or any product archive/product category pages.
My suspicion is that it has something to do with the meta_key being empty for some posts.

So, any idea 1) why it isn’t working and 2) how I can ensure posts are displayed even if the meta_key is empty? Thanks in advance!

add_filter( 'woocommerce_get_catalog_ordering_args', 'ya_custom_product_sorting' );
function ya_custom_product_sorting( $args ) {
    if( isset( $_GET['orderby'] ) && 'like_amount' === $_GET['orderby'] ) {
        $args['meta_key'] = 'like_amount';
        $args['orderby'] = array( 'meta_value_num' => 'DESC' );
    }
    return $args;
}

Laravel Voyager Undefined property in Models while creating an entry

I have a model named Orders which belongsTo a Payment Method. The relationship is mentioned like this

public function payment_method() {
    return $this->belongsTo(PaymentMethod::class, 'payment_method');
}

I am using Laravel Voyager for Admin UI. I have created a relationship between the two in voyager. When I access orders, view orders, update orders, delete orders work fine. But when I create an order I get the following error

Undefined property: AppModelsOrder::$payment_method (View: /opt/bitnami/projects/project/vendor/tcg/voyager/resources/views/formfields/relationship.blade.php

I think this is because of a custom foreign key ‘payment_method’ but this is only causing problems with voyager and I don’t know why and how to resolve this. It works fine through artisan and API’s

Regex to replace USD prices in string

I have a string like this

En babyalarm kan koste alt fra $30 til $20.99, afhængigt af de funktioner, du ønsker. De fleste skærme kommer med et grundlæggende sæt funktioner, koster $3,000.

I need to replace the prices with a calculation.

I have this code, but it only gets the prices not including . and ,

$pattern = '#$(d*)#';

$string_with_price_replaced = preg_replace_callback($pattern, function($match) {
    return (string)(number_format($match[1]*6.5, 0, "", ""));
}, $string);

echo $string_with_price_replaced;

sql queries migrating to PHP7

I am now rewriting the old PHP5 scripts into PHP7, and I can’t figure out how to make the lookup of the words in the Database work. So I have two files db.php and dic_s.php

db.php
What I did here is just substituted mysql_ to mysqli_ and added a second paremeter $conn

<?php
  class db {

    function __construct()
    {
        global $dbh;
        if (!is_null($dbh)) return;
        $conn = mysqli_connect('localhost', 'user', 'password');
        mysqli_select_db($conn, 'dbname');
        mysqli_query($conn, 'SET NAMES utf8');
    }

    function select_list($query)
    {
        $q = mysqli_query($query);
        if (!$q) return null;
        $ret = array();
        while ($row = mysqli_fetch_assoc($q)) {
            array_push($ret, $row);
        }
        mysqli_free_result($q);
        return $ret;
    }
  }
?>

dic_s.php

//getting date thru $_POST
if (isset($_POST['search'])) {
// connection to database
  include('db.php');
   $db = new db();
     // filtering
       $word = trim(mysqli_real_escape_string($_POST['search']));

 // sql query
    $sql = "SELECT * FROM dictionary WHERE `word` LIKE '$word' GROUP BY `id` ORDER BY `word`";
  
     $row = $db->select_list($sql); 
      
    if(count($row)) {
        $end_result = ''; 
        foreach($row as $r) {
            
           $end_result     .= '<font color="lightblue" size="3" face="Arial">'.$r['word'] .
            '</font><i>('.$r['forms'] .')</i>';
      
           $end_result     .= '<br>Also:<i><font color="white" size="2" face="Arial"> '.$r['alterword'].'</i></font>';
           $end_result     .= '<br><ol><font color="#89F0F5" face="Arial" size="4"> '.$r['meaning'] .' </font>';
          }  echo $end_result;
} else {
        echo 'Nothing found.';
    }
}

I get these results while trying to execute the code

Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, object given in /dic_s.php on line 28

Warning: mysqli_query() expects at least 2 parameters, 1 given in /db.php on line 15

Nothing found.

For example, when I try to comply with errors and try to add the missing, it still won’t work

$q = mysqli_query($conn, $query);

Notice: Undefined variable: conn in /db.php on line 15

Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /db.php on line 15

connecting project to mysql databse

Hello I’m using PHPSTORM and trying to connect my db to the project I am using this code

    <?php

$host= "localhost";
$username= "root";
$password = "";
$db_name = "test11";

$conn = mysqli_connect($host, $username, $password, $db_name);

if (!$conn) {
  echo "Connection failed!";
}
?>

It returns

Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in C:Usersali_zPhpstormProjectsTectlyXsignup.php:8 Stack trace: #0 {main} thrown in C:Usersali_zPhpstormProjectsTectlyXsignup.php on line 8

How to create a php extension function with a return type-hint plus annotation

I’m trying to fix some php 8.1 deprecation notices in a PHP extension, which I believe involves either adding return type-hints (where possible, whilst maintaining some backwards-compatibility to php7.0), or adding a #[ReturnTypeWillChange] annotation where the complained-about types (e.g mixed) are not available in prior versions:

Deprecated: Return type of GoogleProtobufInternalMapFieldIter::rewind() should either be compatible with Iterator::rewind(): void, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0

I’ve read the relevant sections on the php internals book, and also php-src/Zend/zend_API.h to try to find a macro that will suit my purpose, but I don’t see anything about return type-hints.

/**
 * MapFieldIter::rewind()
 *
 * Implements the Iterator interface. Sets the iterator to the first element.
 */
PHP_METHOD(MapFieldIter, rewind) {
  MapFieldIter *intern = (MapFieldIter*)Z_OBJ_P(getThis());
  MapField *map_field = (MapField*)Z_OBJ_P(&intern->map_field);
  intern->position = UPB_MAP_BEGIN;
  upb_mapiter_next(map_field->map, &intern->position);
}

static zend_function_entry map_field_iter_methods[] = {
  PHP_ME(MapFieldIter, rewind,      arginfo_void, ZEND_ACC_PUBLIC)
  /* snip */
  ZEND_FE_END
};

Please figure out what the problem is in my sql command? [closed]

CREATE TABLE Track (
  track_id INTEGER NOT NULL AUTO_INCREMENT KEY,
    title VARCHAR(255),
    len INTEGER,
    rating INTEGER,
    count INTEGER,
    album_id INTEGER,
    genre_id INTEGER,
    
    INDEX USING BTREE (title),
    
    CONSTRAINT FOREIGN key(album_id) REFERENCES Album(albumb_id)
    ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT FOREIGN KEY (genre_id)REFERENCES Genre(genre_id)
    ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE = InnoDB ;

Incorrect Scaling when converting from excel to pdf using PhpSpreadsheet

I have an excel template the I am filling with PhpSpreadsheet, which works flawlessly. However, when I try to then save it as a pdf, the scaling is wrong and the content does not fit on the page. I have tried using Tcpdf, Mpdf, and Dompdf, all with similar results. Mpdf has given the closest output so far, however the scaling is still incorrect.

I have tried setting the margins (that seems to have no effect), as well as setting FitToPage, FitToWidth and FitToHeight to true.

Any ideas on what how to fix it? Ideally, I would like to use Tcpdf, as I am using it for other purposes.

Here is the code I’m using:

// XLSX
use PhpOfficePhpSpreadsheetSpreadsheet;
use PhpOfficePhpSpreadsheetWriterXlsx;

$spreadsheet = PhpOfficePhpSpreadsheetIOFactory::load(THIS_LIB_PATH_UP.'templates/1/rent2.xlsx');
$sheet = $spreadsheet->getActiveSheet();
$sheet->getPageMargins()
    ->setLeft(0)
    ->setRight(0)
    ->setTop(0)
    ->setBottom(0)
    ->setHeader(0)
        ->setFooter(0);
$sheet->getPageSetup()->setFitToWidth(1);
$sheet->getPageSetup()->setFitToHeight(1);
$sheet->getPageSetup()->setPaperSize(PhpOfficePhpSpreadsheetWorksheetPageSetup::PAPERSIZE_A4);
$sheet->getPageSetup()->setFitToPage(true);
// Date 
$sheet->setCellValue('F4', date('d-m-Y'));
// Receipt Number 
$sheet->setCellValue('F6', 'Receipt No. '.rand(0,100));
// FROM
$sheet->setCellValue('B10', 'Owner');
$sheet->setCellValue('B11', 'The');
$sheet->setCellValue('B12', 'Address');
$sheet->setCellValue('B13', 'Mobile');
$sheet->setCellValue('B14', '[email protected]');
// TO
$sheet->setCellValue('D10', 'Tenant');
$sheet->setCellValue('D11', 'Address');
$sheet->setCellValue('D12', '[email protected]');
$sheet->setCellValue('D13', 'Mobile');
// Description / Total
$sheet->setCellValue('B20', "Rent");
$sheet->setCellValue('F20', rand(0,500));
// Payment Method 
$sheet->setCellValue('C34', 'Bank Transfer');
$writer = new Xlsx($spreadsheet);
$filename = THIS_LIB_PATH_UP.'templates/1/'.date('Y-m-d_H-i-s');
$writer->save($filename.'.xlsx');

// Open the xlsx file for pdf export
$writer = PhpOfficePhpSpreadsheetIOFactory::createWriter($spreadsheet, 'Tcpdf');
$writer->save($filename.'.pdf');
echo 'Done';```

[The excel template][1]
[Excel directly exported to PDF (Expected)][2]
[TcPDF output][3]
[DomPDF Output][4]
[Mpdf Output][5]


  [1]: https://i.stack.imgur.com/YBL8z.png
  [2]: https://i.stack.imgur.com/xVl0X.png
  [3]: https://i.stack.imgur.com/6jDIi.png
  [4]: https://i.stack.imgur.com/y1bDb.png
  [5]: https://i.stack.imgur.com/jCLPq.png

Any help would be greatly appreciated, thanks!

Error Building PHP 8 Dockerfile With OPCache Enabled

Randomly when I run my docker build i get a mail error halting CI. If I rerun the CI script in Gitlab once or twice woth no changes made to config it often successfully builds. I am at a loss as to why this is an intermittent issue and how to prevent it from happening. It appears to be an issue with the jit/zend_jit.lo dependeny in OPCache (possibly) as it only occurs when at this stage of the build.

My docker file is…

FROM php:8.0-apache

#Set The Project Work Directory
WORKDIR /var/www/html


#Copy The Application To The Web Directory
COPY . /var/www/html


# Install composer & app dependencies
COPY --from=composer:2.0.13 /usr/bin/composer /usr/local/bin/composer


# Add Apache Extensions
RUN a2enmod expires


# Install PHP extensions
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions bcmath gd pdo_mysql pdo_pgsql redis uuid zip sockets opcache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*


# Run Composer Installation
RUN composer install --prefer-dist --no-scripts


# Copy Configuration Files
COPY docker/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY docker/opcache.ini /usr/local/etc/php/conf.d/opcache.ini


# Copy Shell Execution Script
COPY docker/start.sh /usr/local/bin/start


# Change PRoject File Permissions
RUN chown -R www-data:www-data /var/www/html && chmod u+x /usr/local/bin/start && a2enmod rewrite


# Execute Shell Execution Script
CMD ["/usr/local/bin/start"]

The executing command in the Dockerfile is…

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/
RUN install-php-extensions bcmath gd pdo_mysql pdo_pgsql redis uuid zip sockets opcache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

And the returned log in Gitlab pipeline is…

cc /usr/src/php/ext/opcache/jit/dynasm/minilua.c -lm -o minilua
make: Circular jit/zend_jit.lo <- jit/zend_jit.lo dependency dropped.
 cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/Optimizer/compact_vars.c  -fPIC -DPIC -o Optimizer/.libs/compact_vars.o
 cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/Optimizer/zend_dump.c  -fPIC -DPIC -o Optimizer/.libs/zend_dump.o
/bin/bash /usr/src/php/ext/opcache/libtool --mode=compile cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit_vm_helpers.c -o jit/zend_jit_vm_helpers.lo 
mkdir jit/.libs
 cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit_vm_helpers.c  -fPIC -DPIC -o jit/.libs/zend_jit_vm_helpers.o
./minilua /usr/src/php/ext/opcache/jit/dynasm/dynasm.lua  -D X64=1 -o jit/zend_jit_x86.c /usr/src/php/ext/opcache/jit/zend_jit_x86.dasc
/bin/bash /usr/src/php/ext/opcache/libtool --mode=compile cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H  -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit.c -o jit/zend_jit.lo 
 cc -I. -I/usr/src/php/ext/opcache -I/usr/src/php/ext/opcache/include -I/usr/src/php/ext/opcache/main -I/usr/src/php/ext/opcache -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /usr/src/php/ext/opcache/jit/zend_jit.c  -fPIC -DPIC -o jit/.libs/zend_jit.o
cc: fatal error: Killed signal terminated program cc1
compilation terminated.
make: *** [Makefile:299: jit/zend_jit.lo] Error 1
The command '/bin/sh -c install-php-extensions bcmath gd pdo_mysql pdo_pgsql redis uuid zip sockets opcache' returned a non-zero code: 2
Cleaning up file based variables 00:00
ERROR: Job failed: command terminated with exit code 2

I would still like to use OCache but am trying to avoid a unpredictable error from halting CI all the time and causing a restart of the pipeline.

Not sure if it makes a difference but I am not using the shared runners hosted by Gitlab I am using my own runners hosted on my Kubernetes cluster.

Turn off auto-grayscale when saving to png with PHP Imagick

When saving a RGB image to a PNG with Imagick. The image gets saved automatically in grayscale when it contains only grey pixels. I understand this a default stetting, that can be overridden. I would like to save my image always in RGB as a default. How do I turn Imagick’s auto-grayscale off with PHP/Imagick? I wrote this code.

$im = new Imagick();
$im->setResolution(288,288);
$im->setColorspace(Imagick::COLORSPACE_SRGB);
$im->setBackgroundColor(new ImagickPixel('transparent'));
$im->readImage($orgDataPath);
$im->setoption("colorspace:auto-grayscale", "off");
$im->setImageType(Imagick::IMGTYPE_TRUECOLOR);
$im->trimImage(0);
$im->setImageFormat("png");
$im->writeImage($pngPrint.".png");
// cleanup
$im->clear();
$im->destroy();

How to display the HTML which is the inside for each if the foreach is empty

I have the below code on my page and it’s working when there is any data in the $getbanking variable. But if $getbanking is empty then I am getting the below error

Warning : Invalid argument supplied for foreach() in

I have to run the below code if there $getbanking is empty at least once. So that it will display the upload option to the user.

<?php 
  $getbanking = unserialize($info['banking_details']); 

  $i=1;
  foreach ($getbanking as $bankdoc => $b) { ?>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-12 col-xs-12">
  <div class="documentUploadWrap">
    <label>Bank <?php echo $i;?></label>
    <div class="upload_doc <?php if(!empty($b)){ echo " imgext uploaded ";} ?>">
    <input type="hidden" name="banking[<?php echo $bankdoc;?>]" value="<?php echo $b;?>">
      <input type="file" name="banking[<?php echo $bankdoc;?>]" class="fileupload noofbank" accept="image/png, image/jpeg, application/pdf, .doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document">
      <div class="uploadInfo">
        <div class="upload_icon"></div>
        <p>Drop your image here, or <span>browse</span></p>
        <span>Supports: JPEG, PNG, DOC, PDF</span>
      </div>
      <div class="previewFile">
        <a href="uploads/<?php echo $b;  ?>" target="_blank">
          <div class="previewFileIcon text-center"></div>
        </a>

        <p class="fileNamePreview"><?php echo $b;  ?></p>

      </div>
      <?php if($i>=2){?>
      <div class="close-box close-box-bank"><img src="assets/images/x-circle.svg"></div>
      <?php }?>
    </div>
  </div>
</div>
<?php $i++; } ?>

PHP don’t recognize row variables

I am having trouble posting a mysql table to my website.

Basically, the php error says that the row variable that I used was undefined. I tried using a code from a youtube tutorial but to no avail.

I also checked my sql query on phpmyadmin and it seems to work just fine.

Here is my test code for your reference:

 <!DOCTYPE html>
<html>
<head>
<title>Table with database</title>
<style>
table {
border-collapse: collapse;
width: 100%;
color: #588c7e;
font-family: monospace;
font-size: 25px;
text-align: left;
}
th {
background-color: #588c7e;
color: white;
}
tr:nth-child(even) {background-color: #f2f2f2}
</style>
</head>
<body>
<table>
<tr>
<th>Name</th>
<th>Transaction</th>
<th>Website</th>
</tr>
<?php
$conn = new mysqli('localhost','sasuke', 'sharinganrox', 'uchiha_db');
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT clientData.Client_ID, clientData.Client_Name, transactionData.Transaction_ID, transactionData.Transaction_Date, websiteProduct.Website_ID, websiteProduct.Website_Name,
            FROM clientData CROSS JOIN transactionData on clientData.Client_ID = transactionData.Client_ID CROSS JOIN websiteProduct on transactionData.Website_ID = websiteProduct.Website_ID WHERE monthname(transaction_date)='January' ORDER BY transaction_date ASC;";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {

// output data of each row
while($row = mysqli_fetch_array($result)) {
echo "<tr><td>" . $row["client_name"]. "</td><td>".$row["transaction_ID"]."</td><td>".$row["transaction_date"]."</td><td>".$row["website_Name"]."</td><td>".$row["website_Price"]."</td></tr>";
}
echo "</table>";
} else { echo "0 results"; echo "number of rows: " . $result->num_rows; }

$conn->close();
?>
</table>
</body>

The error says:
Notice: Undefined index: client_name in C:wamp64wwwaugusta_webapptestingtable.php on line 41

Notice: Undefined index: transaction_ID in C:wamp64wwwaugusta_webapptestingtable.php on line 41

Notice: Undefined index: transaction_date in C:wamp64wwwaugusta_webapptestingtable.php on line 41

Notice: Undefined index: website_Name in C:wamp64wwwaugusta_webapptestingtable.php on line 41

Notice: Undefined index: website_Price in C:wamp64wwwaugusta_webapptestingtable.php on line 41

PHP session lost after file download

I installed my web application at a new host.
Everything is fine except when downloading files.
The PHP session is lost when a user opens a file (example: a PDF) in another tab of the browser and therefore the user is logged out of the application.
I am having this problem with Chrome and Edge, but not with Firefox.
I did not have this problem when the application was hosted at the previous host.
I would like to stay with the new host because its servers are very efficient.
PHP server version is 7.3.
Do you know why this may happen?