why i docker build -t php84 . failed to authorize?

docker pull php success

Dockerfile:
FROM php
sudo docker build -t php84 .

[+] Building 21.9s (3/3) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 46B 0.0s
=> ERROR [internal] load metadata for docker.io/library/php:latest 21.8s
=> [auth] library/php:pull token for registry-1.docker.io 0.0s

[internal] load metadata for docker.io/library/php:latest:


Dockerfile:1

1 | >>> FROM php
2 |

ERROR: failed to solve: php: failed to resolve source metadata for docker.io/library/php:latest: failed to authorize: failed to fetch oauth token: Post “https://auth.docker.io/token”: dial tcp 103.214.168.106:443: connect: connection refused

why ?

I am trying to connect a web application UI (running in a Docker container) to a MySQL database (also in a Docker container) on the same network [duplicate]

I am trying to connect a web application UI (running in a Docker container) to a MySQL database (also in a Docker container) on the same network. The connection succeeds from within the application container, but fails during the UI installation process. checked network connectivity using ping I verified the database credentials are correct. I tried connecting using different tools

checked network connectivity using ping or nslookup. I verified the database credentials are correct. I tried connecting using different tools

How do I ensure user-specific sessions/ data for concurrent users, when my custom php plugin (that accesses my wp databases) [closed]

Problem Summary:

I’m building a WordPress plugin for a multi-user parent portal. Parents log in and edit forms for their children.

Each parent only has one child, and users are never supposed to see each other’s data.
BUT: When concurrent users are logged in on different machines (different IPs, different browsers), something strange happens:

The “Currently managing: {child name}” message switches names depending on which user accessed a tab most recently.

This happens even when:

  • Users are logged in separately, not reusing browsers
  • They each have different credentials
  • They each only have one child
  • Sessions are intended to be separate

Suspected Root Cause
We store the active child ID in a session variable like this:

$_SESSION['current_child_id'] = $user->{"Serial no."};

And use that to determine which student name to display:

$child_id = $_SESSION['current_child_id'];
$child = $wpdb->get_row("SELECT * FROM gsp25 WHERE `Serial no.` = '$child_id'");
echo "Currently managing: " . $child->{"Name of student"};

We use session_start() consistently in all functions.

The Issue

Even though each user logs in on a different machine, one user’s session variable seems to overwrite another’s.

There’s no shared login or intentional impersonation — just unexpected session data bleeding across users.

What We’ve Tried

  • Using session_start() with no session_name() (just default PHPSESSID)
  • Ensuring no output before session starts
  • Confirming that session IDs are different across users
  • Setting the child ID once on login
  • Logging to debug.log shows each user has a different session_id()

What We Need Help With

  • What else could cause cross-user $_SESSION variable leakage?
  • Could WordPress, a plugin, or a server-side misconfiguration (e.g. shared
    session storage) cause this?
  • Is there a better way to isolate each user’s context than relying on PHP sessions?

Session Init Code

This is at the top of every handler function that touches $_SESSION:

if (!session_id()) session_start();

We do not use session_name() anymore. We rely entirely on PHP’s default PHPSESSID cookie.

Where We Set Session State (on login):

$_SESSION['parent_logged_in'] = true;
$_SESSION['parent_email'] = $parent_email;
$_SESSION['current_child_id'] = $user->{"Serial no."};

Server Setup:
I do not know much about this, other than that this is a custom plugin on a website hosted at wordpress.com, using tables from a wp database.
We’ve verified that each user gets a unique session_id() via session_id()

Thank you experts, and appreciate your help with this.

Can I get any google user’s profile picture? [closed]

I have a big software with thousands of clients. I just thought it would be a nice touch if I could add their google profile picture, just to identify them easier.

I mean, I’m not attempting to hack or intrude anything, I’m just trying to access a low resolution image of their PUBLIC profiles from some URL or API, only using their emails, either to store the pictures or just to request them to display realtime. This has nothing to do with logins or with asking permissions.

What I want is either:

a) an URL I can access via javascript or PHP’s file_get_contents or similar

b) an API I can call via PHP
…so I can loop the entire DB and do this with those who have gmail.

Toast Notification Appears on Every Page After Login Failure in CodeIgniter

I’m facing an issue with toast notifications in my CodeIgniter app. After a failed login attempt, the error message is displayed correctly using Toastr. However, this message keeps appearing on every page after the login attempt, even after navigating or refreshing the page.

I’ve tried using flashdata to show the error message, but the toast notification keeps appearing on all pages until the session expires or I manually clear the session.

Here’s my login function:

$login_status = $this->validate_login($email, $password);`
if ($login_status == 'success') {`
    redirect(site_url('dashboard'), 'refresh');`
} else {
    $this->session->set_flashdata('error_message', get_phrase('login_failed'));`
    redirect(site_url('login'), 'refresh');
}

Logout Function:

    $this->session->sess_destroy();
    $this->session->set_flashdata('logout_notification', 'logged_out');
    redirect(site_url('login'), 'refresh');
}

In includes-bottom.php:

    <script>
        toastr.error('<?php echo $this->session->flashdata('error_message');?>');
    </script>
<?php } ?>

Session Config:

$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

I’ve ensured the flash message is unset after use, and session regeneration is done. However, the issue persists where the toast notification keeps appearing across all pages after a failed login.

Has anyone faced this issue before? What am I missing here?

I tried using flashdata to display the error message for login failure and unset the session after showing the message. I also ensured the session is regenerated and cleared on logout. I expected the toast message to only appear once when the login fails and not persist across multiple pages or after a page refresh. However, the issue persists, and the toast message keeps showing on every page even after navigating or refreshing the page.

How to fix file upload in livewire [duplicate]

I try to upload a file in livewire but I faced some problems
this is my code

my component code is

<?php

namespace AppLivewire;

use AppModelsbrand;
use Exception;
use LivewireComponent;
use LivewireWithFileUploads;
use LivewireWithPagination;

class LiveBrand extends Component
{
    use WithPagination;
    use WithFileUploads;
    public $search;
    public $t_name;
    public $sort = '';
    public string $name = '';
    public $logo;
    public $namb = 5;
    public bool $stat = false;
    public function stat()
    {
        $this->stat = !$this->stat;
    }

    public function show()
    {
        $this->namb++;
    }

    public function stor()
    {
        try {
            $validated = $this->validate([
                'name' => 'required|string|max:255|min:2',
                'logo' => 'required|image|max:1024', // 1MB Max
                'stat' => 'nullable|boolean'
            ]);

            // Check if logo exists
            if ($this->logo) {
                $imagePath = $this->logo->store(path: 'public');

                Brand::create([
                    'name' => $validated['name'],
                    'logo' => $imagePath,
                    'stat' => $validated['stat'] ?? false
                ]);

                $this->reset(['name', 'logo', 'stat']);
                $this->create_alert('Brand');
                $this->dispatch('brand-created');
            } else {
                session()->flash('error', 'Please select a logo file');
            }
        } catch (Exception $e) {
            session()->flash('upload_error', 'File upload failed: ' . $e->getMessage());
            $this->exception_alert($e);
        }
    }


    public function sorter($name)
    {
        $this->sort = $this->sort === 'desc' ? 'asc' : 'desc';
        $this->t_name = $name;
    }

    public function render()
    {
        $all = brand::where('name', 'like', "%{$this->search}%")
            ->orWhere('created_at', 'like', "%{$this->search}%")
            ->orderBy(empty($this->t_name) ? 'id' : '' . $this->t_name . '', '' . empty($this->sort) ? 'desc' : '' . $this->sort . '' . '')
            ->latest()
            ->paginate(5);
        $tabelnames = [
            "Brand" => 'name',
            "Logo" => 'logo',
            "Créé Le" => 'created_at',
            "Statut" => 'stat'
        ];
        return view('livewire.live-brand', [
            "thname" => $tabelnames,
            "all" => $all,
            "uploadError" => session('upload_error')
        ]);
    }
}

me view is

<div class="page-wrapper row">
   <form wire:submit="stor">
       @error('logo')
        <div classs="alert alert-danger text-danger">{{$message}}</div>
       @enderror
      <div class="col-12">
        <label for="" class="form-label">Name</label>
        <input class="form-control" type="text" wire:model="name">
      </div>
      <div class="col-12">
       <label for="" class="form-label">Logo</label>
       <input class="form-control" type="file" wire:model="logo">
     </div>
    <button class="btn btn-primary" type="submit">Upload</button>
  </form>
</div>

enter image description here

it show me this error The logo failed to upload. and when I click on the upload button it show me the The logo field is required please help me .
enter image description here

How to fix av_interleaved_write_frame() broken pipe error in php

I have an issue using ffmpeg to stream audio and parse to google cloud speech to text in PHP.

It returns this output.
I have tried delaying some part of the script, that did not solve it.
I have also checked for similar questions. however, they are mostly in python and none of the solutions actually work for this.

  built with gcc 8 (GCC)
  cpudetect
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, mp3, from 'https://npr-ice.streamguys1.com/live.mp3':
  Metadata:
    icy-br          : 96
    icy-description : NPR Program Stream
    icy-genre       : News and Talk
    icy-name        : NPR Program Stream
    icy-pub         : 0
    StreamTitle     :
  Duration: N/A, start: 0.000000, bitrate: 96 kb/s
    Stream #0:0: Audio: mp3, 32000 Hz, stereo, fltp, 96 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, s16le, to 'pipe:':
  Metadata:
    icy-br          : 96
    icy-description : NPR Program Stream
    icy-genre       : News and Talk
    icy-name        : NPR Program Stream
    icy-pub         : 0
    StreamTitle     :
    encoder         : Lavf58.29.100
    Stream #0:0: Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s
    Metadata:
      encoder         : Lavc58.54.100 pcm_s16le
**av_interleaved_write_frame(): Broken pipe** 256.0kbits/s speed=1.02x
**Error writing trailer of pipe:: Broken pipe**
size=      54kB time=00:00:01.76 bitrate= 250.8kbits/s speed=0.465x
video:0kB audio:55kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

this is my PHP code

require_once 'vendor/autoload.php';
    
    $projectId = "xxx-45512";
    putenv('GOOGLE_APPLICATION_CREDENTIALS=' . __DIR__ . '/xxx-45512-be3eb805f1d7.json');
    
    // Database connection
    $pdo = new PDO('mysql:host=localhost;dbname=', '', '');
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    $url = "https://npr-ice.streamguys1.com/live.mp3";
    
    $ffmpegCmd = "ffmpeg -re -i $url -acodec pcm_s16le -ac 1 -ar 16000 -f s16le -";
    
    $fp = popen($ffmpegCmd, "r");
    if (!$fp) {
        die("Failed to open FFmpeg stream.");
    }
    sleep(5);

    try {
        $client = new SpeechClient(['transport' => 'grpc', 'credentials' => json_decode(file_get_contents(getenv('GOOGLE_APPLICATION_CREDENTIALS')), true)]);
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage(); 
        exit;
    }
    
    $recognitionConfig = new RecognitionConfig([
        'auto_decoding_config' => new AutoDetectDecodingConfig(),
        'language_codes' => ['en-US'],
        'model' => 'long',
    ]);
    
    $streamingConfig = new StreamingRecognitionConfig([
        'config' => $recognitionConfig,
    ]);
    
    $configRequest = new StreamingRecognizeRequest([
        'recognizer' => "projects/$projectId/locations/global/recognizers/_",
        'streaming_config' => $streamingConfig,
    ]);
    
    
    function streamAudio($fp)
    {
        while (!feof($fp)) {
            yield fread($fp, 4096);
        }
    }
    
    $responses = $client->streamingRecognize([
    'requests' => (function () use ($configRequest, $fp) {
            yield $configRequest; // Send initial config
            foreach (streamAudio($fp) as $audioChunk) {
                yield new StreamingRecognizeRequest(['audio' => $audioChunk]);
            }
        })()]
    );
    
    // $responses = $speechClient->streamingRecognize();
    // $responses->writeAll([$request,]);
    
    foreach ($responses as $response) {
        foreach ($response->getResults() as $result) {
            $transcript = $result->getAlternatives()[0]->getTranscript();
            // echo "Transcript: $transcriptn";
    
            // Insert into the database
            $stmt = $pdo->prepare("INSERT INTO transcriptions (transcript) VALUES (:transcript)");
            $stmt->execute(['transcript' => $transcript]);
        }
    }
    
    
    pclose($fp);
    $client->close();

I’m not sure what the issue is at this time.

UPDATE

I’ve done some more debugging and i have gotten the error to clear and to stream actually starts.
However, I expect the audio to transcribe and update my database but instead I get this error when i close the stream

error after closing stream

this is my updated code

    $handle = popen($ffmpegCommand, "r");

    try {
        $client = new SpeechClient(['transport' => 'grpc', 'credentials' => json_decode(file_get_contents(getenv('GOOGLE_APPLICATION_CREDENTIALS')), true)]);
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage(); 
        exit;
    }
    
    try {
    $recognitionConfig = (new RecognitionConfig())
        ->setAutoDecodingConfig(new AutoDetectDecodingConfig())
        ->setLanguageCodes(['en-US'], ['en-UK'])
        ->setModel('long');
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage(); 
        exit;
    }
    
    try {
        $streamConfig = (new StreamingRecognitionConfig())
        ->setConfig($recognitionConfig);
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage();
        exit;
    }
    try {
        $configRequest = (new StreamingRecognizeRequest())
        ->setRecognizer("projects/$projectId/locations/global/recognizers/_")
        ->setStreamingConfig($streamConfig);
    } catch (Exception $e) {
        echo 'Error: ' . $e->getMessage(); 
        exit;
    }
    
    $stream = $client->streamingRecognize();
    $stream->write($configRequest);
    
    mysqli_query($conn, "INSERT INTO transcriptions (transcript) VALUES ('bef')");
    
    while (!feof($handle)) {
        $chunk = fread($handle, 25600);
        // printf('chunk: ' . $chunk);
        if ($chunk !== false) {
            try {
                $request = (new StreamingRecognizeRequest())
                        ->setAudio($chunk);
                    $stream->write($request);
            } catch (Exception $e) {
                printf('Errorc: ' . $e->getMessage());
            }
        }
    }
    
    
    $insr = json_encode($stream);
    mysqli_query($conn, "INSERT INTO transcriptions (transcript) VALUES ('$insr')");
    
    foreach ($stream->read() as $response) {
        mysqli_query($conn, "INSERT INTO transcriptions (transcript) VALUES ('loop1')");
        foreach ($response->getResults() as $result) {
            mysqli_query($conn, "INSERT INTO transcriptions (transcript) VALUES ('loop2')");
            foreach ($result->getAlternatives() as $alternative) {
                $trans = $alternative->getTranscript();
                mysqli_query($conn, "INSERT INTO transcriptions (transcript) VALUES ('$trans')");
            }
        }
    }
    
    pclose($handle);
    $stream->close();
    $client->close();```

How to get custom checkout field values with Woocommerce Checkout Blocks

I added some data with the function :

woocommerce_register_additional_checkout_field(
            array(
                'id'       => 'namespace/newsletter-opt-in',
                'label'    => 'Subscribe to newsletter ?',
                'location' => 'order',
                'type'     => 'checkbox',
            )
        );

I try to check this checkbox but I can’t get the value
However, the data is well returned in my order data column

I tried :

$order = wc_get_order($order_id);
$subscribe = $order->get_meta('namespace/newsletter-opt-in');

But $subscribe is empty

Why does my browser submit emoji characters as html entities? [duplicate]

Someone submits a text field on my website and their submission is stored in my mysql database. Their comment contains an emoji character. If I store the comment as is, it will be stored as an html entity, such as &#128512;.

I read in another post that you should not convert special characters to html entities when storing them in your mysql database. But how about the opposite: are special characters so preferable to html entities that I should take the extra step and convert the visitor’s comment from an html entity to a special character before storing it in the database?

EDIT: In case anyone is interested, the reason the emoji characters were being submitted as html entities is that my html page lacked the correct charset setting. Once I set its charset to utf-8, emojis started to get stored as is, rendering my entire question moot.

PHPMYADMIN I can’t log in. Constant PhpMyAdminE_STRICT is deprecated

This error is displayed when logging in to phpmyadmin.

Deprecation Notice in ./libraries/classes/Url.php#221
http_build_query(): Passing null to parameter #2 ($numeric_prefix) of
type string is deprecated
Backtrace
./libraries/classes/Url.php#221: http_build_query(
array,
NULL,
string ‘&’,
)
./libraries/classes/Header.php#231: PhpMyAdminUrl::getCommonRaw()
./libraries/classes/Header.php#282: PhpMyAdminHeader->getJsParams()
./libraries/classes/Header.php#214: PhpMyAdminHeader->getJsParamsCode()
./libraries/classes/Header.php#142: PhpMyAdminHeader->_addDefaultScripts()
./libraries/classes/Response.php#100: PhpMyAdminHeader->__construct()
./libraries/classes/Response.php#134: PhpMyAdminResponse->__construct()
./libraries/classes/Plugins/Auth/AuthenticationCookie.php#87:
PhpMyAdminResponse::getInstance()
./libraries/classes/Plugins/AuthenticationPlugin.php#247:
PhpMyAdminPluginsAuthAuthenticationCookie->showLoginForm()
./libraries/common.inc.php#353: PhpMyAdminPluginsAuthenticationPlugin->authenticate()
./index.php#27: require_once(./libraries/common.inc.php)
Deprecation Notice in ./../../php/Twig/Loader/FilesystemLoader.php#40
realpath(): Passing null to parameter #1 ($path) of type string is deprecated
Backtrace
FilesystemLoader.php#40: realpath(NULL)
./libraries/classes/Template.php#61: TwigLoaderFilesystemLoader->__construct(string ‘templates/’)
./libraries/classes/Template.php#102: PhpMyAdminTemplate->__construct(string ‘login/header’)
./libraries/classes/Plugins/Auth/AuthenticationCookie.php#111: PhpMyAdminTemplate::get(string ‘login/header’)
./libraries/classes/Plugins/AuthenticationPlugin.php#247: PhpMyAdminPluginsAuthAuthenticationCookie->showLoginForm()
./libraries/common.inc.php#353: PhpMyAdminPluginsAuthenticationPlugin->authenticate()
./index.php#27: require_once(./libraries/common.inc.php)
Deprecation Notice in ./libraries/classes/Url.php#221
http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated
Backtrace
./libraries/classes/Url.php#221: http_build_query(
array,
NULL,
string ‘&’,
)
./libraries/classes/Url.php#169: PhpMyAdminUrl::getCommonRaw(
array,
string ‘?’,
)
./libraries/classes/Core.php#749: PhpMyAdminUrl::getCommon(array)
./../../../../../../var/lib/phpmyadmin/tmp/twig/91/91211ba25b99b1424ac2dd7e72af0c0b7ef97ed8e59a13e24b13143b76ee353b.php#40:
PhpMyAdminCore::linkURL(string ‘https://www.phpmyadmin.net/’)
Template.php#407: __TwigTemplate_dd64914d2ea903cb7e97449fb1a49d0d1b0386bce92be9283cbffd5f6c826508->doDisplay(
array,
array,
)
Template.php#380: TwigTemplate->displayWithErrorHandling(
array,
array,
)
Template.php#392: TwigTemplate->display(array)
TemplateWrapper.php#45: TwigTemplate->render(
array,
array,
)
./libraries/classes/Template.php#133: TwigTemplateWrapper->render(array)
./libraries/classes/Plugins/Auth/AuthenticationCookie.php#111:
PhpMyAdminTemplate->render(array)
./libraries/classes/Plugins/AuthenticationPlugin.php#247:
PhpMyAdminPluginsAuthAuthenticationCookie->showLoginForm()
./libraries/common.inc.php#353: PhpMyAdminPluginsAuthenticationPlugin->authenticate()
./index.php#27: require_once(./libraries/common.inc.php)
Deprecation Notice in ./../../php/Twig/Node/Node.php#161
Return type of TwigNodeNode::count() should either be compatible with Countable::count(): int, or the
#[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Backtrace
autoload.php#369: require(./../../php/Twig/Node/Node.php)
{closure:/usr/share/php/Twig/autoload.php:6}(string ‘TwigNodeNode’)
TwigFilter.php#150: class_exists(string ‘TwigNodeNode’)
autoload.php#369: require(./../../php/Twig/TwigFilter.php)
CoreExtension.php#214: {closure:/usr/share/php/Twig/autoload.php:6}(string
‘TwigTwigFilter’)
ExtensionSet.php#433: TwigExtensionCoreExtension->getFilters()
ExtensionSet.php#423: TwigExtensionSet->initExtension()
ExtensionSet.php#184: TwigExtensionSet->initExtensions()
Environment.php#871: TwigExtensionSet->getFunction(string ‘Message_error’)
./../../../../../../var/lib/phpmyadmin/tmp/twig/91/91211ba25b99b1424ac2dd7e72af0c0b7ef97ed8e59a13e24b13143b76ee353b.php#55:
TwigEnvironment->getFunction(string ‘Message_error’)
Template.php#407: __TwigTemplate_dd64914d2ea903cb7e97449fb1a49d0d1b0386bce92be9283cbffd5f6c826508->doDisplay(
array,
array,
)
Template.php#380: TwigTemplate->displayWithErrorHandling(
array,
array,
)
Template.php#392: TwigTemplate->display(array)
TemplateWrapper.php#45: TwigTemplate->render(
array,
array,
)
./libraries/classes/Template.php#133: TwigTemplateWrapper->render(array)
./libraries/classes/Plugins/Auth/AuthenticationCookie.php#111:
PhpMyAdminTemplate->render(array)
./libraries/classes/Plugins/AuthenticationPlugin.php#247:
PhpMyAdminPluginsAuthAuthenticationCookie->showLoginForm()
./libraries/common.inc.php#353: PhpMyAdminPluginsAuthenticationPlugin->authenticate()
./index.php#27: require_once(./libraries/common.inc.php)
Deprecation Notice in ./../../php/Twig/Node/Node.php#166
Return type of TwigNodeNode::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the
#[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Backtrace
autoload.php#369: require(./../../php/Twig/Node/Node.php)
{closure:/usr/share/php/Twig/autoload.php:6}(string ‘TwigNodeNode’)
TwigFilter.php#150: class_exists(string ‘TwigNodeNode’)
autoload.php#369: require(./../../php/Twig/TwigFilter.php)
CoreExtension.php#214: {closure:/usr/share/php/Twig/autoload.php:6}(string
‘TwigTwigFilter’)
ExtensionSet.php#433: TwigExtensionCoreExtension->getFilters()
ExtensionSet.php#423: TwigExtensionSet->initExtension()
ExtensionSet.php#184: TwigExtensionSet->initExtensions()
Environment.php#871: TwigExtensionSet->getFunction(string ‘Message_error’)
./../../../../../../var/lib/phpmyadmin/tmp/twig/91/91211ba25b99b1424ac2dd7e72af0c0b7ef97ed8e59a13e24b13143b76ee353b.php#55:
TwigEnvironment->getFunction(string ‘Message_error’)
Template.php#407: __TwigTemplate_dd64914d2ea903cb7e97449fb1a49d0d1b0386bce92be9283cbffd5f6c826508->doDisplay(
array,
array,
)
Template.php#380: TwigTemplate->displayWithErrorHandling(
array,
array,
)
Template.php#392: TwigTemplate->display(array)
TemplateWrapper.php#45: TwigTemplate->render(
array,
array,
)
./libraries/classes/Template.php#133: TwigTemplateWrapper->render(array)
./libraries/classes/Plugins/Auth/AuthenticationCookie.php#111:
PhpMyAdminTemplate->render(array)
./libraries/classes/Plugins/AuthenticationPlugin.php#247:
PhpMyAdminPluginsAuthAuthenticationCookie->showLoginForm()
./libraries/common.inc.php#353: PhpMyAdminPluginsAuthenticationPlugin->authenticate()
./index.php#27: require_once(./libraries/common.inc.php)

And then this one. And I can’t do anything.

Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.

Constant PhpMyAdminE_STRICT is deprecated

1

Using a base/generic type class as a parameter in a method

I am trying to use the implements of PHP where the parameter is a base/generic type class.

BaseFormRequest.php

class BaseFormRequest extends FormRequest
{
... methods here
}

StorePostRequest.php

class StorePostRequest extends BaseFormRequest
{
... methods here
}

IController.php

interface IController
{
    public function store(BaseFormRequest $request);
}
class PostController extends Controller implements IController
{

    public $service;

    public function __construct(PostService $service)
    {
        $this->service = $service;
    }

    public function store(StorePostRequest $request)
    {
        $post = $this->service->store($request);
    }
}

As you can see in the code:

  1. in StorePostRequest, it extends the BaseFormRequest.
  2. in the IController, the parameter in store method is type BaseFormRequest.
  3. in PostController, the parameter in store method is type StorePostRequest.

I am getting the error

Declaration of PostController::store(StorePostRequest $request) must be compatible with IController::store(AppHttpRequestsBaseFormRequest $request)

What I do know is that

  1. if I remove the implements IController, the code works as intended
  2. if I change the PostController@store param to BaseFormRequest, or IController@store param to StorePostRequest the error is fixed, but I cant customize the rules in each model this way.

Is it not possible to use a generic class in interface so that when I implement it in my controller, I can use the correct class that extends to the generic class?

How to let end user change password created by dovecot

all
I’ve followed this link:
https://www.linode.com/docs/guides/email-with-postfix-dovecot-and-mysql/
to setup an email server to host multiple email domains. Everything works fine. I was wondering if anybody knows how to let the email end user to setup their own password when their accounts are created. As it is now, I need to use the command:
sudo doveadm pw -s SHA512-CRYPT
to create a password for an user and then input the password hash to the sql server. In other words, I want to automate this process of changing password through a webpage or online interface. I don’t have much experience of writing encrypted php codes. Is there such software or code snippet already existed ?

Span doesn’t show social name [closed]

I have this screen to edit user information (fictional, not from a real person). All other fields (name, birth date, age, address, etc.) work and show just fine, but not the social name. The request also does not show on the network tab when pressing F12 in the browser.

enter image description here

Some related function in jsonParser to load the social name is called loadNomeSocial, it is called first here. I tried to debug this function but nothing shows up in the console:

function jsonParseInfoPessoa(json) {
    let objJson = JSON.parse(json);
    usuarioJson = objJson;
    nome = objJson[0].nome;
    $('.nome').append(nome);
    let controleConta = $('#bloqConta');

    if (objJson[0].excluido == 1) {
        $('#nomeLabel').append(nome + "- Usuário Desativado");
        //adicionando botao de reativar
        controleConta.append('<a href="control/main.php?req=ativaConta&id=' + identificador + '" class="btn btn-primary">Reativar conta</a>');
    } else {
        //botao de desativar
        $('#nomeLabel').append(nome);
        controleConta.append('<a href="control/main.php?req=desativaConta&id=' + identificador + '" class="btn btn-danger">Desativar conta</a>');
    }

    //formatando data de nascimento objJson[0].data_nascimento
    let nascFormatada = objJson[0].data_nascimento.split('-');
    nascFormatada = nascFormatada[2] + ' / ' + nascFormatada[1] + ' / ' + nascFormatada[0];
    let idade = calculaIdade(objJson[0].data_nascimento);
    $('#nasc').append(nascFormatada+'<br>Idade: '+idade + ' Anos');
    if (objJson[0].menor_idade === "1") {
        loadMenor();
        $('#maiorIdade').attr('hidden',true);
    } else {
        loadContato(identificador);
        loadEnd(identificador);
        loadDocument();
        loadDepententes();
        loadLogin(identificador);
        loadNomeSocial(identificador);
    }
    if (objJson[0].ruralino === "1") {
        loadRuralino();
    } else {
        btnInsertRuralino();
    }
    if (objJson[0].excluido == '0') addBtnEdicaoPessoa();
}

Function that makes the request and loads the social name:

function loadNomeSocial(id) {
    ajaxLoadGET('control/main.php?req=selectNomeSocialByPessoaId&id=' + id, parseNomeSocial, '#nome_social');

    function parseNomeSocial(json, corpo) {
    console.log("Resposta da requisição Nome Social:", json);
    let objJson = JSON.parse(json);
    if (objJson.length > 0) {
        $('#nome_social').append(objJson[0].nomesocial);
    } else {
        console.log("Nenhum nome social encontrado.");
    }
}
}

Function that loads the values when clicking the pencil icon to edit them:

function editUsuarioNome() {
    $('#btNome').removeAttr("onclick");
    let dadosBasicos = $('#nomeNasc');

    ajaxLoadGET('control/main.php?req=selecUsuarioLogado', function(response) {
        let userData = typeof response === 'string' ? JSON.parse(response) : response;

        // Log do valor exato e seu tipo para diagnóstico
        console.log("Valor de nv_acesso:", userData.nv_acesso);
        console.log("Tipo de nv_acesso:", typeof userData.nv_acesso);
        console.log("Código de caracteres:", Array.from(userData.nv_acesso || "").map(c => c.charCodeAt(0)));

        // Adicionar log para nome_social
        console.log("Valor de nome_social:", nome_social);
        console.log("Tipo de nome_social:", typeof nome_social);
        console.log("Código de caracteres nome_social:", Array.from(nome_social || "").map(c => c.charCodeAt(0)));

        // Normalização do valor para evitar problemas com acentos ou espaços
        let nivelNormalizado = "";
        if (userData.nv_acesso) {
            nivelNormalizado = userData.nv_acesso.trim().normalize("NFD").replace(/[u0300-u036f]/g, "");
        }
        console.log("Nível normalizado:", nivelNormalizado);

        let nasc = usuarioJson[0].data_nascimento;
        dadosBasicos.empty();
        let opcoesSelect = "";

        // Abordagem inversa - exibir Coordenação para todos EXCETO para níveis específicos
        let niveisComuns = ["Administrador", "Professor", "Aluno", "Visitante"];
        let isNivelComum = niveisComuns.some(nivel =>
            userData.nv_acesso === nivel || nivelNormalizado === nivel
        );

        // Se NÃO for um dos níveis comuns, assumimos que é Coordenação
        if (!isNivelComum) {
            opcoesSelect += `<option value=5>${CargoCoordenador}</option>`;
        }
        opcoesSelect += `
            <option value=4>Visitante</option>
            <option value=3>${CargoAluno}</option>
            <option value=2>${CargoProf}</option>
            <option value=1>${CargoAdm}</option>
        `;

        // Adicionar um evento para capturar quando o campo nome_social é alterado
        dadosBasicos.append(`
            <form action="control/main.php?req=updateDadosBasicos&id=${identificador}" method="POST">
                <p>Nível de Acesso: <select id="nv_acesso" name="nv_acesso">${opcoesSelect}</select></p>
                <p>Nome: <input type='text' name='nome' value="${nome}" required="required"></p>
                <p>Data nascimento: <input type="date" name="nascimento" value="${nasc}" required="required"></p>
                <p>Nome Social: <input type='text' name='nome_social' value="${nome_social}" id="nomeSocial"></p>
                <br/>
                <input type="submit" class="btn btn-primary" value="Gravar"/>
            </form>
        `);

        // Adicionar evento para monitorar alterações no campo nome_social
        $('#nomeSocial').on('input', function() {
            console.log("Nome Social alterado para:", $(this).val());
        });

        // Adicionar um interceptador para o envio do formulário para ver os dados antes do envio
        $('form').on('submit', function(e) {
            // Para fins de debug, você pode querer ver o que está sendo enviado
            console.log("Dados do formulário a serem enviados:");
            const formData = new FormData(this);
            for (const pair of formData.entries()) {
                console.log(pair[0] + ': ' + pair[1]);
            }

            // Remova esta linha se quiser interromper o envio para debug
            // e.preventDefault();
        });
    }, '#nv_acesso');
}

The console for nome_social shows:

Valor de nome_social:
jsonParser.min.js:17 Tipo de nome_social: string
jsonParser.min.js:17 Código de caracteres nome_social: []length: 0[[Prototype]]: Array(0)

jsonParsermin function:

function loadNomeSocial(id){console.log("Chamando loadNomeSocial com ID:",id),ajaxLoadGET("control/main.php?req=selectNomeSocialByPessoaId&id="+id,parseNomeSocial,".carr");function parseNomeSocial(json,corpo){console.log("Resposta da requisição Nome Social:",json);let objJson=JSON.parse(json);objJson.length>0?$(".nome-social").append(objJson[0].nomesocial):console.log("Nenhum nome social encontrado.")}}

Div where the span is:

<div id="nomeNasc">
    <p>Nome: <span class="nome"> </span></span></p>
    <p>data nascimento: <span id="nasc"></span></p>
    <p>Nome Social: <span id="nome_social"></span></p>
</div>

Laravel project organization [closed]

I’m trying to learn to program with laravel! I would like to understand how to best organize a project.

The project I would like to develop is the following:

Create a web app for a roulette betting strategy.

the strategy is based on the fibonacci sequence (0 1 1 2 3 5 7 12 etc.) so each bet is the sum of the previous two.

but I want to bet on a “column” or “row” of the roulette table only when it hasn’t come out for at least 5 consecutive times.

therefore I have to create a form in which I insert the last number that came out and save it in a sequence of numbers.

from the sequence check how many times each column and row hasn’t come out.

when one of these is not drawn for 5 consecutive times, highlight it as “to bet” and assign the bet 1 of the Fibonacci sequence eg € 1.00

if it is not drawn in the subsequent rounds, increase the bet following the Fibonacci sequence until that column or row is drawn.

at this point the sequence must be reset and you start again from the beginning counting from how many extractions the columns and rows have not come out.

it should not be too complicated but I do not understand how I should manage the models and functions to calculate the columns, rows and the bets following the numbers drawn.

I hope someone can give me some advice.

Thanks

How can be used TagsInput component to store related data using model hasmany relationship?

I have eloquent model to store specific car brand model years:

<?php

namespace AppModels;

use IlluminateDatabaseEloquentBuilder;
use IlluminateDatabaseEloquentModel;

class CarModel extends Model
{
    protected $fillable = ['brand_id', 'name'];

    public function brand()
    {
        return $this->belongsTo(CarBrand::class, 'brand_id');
    }

    public function years()
    {
        return $this->hasMany(CarModelYear::class, 'model_id');
    }

    public function classifications()
    {
        return $this->hasMany(CarClassification::class, 'model_id');
    }

    public function scopeWithCarStats(Builder $query)
    {
        $query->withCount([
            'classifications as totalClassifications',
        ]);

        $carClasses = CarClass::pluck('id');
        foreach ($carClasses as $carClassId) {
            $query->withCount([
                "classifications as car_class_{$carClassId}" => function (Builder $query) use ($carClassId) {
                    $query->where('class_id', $carClassId);
                }
            ]);
        }

        $carYears = CarModelYear::query()
            ->select('year')
            ->distinct()
            ->orderBy('year', 'asc')
            ->pluck('year');

        if($carYears->isNotEmpty()) {
            foreach ($carYears as $year) {
                $query->selectRaw("
                    (SELECT COUNT(*)
                     FROM car_classifications
                     JOIN car_model_years ON car_classifications.year_id = car_model_years.id
                     WHERE car_classifications.model_id = car_models.id
                     AND car_model_years.year = ?) as car_model_year_{$year}
                ", [$year]);
            }
        }
    }
}

class CarModelYear extends Model
{
    protected $fillable = ['model_id', 'year'];

    public function model()
    {
        return $this->belongsTo(CarModel::class, 'model_id');
    }

    public function classifications()
    {
        return $this->hasMany(CarClassification::class, 'year_id');
    }

    public function scopeWithCarStats(Builder $query)
    {
        $query->withCount([
            'classifications as totalClassifications',
        ]);

        $carClasses = CarClass::pluck('id');
        foreach ($carClasses as $carClassId) {
            $query->withCount([
                "classifications as car_class_{$carClassId}" => function (Builder $query) use ($carClassId) {
                    $query->where('class_id', $carClassId);
                }
            ]);
        }
    }
}

Here is my CarModel resource form:

public static function form(Form $form): Form
{
    return $form
        ->schema([
            FormsComponentsSection::make()
                ->columns()
                ->schema([
                    FormsComponentsTextInput::make('name')
                        ->label('Model Name')
                        ->required()
                        ->maxLength(255),
                    FormsComponentsSelect::make('brand_id')
                        ->label('Car Brand')
                        ->relationship('brand', 'name')
                        ->searchable()
                        ->preload()
                        ->required(),
                    FormsComponentsTagsInput::make('years')
                        ->label('Model Years')
                        ->placeholder('Enter model years, example: 2020, 2021, 2022')
                        ->required()
                        ->dehydrated(false)
                        ->unique()
                        ->splitKeys([',', ' '])
                        ->hint('Eneter model years with comma or space'),
                ])
        ]);
}

I tried debugging in CreateCarModel method named mutateFormDataBeforeCreate but not triggered anything:

protected function mutateFormDataBeforeCreate(array $data): array
{
    if(array_key_exists('years', $data)) {
        dd($data['years']);
    }

    return $data;
}

I get error when try create some model with specific years:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'years' in 'where clause' (Connection: mysql, SQL: select count(*) as aggregate from `car_models` where `years` = 2024)

How I can correctly use TagsInput component to store car model years?