PHP auction in real-time

I’m going to create an auction (online) in PHP accessible from multiple clients to increase the offer value. To do this I created 2 web pages:

  1. dashboard.php – show the item with an offer and count down – if time expires the system assigns the item to the last user
  2. offer.php – any clients (after logging) can update the offer in dashboard.php

Result: I want to show the auction in real-time in a dashboard for all users and all participants can increase offers via tablet or mobile phone by using a button.

How can I refresh the dashboard after a client posts a request to increase the offer? Could you suggest a solution?

How can i resolve Dynamic pages issue in my shopify website

I’ve noticed that over the past two months, Google has been indexing multiple versions of my main collection page. For example, my main page is example.com/collection/kitchen-tile, but Google is also indexing similar pages like example.com/collection/kitchen-tile?dfhpage1, example.com/collection/kitchen-tile?dfhpage2, and so on. Why is this happening, how can I fix it, and is it harmful to my SEO ranking?

How can I resolve this issue

WP Rocket’s slow caching speed

The plugin documentation states that the number of cached pages per minute can be dynamic and depends on a large number of factors. However, some studies have shown that on average this can be around 45 pages per minute. On my website, the plugin caches approximately 4-6 pages per minute, and considering that the site has around 1,500 pages, the entire cache is completed in about 4 hours. The question is:

  • What factors influence the speed of page caching?
  • What are the ways to speed up cache creation? Especially for websites with 5-10 thousand pages. And how can this be done smoothly, without creating a high load on the server?

I tried adjusting the plugin settings and increasing the caching interval to see if it would improve the caching speed. However, the improvement was minimal, and it still took several hours to cache all pages. I expected the process to be faster, especially for a website with around 1,500 pages, but the performance remains slow

not able call sweetalert from PHP function

I try to integrate sweetalert in my PHP function to show session status,but sweet alert is not working.please help me on this.

function alertmessage()
{
    if(isset($_SESSION['status']) && $_SESSION['status'] !='')
{
  ?>
  <script>
  swal.fire({
    text: "<?=$_SESSION['status']?>",
    icon: "<?=$_SESSION['status_code']?>",
    confirmButtonColor: "#008B8B",
    confirmButtonText: "Ok!",
    showClass: {
    popup: `
      animate__animated
      animate__fadeInUp
      animate__faster
    `
  },
  hideClass: {
    popup: `
      animate__animated
      animate__fadeOutDown
      animate__faster
    `
  }
  });
  </script>
  <?php
        
        unset($_SESSION['status']);
    }
}

i called the function in required page as
<?= alertmessage() ?>

it showing session status message if i didnt add sweetalert.

Firestore is not returning any collection data in Laravel

The problem is that Firestore is not returning any collection data in Laravel. I am using the google/cloud-firestore package for this.

 public function __construct(LoggerInterface $logger)
    {
        $this->firestoreDB = app('firebase.firestore')->database();
        $docRef = $this->firestoreDB->collection('user')->document('7UUnkB6sSZgrBYazpmRlpCHJMZm2');
        $snapshot = $docRef->snapshot();
        if ($snapshot->exists()) {
            printf('Document data:' . PHP_EOL);
            print_r($snapshot->data());
        } else {
            printf('Document %s does not exist!' . PHP_EOL, $snapshot->id());
        }
        die;
        $this->logger = $logger;
    }


OR
 public function __construct(LoggerInterface $logger)
    {
        $this->firestoreDB = app('firebase.firestore')->database();
        $docs = $this->firestoreDB->collection('user')->documents();
        dd($docs);
    }


I want like print all document in collection and data for specific document.enter image description here[enter image description here]

Upload profile video, instead of profile photo [closed]

I am trying to upload a MP4 file instead of a image file jpg,gif.

I tried changing the function in the thumb nail creation from image extensions to video MP4 extensions, which never work, as the thumb nail GD function don’t support video files.

I modified the gd function to get the upload MP4 file to the folder where the profile updates is stored, with it original file name, Instead of the unique id name meant to bind to the actual file,

It also never update the database

I think it something to do with the GD support function, but how could I do it without this function, and bind file instead of binding the thumbnail.

Profile photo

I am basically trying to use MP4 instead!! Please check the above

how to preg_match_all html tag in php [duplicate]

I am trying to get the data in the html code.

I tried to do something but it didn’t work. Can you help me?

$metin = "<div><b>bla bla bla</b>/<div>";
$pattern = '<div><b>(.*?)</b></div>';
preg_match_all($pattern,$metin,$haslar);
print_r($haslar);

How to disable the feature that shows the image source info in lower left corner of screen on pc and when I click on image it shows the name of image

So on my E commerce website when I hover on the image of any product I see a line in the lower left corner of the screen giving full information about the source of the image such as website name/wp-uploads/year/month/title of the image that I used when I saved it on my pc. Also when I click on the image I see the image title again just below the image. I don’t want my customers to see that information, please tell me how can I disable it.

I have tried asking chatgpt and Gemini to get a solution it told me to add some custom CSS codes but it didn’t work.

MySql and PHP for Ecommerce Project [closed]

I am developing an ecommerce website using Php and Mysql with help of google and youtube. I am new to PHP. Kindly guide me what are necessary knowledge i should gain and practice to get the website developed. There are many articles but got confused. Kindly guide me in details and required knowledge.

Error connect office365 with Webklex Laravel 11

I am trying to connect to Office 365 to retrieve emails.
I am using the Webklex library version 4.1.
I am able to obtain the authentication token to log into the email, but I always receive ‘connection setup failed’.

This is how I capture the authentication token.

private function getToken0Auth()
{
    try {
        $client = new GuzzleHttpClient();
        // Solicitar o token do endpoint de OAuth2 do Microsoft
        // laravel office
        $response = $client->post('https://login.microsoftonline.com/'.env('tenant_id').'/oauth2/v2.0/token', [
            'form_params' => [
                'client_id' => env('client_id'),
                'client_secret' => env('client_secret'),
                'scope' => 'https://outlook.office365.com/.default',
                'grant_type' => 'client_credentials',
            ],
        ]);
        $body = json_decode($response->getBody());
        if (!$body->access_token) {
            return ['success' => false, 'message' => 'Não foi possivel gerar o token.'];
        }
        return ['success' => true, 'token' => $body->access_token];
    } catch (Throwable $t) {
        return ['success' => false, 'message' => $t->getMessage()];
    }
}

This is an example of the token response:
eyJ0eXAiOiJKV1QiLCJub25jZSI6InNjUWJVeERrY3BvcjNsdVdaa080OERISDNsSDQwSmhEVk5QeXlVanBBb1EiLCJhbGciOiJSUzI1NiIsIng1dCI6Ikg5bmo1QU9Tc3dNcGhnMVNGeDdqYVYtbEI5dyIsImtpZCI6Ikg5bmo1QU9Tc3dNcGhnMVNGeDdqYVYtbEI5dyJ9.eyJhdWQiOiJodHRwczovL291dGxvb2sub2ZmaWNlMzY1LmNvbSIsImlzcyI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0L2IzNDdhMGY0LTA3MzQtNDI5Ni05NzU3LTc2NzJkOGFjYjJhNC8iLCJpYXQiOjE3MjU2NDU5ODYsIm5iZiI6MTcyNTY0NTk4NiwiZXhwIjoxNzI1NjQ5ODg2LCJhaW8iOiJFMmRnWUxnbllYVWhjbzlWUU02SGEvM0poNXMvQWdBPSIsImFwcF9kaXNwbGF5bmFtZSI6IkxhcmF2ZWwgT2ZmaW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zoYbljQlLjVyfE5Ppha8DmdFj2xtTYS4XA

After capturing the token, I use this function to connect to the IMAP server:

$oClient = Client::make([
    'host'          => 'outlook.office365.com',
    'port'          => 993,
    'encryption'    => 'ssl',
    'validate_cert' => false,
    'username'      => 'my-email',
    'password'      => $response['token'], // Token OAuth2
    'protocol'      => 'imap',
    'authentication' => 'oauth', // Definindo para autenticação OAuth
]);
$oClient->connect();

However, it always falls into the catch block, returning the same error: “connection setup failed”

In my Office 365 account, I had to register an app and grant permissions for access via IMAP.AccessAsApp
enter image description here

I also enabled IMAP for my mailbox.
enter image description here

Access to this application was created for any account.

I’m out of options at this point.

How to use PHP preg_replace on a formatted number based on search query while ignoring comma and decimal?

I want to highlight my search query on a formatted number.

For example:

$search_query = '1234'; // or $search_query = '7800';
$formatted_numeber = 12,345,678.00;

Currently my code is:

preg_replace('/(' . $search_query . ')/i', "<span style='background: yellow'>$1</span>", $formatted_numeber);

But this code fails to highlight search clause like ‘1234’ , ‘7800’ due to presence of commas (,) and decimal (.)

Also i want this to work with the presence of commas and decimals in the search query.

For example:

$search_query = '3,456';
$formatted_numeber = 12,345,678.00;

I want to highlight the part “345,6” on my formatted number.

Or:

$search_query = '7.80';
$formatted_numeber = 12,345,678.00;

I want to highlight the part “78.0” on my formatted number.

Passing properties to an Inertia Vue page for Laravel Fortify’s register view

I’m working on a web app that’s using Laravel 10, Vue 3, and Inertia. (I’m new to all of these, btw) Laravel is using Fortify for a lot of features, including new user registration. I’ve been tasked with changing the registration page to display some things from the database. As far as I can tell, the usual approach to this would be to add some properties on the Vue page, and then populate those properties via Inertia somewhere in the Laravel app (e.g. a controller).

The challenge I’m encountering right now is that Fortify currently sets up the “register” view (implemented in the Jetstream service provider; see https://github.com/laravel/jetstream/blob/4.x/src/JetstreamServiceProvider.php#L210), pointing to the Auth/Register Vue page, but provides no way to add properties to the Inertia rendering (as far as I can tell).

So the questions are:

  • Is there a way to add properties in the existing configuration of Laravel, Fortify, Inertia, and Vue?
  • Can I safely just call Fortify::registerView() from a new service provider I make? Or will this cause some sort of conflict issue with the existing implementation done by the framework?
  • Do I have to (or would it be better to) extend something to override this default behavior? (I know Laravel allows me to extend a binding… https://laravel.com/docs/10.x/container#extending-bindings)
  • Would it be better to approach this from a completely different angle? Such as leaving the page as-is on the backend, and then setting up the page in Vue to make a subsequent request to fetch the necessary data from the database?

Simple HTML DOM get a Tags value from inside div

Need get value from inside div sone tags with no div or class

<div class="pb-card rounded-3 nsofts_border" data-audio-id="58178" data-audio- 
name="Kirubai" data-audio-artist="talk,christian, gospel" data-audio- 
album="talk,christian, gospel" data-audio-url="http://s4.voscast.com:7110/;" data-audio- 
cover="https://d371i8ihhgym7w.cloudfront.net/13331.png">

How can i get that name inside “data-audio-name”.. But followinng code not work

foreach($html->find('div[class=pb-card rounded-3 nsofts_border]') as $a) {
    $name = $a->find('.data-audio-name', 0)->plaintext;

   print $a;

  echo $name; 
  echo "</br>";
}