Calling a GET variable in a POST function

I wanted to add the $item_id into the ‘bid’ table after clicking on the button.
But the $item_id from the $_GET cannot be passed into the $_POST function.
Is it incorrect to call a variable like this?

Thank you in advance for your help!

<?php 
include ('config/dbfunctions.php'); 
include ("helpers/validateBid.php");

$user_id = "";
$item_id = "";
$table= 'bid';
$allBids = selectAll($table);
$items = selectAll('item');

if (isset($_GET['item_id'])) {
    $itemInfoPost  = selectOne('item', ['item_id' => $_GET['item_id']]);
    $item_id = $itemInfoPost['item_id'];
  } 
  

if(isset($_POST['bid-btn'])){
  
        unset($_POST['bid-btn']);
        $_POST['user_id'] = $_SESSION['user_id'];
        $_POST['item_id'] = $item_id;   //$item_id cannot be called
        $bid_id = create($table, $_POST);   
              
        header('location: itemInfo.php?item_id='."$item_id"); 
}

How to make Comment sysytem [closed]

I’m creating comment and reply system with php and MySQL

  1. I have multiple post
  2. And I have multiple comments of users in different comments

But i facing some problems :

— When user click on one post to see comments then after clicking same comments shown in all different post
Why it’s happening ?

I am try to upload images and video using php is working on localhost but on live server when i checking log file i can’t get any thing from there [closed]

It is working perfectly fine on local but on live server image and video both are not uploading, and i also don’t have the access of the live server to debug things on live. i tried many time logs and many things but nothing working can anyone help me solve this problem.

        $limit = (!empty($_POST['limit']) && is_numeric($_POST['limit']) && $_POST['limit'] > 0 && $_POST['limit'] <= 50 ? Wo_Secure($_POST['limit']) : 20);
    $after_post_id = (!empty($_POST['after_post_id']) && 
 is_numeric($_POST['after_post_id']) && $_POST['after_post_id'] > 0 ? 
   Wo_Secure($_POST['after_post_id']) : 0);

 if (!empty($_POST['type']) && in_array($_POST['type'], $required_fields)) {

if ($_POST['type'] == 'create') {
    if (!empty($_POST['post_id']) && is_numeric($_POST['post_id']) && $_POST['post_id'] > 0) {
        $post_data = Wo_PostData($_POST['post_id']);
        if(empty($post_data)){
            $error_code    = 7;
            $error_message = 'Post not exist.';
        }
        elseif (!empty($_FILES['image']) || !empty($_POST['text'])) {
            $page_id = '';
            if (!empty($_POST['page_id'])) {
                $page_id = $_POST['page_id'];
            }
            $comment_image = '';

            if (isset($_FILES['image']['name'])) {
                $fileInfo = array(
                    'file' => $_FILES["image"]["tmp_name"],
                    'name' => $_FILES['image']['name'],
                    'size' => $_FILES["image"]["size"],
                    'type' => $_FILES["image"]["type"]
                );
               
                $media    = Wo_ShareFile($fileInfo);

                if (!empty($media)) {
                    $comment_image    = $media['filename'];
                }
            }
            if (empty($comment_image) && empty($_POST['text'])) {
                header("Content-type: application/json");
                echo json_encode($data);
                exit();
            }
            $text_comment = '';
            if (!empty($_POST['text']) && !ctype_space($_POST['text'])) {
                $text_comment = $_POST['text'];
            }
            
            $C_Data = array(
                'user_id' => Wo_Secure($wo['user']['user_id']),
                'page_id' => Wo_Secure($page_id),
                'post_id' => Wo_Secure($_POST['post_id']),
                'text' => Wo_Secure($_POST['text']),
                'c_file' => Wo_Secure($comment_image),
                'time' => time()
            );
           
            
            
            $R_Comment     = Wo_RegisterPostComment($C_Data);
            $comment       = Wo_GetPostComment($R_Comment);
            
            if (!empty($comment['publisher'])) {
                foreach ($non_allowed as $key4 => $value4) {
                  unset($comment['publisher'][$value4]);
                }
            }
            if (!empty($text_comment)) {
                $comment['text'] = $text_comment;
            }
            if (empty($comment['replies'])) {
                $comment['replies'] = 0;
            }
            
            $response_data = array(
                                    'api_status' => 200,
                                    'data' => $comment
                                );

                                $tmp_test_array = array(
                                    'fileinfo' => json_encode($fileInfo),
                                    'comment_image' => json_encode($comment_image),
                                    'text' => json_encode($text_comment),
                                    'c_data' => json_encode($C_Data),
                                    'R_commment' => json_encode($R_Comment),
                                    'comment' => json_encode($comment),
                                    'response' => json_encode($response_data),
                                    'media' => json_encode($media)
                 
                                );
                                hasAccess($tmp_test_array);

        }
        else{
            $error_code    = 5;
            $error_message = 'Please check your details.';
        }
    }
    else{
        $error_code    = 6;
        $error_message = 'post_id can not be empty.';
    }
}

here is my code please help me to figure out the solution of the problem.

Giới thiệu phòng khám đa khoa Đông Phương

Phòng khám đa khoa Đông Phương có đại chỉ tại số 497 La Kê – Hà Đông – Hà Nội, được sở y tế cấp phép hoạt động dưới mô hình phòng khám đa khoa với các lình vực chuyên môn về nam khoa, phụ khoa, bệnh xã hội, Da liễu…Với đội ngũ bác sĩ đều là những chuyên gia đầu ngành với nhiều năm kinh nghiệm công tác tại những bệnh viện lớn tuyến trung ương ở Hà Nội. Phòng khám tự hào là đơn vị mang đến dịch vụ y tế chất lượng cao với chi phí khám chữa bệnh theo quy định của sở y tế, được niêm yết công khai..

Woocommerce Phone Validation On My Account Page [duplicate]

I found the code snippet below to check the phone number from a blog on the internet and it works quite nicely.

  • Thanks to the code, we limit the phone number to a maximum and minimum of 11 digits. (We cannot place an order if the number is incomplete.)
  • We require the phone number to start with “05”.
  • We are able to show a guiding error message in case of any problem.

While the code works great on the checkout page in every way, it doesn’t work on the my account page.

How can I get this code to work on my account page as well?

Waiting for your help, I wish you all a good day.

// Limit Woocommerce phone field to 11 digits number
add_action('woocommerce_checkout_process', 'njengah_custom_checkout_field_process');
function njengah_custom_checkout_field_process() {
global $woocommerce;
// Check if set, if its not set add an error. This one is only requite for companies
if ( ! (preg_match('/^05[0-9]{9}$/', $_POST['billing_phone'] ))){
wc_add_notice( "Wrong Phone Number Format" ,'error' );
}
}

Symonfy Frontend not loading loading evenly even “wobbling”

I am facing a really strange behavour on a Symfony v4.4 MVC Application. The Frontend is made with twig rendering engine.

If you scroll down fast, the browser has problems with building the DOM properly.

Here is a link to the current version:

preview link

I think its even worser on Safari. On Chrome its a little bit better but also not good.
If any Symfony, Php, Twig expert has any idea, what i am missing or what could cause this weird behavour i would be very thankful!

Find Logic from String using Regex

i want to get logic from string that what from input string. For example:
Input:

pageType == "static" OR pageType == "item" AND pageRef == "index"

How to i get logic like:

0 => pageType == "static"
1 => pageType == "item"
2 => pageRef == "index"

The logic clause must be complete based on what is entered.

I place like this:

$input = 'pageType == "static" OR pageType == "item" AND pageRef == "index"';
preg_match_all('/(.+)(?!AND|OR)(.+)/s', $input, $loX);
var_dump($loX);

but the array just show:

0 => pageType == "static" OR pageType == "item" AND pageRef == "index"
1 => pageType == "static" OR pageType == "item" AND pageRef == "index
2 => "

Please help me, thanks ^_^

Attempt to read property “view” on null when sending password reset email

I am trying to build password reset functionality but with a custom email template. So instead of returning the MailMessage from the notification I can sending my own custom mail.

Sending the email is working but the problem is in postman I get a 500 with this error

 "message": "Attempt to read property "view" on null",
    "exception": "ErrorException",
    "file": "/home/vagrant/api/vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php",
    "line": 92

Here is my code

Password reset method in my controller

public function sendResetPasswordLink(SendResetPasswordLinkRequest $request)
{
    $status = Password::sendResetLink($request->only('email'));

    if($status == Password::RESET_LINK_SENT) {
        return "work";
    }
}

sendPasswordResetNotification method in User model

public function sendPasswordResetNotification($token) 
{
    IlluminateSupportFacadesLog::info('sendPasswordResetNotification ran');
    $url = $this->clientBaseUrl . '/reset-password/' . $token;

    $this->notify(new ResetPasswordNotification(request('email'), $url));
}

toMail method in ResetPasswordNotification class

 public function toMail($notifiable)
    {
        return Mail::to($this->email)->send(new ResetPasswordMail($this->url));
    }

Then is the ResetPasswordMail class I simply return the view in the build method

public function build()
{
    return $this->markdown('emails.reset-password')->subject('Welcome to Walor!');
}

So I am getting an email with this template but in postman I am getting a 500 with the error on the top

Function name must be string

Fatal error: Uncaught Error: Function name must be a string in
C:xampphtdocschatboxindex.php:5 Stack trace: #0 {main} thrown in
C:xampphtdocschatboxindex.php on line 5

    <?
    if(isset($_GET()["userId"]))
    {
        $_SESSION["userId"] = $_GET["userId"];
        header("location: chatbox.php");
    }
    ?>

Images are not displaying using DOMPDF library [duplicate]

Below is my PHP code to convert HTML into PDF, but images are not displaying under PDF. I tried to use both local paths as well as server URLs as well, both are not displaying images under PDF.

<?php

use DompdfOptions;
//add autoload.inc.php
require_once "./dompdf/autoload.inc.php";
$options = new Options();
$options->set('isRemoteEnabled', true);

// reference the Dompdf namespace
use DompdfDompdf;

// instantiate and use the dompdf class
$dompdf = new Dompdf();

//$dompdf->loadHtml($html);
$page = file_get_contents("certificate.html");
$dompdf->loadHtml($page);

// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');

// Render the HTML as PDF
$dompdf->render();

// Output the generated PDF to Browser
$dompdf->stream("training-certificate", array("Attachments"=>0));
?>

Below is my HTML file code:

<style> 
   div.background {
      background: #ffffff;
      border: 5px solid black;
      margin: 10px;
    }
    
    div.transbox {
      margin: 3px;
      background-color: #ffffff;
      border: 1px solid black;
    }
    
    div.transbox p {
      margin: 4%;
      color: #000000;
    }
    #middle {
      margin: 5px;
      background-color: #ffffff;
      border: 1px solid #fff;
    }
    body{
       background-color: #f6f6f6;
    }
    .logowhite{
     float: right;
    }
    .logo {
       clear: right;
       text-align: center;
   }
      </style><link href="https://vip-organon-us-hcp-com-develop.go-vip.net/nexplanontraining/wp-content/themes/twentytwentyone-child/assets/css/font-awesome.min.css" media="all" type="text/css" rel="stylesheet"/>
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"/>
   <link href="https://vip-organon-us-hcp-com-develop.go-vip.net/nexplanontraining/wp-content/themes/twentytwentyone-child/assets/css/main.min2.css" media="all" type="text/css" rel="stylesheet"/>         
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script><body id="thank-you" class="base"><div id="middle">
   <div class="background">
      <div class="transbox">
         <div  class="logowhite"> <img src="https://vip-organon-us-hcp-com-develop.go-vip.net/nexplanontraining/wp-content/uploads/sites/2/2022/03/org_logo.png" alt="" /></div> 
         <div class="logo"> <img src="https://vip-organon-us-hcp-com-develop.go-vip.net/nexplanontraining/wp-content/uploads/sites/2/2022/03/nexplanon_logo.png" alt="" />  
           <p style="font-size:2rem;color:#00F;text-transform: uppercase;">'.$fname.' '.$lname.'</p> 
           <p style="font-size: 1.25rem;">This certificate serves as confirmation of the completion of the Mandatory Training Module<BR>
             on the updated insertion and removal procedures for NEXPLANON.</p> 
            
             <div style="width: 80%;margin: auto;"> 
               <p style="float: left;font-size: 1.25rem;"><B>Training Date:</B> <span style="color: #00F;">'.$date.'</span> </p>
               <img style="float: right;" src="https://vip-organon-us-hcp-com-develop.go-vip.net/nexplanontraining/wp-content/uploads/sites/2/2022/03/signature.png" alt="" />   </div>
           
           </div>
   
      <p style="clear: both;margin-bottom: 0%;"><BR>I attested that I completed the Organon-sponsored Mandatory Training Module on the updated insertion and removal procedures for NEXPLANON in its entirety. I understand that only healthcare providers who have completed the
       Organon-sponsored Clinical Training Program for NEXPLANON may order, insert, and remove NEXPLANON.<BR><BR>
       I certified that I am authorized to perform the procedures entailed in the insertion and removal of NEXPLANON in the
       jurisdiction where I practice. I attest that if there are specific state requirements in the state where I practice, I have met all appropriate state conditions including but not limited to collaborative or signing agreement with an MD/DO.<BR><BR>
       If I am a resident or student in advanced practice training, I understand that I should only administer NEXPLANON under the supervision of an attending healthcare provider who has also been trained on the procedures to insert and
       remove NEXPLANON.</p>
     
      <div style="margin-bottom: -2%;">
      <p style="font-size: 0.7rem;float: left;">© 2021 Organon group of companies. All rights reserved. ORGANON and the ORGANON Logo are trademarks of the Organon group of companies.</p>
      <p style="float: right;font-size: 0.7rem;">US-XPL-115639 12/21</p>
     <p style="clear: both;margin-bottom: 0%;"> </p>
     </div>
      
     
     </div>
   </div>
   </div></body>

Please suggest, I already tried the TCPDF library as well but there are some very limited CSS that’s why I am using DOMPDF for now.

Prevent PHP exec timeout without changing timeout limit

I’m currently working on a big scapping project so i use a main big php script to run all of my scrapping (over 150 websites) the script take around 5-8h to run.

So in my main script i have a foreach who run a exec(‘php -f …’) who run the scraping for one website.

I would prevent some crash of this php exec because when i have multiples timeout the script crashing and don’t continue so maybe i can replace :

echo exec('php -f ...');

by :

try{
    echo exec('php -f ...');
}catch(Exception $e){
    // i will put a log here
    continue;
}

But i think it’s not working with timeout (fatal error), so what is the best option to run all of my scripts without crash stop it ?

Thanks !

How can i pass a custom css class in a generated checkbox List with Yii2 form field?

As per question’s title, I am strugling to pass a custom css class on each generated checkbox list using Yii2 form field.

Here is my function:

 public function getItems()
    {
        $items = [];
        
        foreach (explode("n", $this->options) as $option) {
            if (strpos($option, '=>') !== false) {
                list($key, $value) = explode('=>', $option);
                $items[trim($key)] = Yii::t($this->propertyField->language_category, trim($value));
            } else {
                $items[] = Yii::t($this->propertyField->language_category, trim($option));
            }
        }

        return $items;
    } 

As it is now i get this list:

<div class="form-group field-propertyfields">
<label class="form-label">Property Amenities</label>
<div id="propertyfields-7" class="multiselect-checkboxes">
<label><input type="checkbox" name="propertyFields[7][]" value="1">Elevator</label>
<label><input type="checkbox" name="propertyFields[7][]" value="2">Parking</label>
<label><input type="checkbox" name="propertyFields[7][]" value="3">Fireplace</label>
</div>  
</div>

What i want is to add a custom class on each label of input so it look like this:

<label class="my-custom-class"><input type="checkbox" name="propertyFields[7][]"value="2">Parking</label>