Call list from another php file

I have the following code now I want Import or call d1 d2 d3 from another file

   private $dlist = [
         "d1; d2","d3",
    ];

For example,

  private $dlist = [
             "('/wp-content/to/d.php');
        ];

or

  private $dlist = [
             "('**otherdomain.com**/wp-content/to/d.php');
        ];

Foreach loop won’t work on array, returns only the first value

Here is my code;

$curl = curl_init();        
        curl_setopt_array($curl, array(
            CURLOPT_URL => "https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies.json",
        CURLOPT_HTTPHEADER => array(
            "Content-Type: text/plain"
            
        ),
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "GET"
        ));

        $response = curl_exec($curl);
        curl_close($curl);
        $response = json_decode($response, true);

        
        

        foreach ($response as $code => $name ) {
            
            
            $currency = new Currency();
            $currency->currency_code = $code;
            $currency->currency_name = $name;
            $save = $currency->save();
            
        }

If I dd($response), it returns all the arrays but when i use foreach loop, it will only save the first value of the array rather than all the values in the array.

This is a repost of the original question.

The Mix manifest does not exist. (View: /media/Disk2/project1/resources/views/projects/assets.blade.php)

The manifest-json file exist in /public/manifest-json.js, but application shows the error like

The Mix manifest does not exist. (View: >/media/Disk2/project1/resources/views/projects/assets.blade.php)

In my resources/views/projects/assets.blade.php file,

 <link rel="stylesheet" href="{{ mix('styles/style.scss', 'pc') }}" media="screen,print">

The style.scss file located in resources/assets/pc/styles/ folder
And in the webpack.mix.pc.js

const { mix } = require('laravel-mix');


mix.webpackConfig({
    resolve: {
        modules: [
            path.resolve('./resources/assets'),
            path.resolve('./node_modules')
        ]
    }
})

mix.setPublicPath('public/pc');

mix.js('resources/assets/pc/scripts/orgs.js', 'scripts')
    .
    .
    .
    .extract([
        'babel-polyfill',
        'vue',
        'axios',
        'vue-router',
        'qs',
        'intersection-observer',
        'element-ui',
        'twemoji'
    ])
    .sass('resources/assets/pc/styles/style.scss', 'styles');

Laravel Framework version : 5.6.40
AND the same project worked on windows machine,only Linux machine has the error

I tried the following methods but none of them worked to me.

npm install laravel-mix@latest --save-dev
php artisan vendor:publish --tag=telescope-assets --force
npm install & npm run dev

using cropper.js after PHP upload doesn’t work

I’m a learning student who is making a picture upload feature with HTML, CSS, JS, and PHP.
My final goal is to make a profile picture upload feature with cropping.
I found cropper.js would be a good tool for my idea, so I decided to use this.

And also, I found cropper.js is available to use with sweetalert2 that I’ve used to. official document(Sweetalert2 + cropper.js)

So I built the code that inspects file validity and uploads the raw file and loads that again to crop. But I couldn’t use the feature of cropper.js and received a strange warning from the browser console that is SweetAlert2: Unknown parameter "willOpen".
(Every valid image could be uploaded without any error, but the image was shown but the draggable cropping bar did not show so I couldn’t crop any image.)

Here is my code that the problem has occurred.
This code inspects whether the uploaded file is allowable and uploads that, and loads that file again to crop with cropper.js(now problem has occurred at that point.).

<html>

    <head>

        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Change profile picture</title>
        <link rel="stylesheet" href="../../../css/font.css">
        <link rel="shortcut icon" href="../../../favicon/favicon.ico">

        <link rel="stylesheet" href="./css/uploadProfilePicture.css">

        <?php include('../../../common/resource.html'); ?>

        <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cropper.js"></script>
        <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/cropper.css" rel="stylesheet">


    </head>

    <body>

    </body>

</html>

<style>
    #cropperjs {
        display: block;
        max-width: 100%;
    }

    #preview {
        width: 200px;
        height: 200px;
        margin-bottom: 10px;
        border-radius: 100%;
    }

</style>

<?php

    session_start();
    header('Content-Type: text/html; charset=utf-8');

    if(!isset($_FILES)) {

        ?>
            <script>
                Swal.fire({
                    icon: 'error',
                    title: ':/',
                    footer: 'The file did not uploaded'
                }).then((result) => {
                    location.href = "./uploadProfilePicture.php";
                })
            </script>
        <?php       

        die();

    }

    $tempFile = $_FILES['profileImage']['tmp_name'];

    $fileTypeExtension = explode("/", $_FILES['profileImage']['type']);
    $fileType = $fileTypeExtension[0];
    $fileExtension = $fileTypeExtension[1];

    $isExtensionAllowable = false;


    switch($fileExtension){
        case 'jpeg':
        case 'jpg':
        case 'gif':
        case 'bmp':
        case 'png':
            $isExtensionAllowable = true;
            break;
        
        default:
            ?>
                <script>
                    Swal.fire({
                        icon: 'error',
                        title: 'error',
                        footer: 'Only pictures(jpeg, jpg, gif, bmp, png) can be uploaded'
                    }).then((result) => {
                        location.href = "./uploadProfilePicture.php";
                    })
                </script>
            <?php

            exit;
            die();
    }

    if($fileType === "image"){

        if($isExtensionAllowable === true) {

            // allowable
            try {

                $savePath = "../../../asset/userdata/profilePicture/{$_SESSION['id']}.png";
                move_uploaded_file($tempFile, $savePath);

                // cropper.js ?

            } catch (Exception $err) {
                die($err -> getMessage());
            }

            ?>

            <script>
                
                Swal.fire({
                    title: 'edit profile picture',
                    html: `
                        <img id="preview" src="<?php echo $savePath ?>">
                        <div>
                            <img id="cropperjs" src="<?php echo $savePath ?>">
                        </div>
                    `,
                    willOpen: () => {
                        const image = Swal.getPopup().querySelector('#cropperjs')
                        const cropper = new Cropper(image, {
                            aspectRatio: 1,
                            viewMode: 1,
                            crop: throttle(function () {
                                const croppedCanvas = cropper.getCroppedCanvas()
                                const preview = Swal.getHtmlContainer().querySelector('#preview')
                                preview.src = croppedCanvas.toDataURL()
                            }, 25)
                        });
                    },
                    preConfirm: () => {
                        return Swal.getHtmlContainer().querySelector('#preview').src
                    }
                })
            </script>

            <?php

        } 

    } else {
        
        ?>
            <script>
                Swal.fire({
                    icon: 'error',
                    title: 'not image!!',
                }).then((result) => {
                    location.href = "./uploadProfilePicture.php";
                })
            </script>
        <?php
    }

?>

In addition, the content of resource.html is here. It contains some external JS/CSS links to use at my page and there was no problem to load.

<!-- bootstrap -->

<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
    integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
    integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous">
</script>
<!-- end of bootstrap-->

<!-- Bootstrap icon -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<!-- end of Bootstrap icon -->

<!-- toastr.js -->
<link rel="stylesheet" type="text/css"
    href="http://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<!-- end of toastr.js -->

<!-- sweetalert -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
<!-- end of sweetalert -->

I need help to figure out the point to be fixed or what I have to do to reach my goal(I think my thought to implement my goal might be wrong.).

Do you have any ideas? It hasn’t been long since I’ve experienced this part, so it’s very hard to me.

Thanks in advance.

Laravel: it is security issue to show expiration in signed url?

How laravel works with expiration in signed URLs? Is the expiration protected in any way against manual overwriting?

I generate confirmation emails in my laravel application that have a limited usage time.
Is it possible, when rewriting the expiration parameter in url, to convince laravel that the url has not yet expired?
My generated url is here:

http://localhost/register/confirm/19?expires=1654334707&signature=2e44bb1c17bab475bbffb442316ad932723ba50376db6d75cb0c2fe2675d5535

setting width and height of image in codeigniter php not working

i have a codeigniter website where user can upload multiple images, i want all the images to be of the same size, i have done the following code in controller:

if (isset($_POST['addblog'])) {
    $this->load->library('upload');
    $image = array();
    $ImageCount = count($_FILES['image_name']['name']);

    for ($i = 0; $i < $ImageCount; $i++) {
        $_FILES['file']['name'] = $_FILES['image_name']['name'][$i];
        $_FILES['file']['type'] = $_FILES['image_name']['type'][$i];
        $_FILES['file']['tmp_name'] = $_FILES['image_name']['tmp_name'][$i];
        $_FILES['file']['error'] = $_FILES['image_name']['error'][$i];
        $_FILES['file']['size'] = $_FILES['image_name']['size'][$i];

        $uploadPath = './uploads/blog/';
        $config['upload_path'] = $uploadPath;
        $config['allowed_types'] = 'jpg|jpeg|png|gif';
        $config['width'] = 200;
        $config['height'] = 250;

        $this->load->library('upload', $config);
        $this->upload->initialize($config);

        if ($this->upload->do_upload('file')) {

            $imageData = $this->upload->data();

            $uploadImgData[] = $imageData['file_name'];
        }
    }
    $blogimage = $uploadImgData;
}

as u can see i have set the height and width in config, the images are still uploaded in ther original size, can anyone please tell me what is wrong in here, thanks in advance

regex route filters some /string after slug url

i want just allow string /more /next & /1 after the slug
ex :

this is what i’ve try :

/([a-z0-9]+)([A-Za-z-0-9]+)(.*)[/]{0,1}(more|next|[0-9]+){0,1}[/]{0,1}

the regex is still work when i open the page like https://loremipsum.com/post/hello-world/sdfsdfsdf
note i use (.*) on the regex for allowing any character on the slug so it will automaticly redirect.

How to customize bank details styles in Woocommerce order emails?

This section within Woocommerce order emails comes from the code in woocommerce/includes/gateways/class-wc-gateway-bacs.php

     /**
     * Get bank details and place into a list format.
     *
     * @param int $order_id Order ID.
     */
    private function bank_details( $order_id = '' ) {

        if ( empty( $this->account_details ) ) {
            return;
        }

        // Get order and store in $order.
        $order = wc_get_order( $order_id );

        // Get the order country and country $locale.
        $country = $order->get_billing_country();
        $locale  = $this->get_country_locale();

        // Get sortcode label in the $locale array and use appropriate one.
        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'woocommerce' );

        $bacs_accounts = apply_filters( 'woocommerce_bacs_accounts', $this->account_details, $order_id );

        if ( ! empty( $bacs_accounts ) ) {
            $account_html = '';
            $has_details  = false;

            foreach ( $bacs_accounts as $bacs_account ) {
                $bacs_account = (object) $bacs_account;

                if ( $bacs_account->account_name ) {
                    $account_html .= '<h3 class="wc-bacs-bank-details-account-name">' . wp_kses_post( wp_unslash( $bacs_account->account_name ) ) . ':</h3>' . PHP_EOL;
                }

                $account_html .= '<ul class="wc-bacs-bank-details order_details bacs_details">' . PHP_EOL;

                // BACS account fields shown on the thanks page and in emails.
                $account_fields = apply_filters(
                    'woocommerce_bacs_account_fields',
                    array(
                        'bank_name'      => array(
                            'label' => __( 'Bank', 'woocommerce' ),
                            'value' => $bacs_account->bank_name,
                        ),
                        'account_number' => array(
                            'label' => __( 'Account number', 'woocommerce' ),
                            'value' => $bacs_account->account_number,
                        ),
                        'sort_code'      => array(
                            'label' => $sortcode,
                            'value' => $bacs_account->sort_code,
                        ),
                        'iban'           => array(
                            'label' => __( 'IBAN', 'woocommerce' ),
                            'value' => $bacs_account->iban,
                        ),
                        'bic'            => array(
                            'label' => __( 'BIC', 'woocommerce' ),
                            'value' => $bacs_account->bic,
                        ),
                    ),
                    $order_id
                );

                foreach ( $account_fields as $field_key => $field ) {
                    if ( ! empty( $field['value'] ) ) {
                        $account_html .= '<li class="' . esc_attr( $field_key ) . '">' . wp_kses_post( $field['label'] ) . ': <strong>' . wp_kses_post( wptexturize( $field['value'] ) ) . '</strong></li>' . PHP_EOL;
                        $has_details   = true;
                    }
                }

                $account_html .= '</ul>';
            }

            if ( $has_details ) {
                echo '<section class="woocommerce-bacs-bank-details"><h2 class="wc-bacs-bank-details-heading">' . esc_html__( 'Our bank details', 'woocommerce' ) . '</h2>' . wp_kses_post( PHP_EOL . $account_html ) . '</section>';
            }
        }

    }

How can I override this section styles (headings + list) without it affecting all headings as recommended here: How to stylize bank details in WooCommerce email?

Any help appreciated.

jasmin gateway create and config smpp server

I have 2 Jasmin installed on 2 different server

then I have Jasmin 1 and Jasmin 2

I want to create smpp server on Jasmin 1, then put Jasmin 1 smpp info in Jasmin 2 on the other server then when I send SMS with Jasmin 2 the SMS send to Jasmin 1 over smpp and monitoring incoming sms

I do it like this

https://docs.jasminsms.com/en/latest/apis/smpp-server/index.html

but I get an error : Unable to connect to host IP:2275

simple way to create multiple flash message in laravel-9

is there any way to simplify these three line to create multiple flash message?

session()->flash('status', 'error');
session()->flash('title', 'test title');
session()->flash('message', 'test message');

i tried this but does not work

return view('panel.codes.CodeCrud.create', [
   'categories' => collect(),
   'cards' => collect(),
])->with([
   'status' => 'error',
   'title' => 'test title',
   'message' => 'test message',
]);

Is there a backwards version of a turnery operator in php?

I am trying to assign some value to one array if a condition is true otherwise I want to assign it to another array. I know this is possible with an if statement. However, I am wondering if it can be done with the syntax of a turnery operator?

Using an if statement it would look like this

        if(condition){
            $foo[] = $value;
        } else{
            $bar[] = $value;
        }

However, my question is if it is possible to write it similar to this?

        ((condition) ? ($foo[]) : ($bar[])) = $value;

Troubleshooting require_once error (on Composer + WordPress Plugin)

I’ve developed a WordPress Plugin using Composer as Dependency Manager (I’m not a php dev, hope this is the correct naming). When trying to activate the plugin I was getting errors about require_once not finding files.

Warning: require(/home/251650.cloudwaysapps.com/geytjjwugd/public_html/wp-content/plugins/gik25-microdata/vendor/composer/../phpunit/phpunit/src/Framework/Assert/Functions.php): failed to open stream: No such file or directory in /home/251650.cloudwaysapps.com/geytjjwugd/public_html/wp-content/plugins/gik25-microdata/vendor/composer/autoload_real.php on line 55

Fatal error: require(): Failed opening required '/home/geytjjwugd/public_html/wp-content/plugins/gik25-microdata/vendor/composer/../phpunit/phpunit/src/Framework/Assert/Functions.php' (include_path='.:/usr/share/php') in /home/geytjjwugd/public_html/wp-content/plugins/gik25-microdata/vendor/composer/autoload_real.php on line 55

I tried to debug it through my (low) PHP skills (the file was there), I tried to reset the file permission and, last attempt, I tried to execute Composer direclty through SSH. It worked and I’d like to understand HOW!

Doing php composer.phar update after cleaning the vendor folder resulted in the deletion of many subfolders.

enter image description here

May unused folder in vendor have any relation with autoloading not working?

I also removed Phpunit 10 from the composer.json file BEFORE running composer update and it didn’t solve my issue until I did the composer update.

enter image description here

I see the buggest change in composer.lock file. 1500 lines disappeared.

But the changes don’t relate to PHP code, how can they broke the PHP execution? There is no change in the autoload.php.

How to write the code To update the selected date value in mysql db & php without refresh the page or redirect to another page [closed]

How to write the code

If I click the edit button it needs to update the selected date value in MySQL DB & PHP without refreshing the page or redirecting to another page
I try this but it not working:

<td>
    <input style="color: black;" name="datef" type="date" id="datef"  value="<?php echo $af['datef']; ?>"> <a class="btn btn-success" href="date.php?id=<?php echo $af['id'];?>&datef=<?php echo $af['datef']; ?>" target="_blank" >edit</a>
</td>

i need to update the value in the date which I have rounded