I am looking for a RFID door locking device in Gulf region , that can provide its complete documentation and user guidelines, if it is getting integrated with PHP/Laravel based project.
I tried using ASAA,Orbita RFID system but I couldn’t get proper implementation guide to make it work with my project. They are just offering device technical details, not implementation guidelines, like an api or sdk.
Category: PHP
Category Added in a WPeMatico Campaign
e-commerce website individualized profiles
I’m creating an e-commerce website for local businesses here, where in my admin panel i can add a new business or store, and the store owner can access his admin page and start adding products of his store, then users can shop and buy from there, i’m not using any front end frameworks, just html css (bootstrap), javascript (jquery), and i use php/mysql for my backend and hostinger for hosting. I don’t want to do subdomains for each store, i want to do it like this:
mysite.com/store/storename/home, what is the best practice here? should i use url variables to define every store and fetch data for it? for example :
mysite.com/store/storename/home?id=231&item=234xw1 ,
if not, how do you advise me to do it? after i have all the data to show for users. what is the best way?
if i have to read about something, please tell me. and thanks!!
Can’t install Sylius starter project
I’d like to create a Sylius project but I can’t install the initial project following the instructions in the documentation.
the command compose
compose create-project sylius/sylius-standard MyFirstShop
works but when I create .env.local which contains :
DATABASE_URL=mysql://root@localhost/my_project?serverVersion=8
then I run the command :
php bin/console sylius:install this is where the installation crashes.
I have the following error :
then I create the database on phpmyadmin then I re-run the command with the database created but empty:
I tried to launch the creation of the database with doctrine and then do the migration but still the same as the image above.
Someone who has already had the same problem 🙁
WordPress 403 Forbidden & Additionally, a internal 500 server error
I configured a WordPress project on AWS EC2 with Ubuntu. Initially, it worked fine. then, we added a domain address to WordPress following Apache server configuration. The issue arose when the home page displayed without errors, but clicking on sub-pages resulted in a “Not Found” error, indicating that the requested URL was not found.
To address this problem, we made changes to the Apache2 configuration by executing the command a2enmod rewrite, which resolved the issue. However new problems emerged after some time. The server would occasionally go down, displaying a “403 Forbidden” error, and on the admin side, a “500 Internal Server Error” occurred. As well as the behavior varied between browsers – if the site worked in Chrome, it might not work in Firefox, and vice versa. This error persisted intermittently.
I checked the .htaccess file, file permissions, documented server configuration, error logs, and access logs disable-plugins. However, no errors were found in these logs. Despite trying various methods and attempts, the issue persists and remains unresolved
Have a problem editing my database. It wont change data when I edit it on webpage
New to PHP. I’m making a web application. I was trying to make some editable tables in which you can change data directly and those changes then would be saved in database. Found some solutions on net, but I have trouble implement it. Can’t find where I’m wrong. Appreciate any help.
This is my PHP code with editable tables:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="author" content="Slavoljub">
<meta name="description" content="Sajt za obradu podataka na farmama">
<title>Prasence</title>
<link rel="icon" href="./img/pigicon.png" type="image/png" sizes="16x16">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@500&family=Titan+One&display=swap" rel="stylesheet">
<!-- Uključuje jQuery i BootStrap -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="jquery.tabledit.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.9.4/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<link rel="stylesheet" href="css/stilovi.css"/>
</head>
<body>
<header>
<h1>Prasence</h1>
<div class="login">
<a class="prijava" href="login.php">Prijava</a>
<a class="prijava" href="signUp.php">Registracija</a>
</div>
</header>
<nav>
<div class="navig">
<a href="index.php">Početna</a>
<a href="sow.php">Krmače</a>
<a href="barn.php">Štale</a>
<a href="data.php">Podaci</a>
</div>
</nav>
<div class="container">
<?php
session_start();
include "connection.php";
if (isset($_SESSION["user_id"])) {
$userId = $_SESSION["user_id"];
if (isset($_POST["farrowAll"])) {
$sql = "SELECT sowNumber, cycleNumber, penNumber, pigletBornNumber, livePigletBorn, farrowingDate FROM farrowing WHERE userId = '$userId'";
$result = $mysqli->query($sql);
if ($result) {
echo '<table id="data_table" class="table table-striped">';
echo '<tr>
<th>Korisnik</th>
<th>Broj krmače</th>
<th>Broj ciklusa</th>
<th>Broj boksa</th>
<th>Broj prasadi pri rođenju</th>
<th>Broj žive prasadi pri rođenju</th>
<th>Datum prašenja</th>
</tr>';
$totalPigletBorn = 0; // Inicijalizacija varijable za ukupan broj prasadi
$totalLivePigletBorn = 0;
while ($row = $result->fetch_assoc()) {
echo '<tr>';
echo '<td>' . $userId . '</td>';
echo '<td>' . $row['sowNumber'] . '</td>';
echo '<td>' . $row['cycleNumber'] . '</td>';
echo '<td>' . $row['penNumber'] . '</td>';
echo '<td>' . $row['pigletBornNumber'] . '</td>';
echo '<td>' . $row['livePigletBorn'] . '</td>';
echo '<td>' . $row['farrowingDate'] . '</td>';
echo '</tr>';
$totalPigletBorn += $row['pigletBornNumber'];
$totalLivePigletBorn += $row['livePigletBorn'];
}
// Prikazuje ukupan broj prasadi ispod tabele
echo '<tr>';
echo '<td colspan="3"></td>';
echo '<td>Total : ' . $totalPigletBorn . '</td>';
echo '<td>Total : ' . $totalLivePigletBorn . '</td>';
echo '<td colspan="2"></td>';
echo '</tr>';
echo '</table>';
$result->close();
} else {
echo "Greška pri izvršavanju upita: " . $mysqli->error;
}
} else if (isset($_POST["farrowCurrent"])) {
$sql = "SELECT sowNumber, cycleNumber, penNumber, pigletBornNumber, livePigletBorn, farrowingDate FROM farrowing WHERE userId = '$userId' AND currentInFarrHouse = 1";
$result = $mysqli->query($sql);
if ($result) {
echo '<table id="data_table" class="table table-striped">';
echo '<tr>
<th>Korisnik</th>
<th>Broj krmače</th>
<th>Broj ciklusa</th>
<th>Broj boksa</th>
<th>Broj prasadi pri rođenju</th>
<th>Broj žive prasadi pri rođenju</th>
<th>Datum prašenja</th>
</tr>';
$totalPigletBorn = 0; // Inicijalizacija varijable za ukupan broj prasadi
$totalLivePigletBorn = 0;
while ($row = $result->fetch_assoc()) {
echo '<tr>';
echo '<td>' . $userId . '</td>';
echo '<td>' . $row['sowNumber'] . '</td>';
echo '<td>' . $row['cycleNumber'] . '</td>';
echo '<td>' . $row['penNumber'] . '</td>';
echo '<td>' . $row['pigletBornNumber'] . '</td>';
echo '<td>' . $row['livePigletBorn'] . '</td>';
echo '<td>' . $row['farrowingDate'] . '</td>';
echo '</tr>';
$totalPigletBorn += $row['pigletBornNumber'];
$totalLivePigletBorn += $row['livePigletBorn'];
}
// Prikazuje ukupan broj prasadi ispod tabele
echo '<tr>';
echo '<td colspan="3"></td>';
echo '<td>Total : ' . $totalPigletBorn . '</td>';
echo '<td>Total : ' . $totalLivePigletBorn . '</td>';
echo '<td colspan="2"></td>';
echo '</tr>';
echo '</table>';
$result->close();
} else {
echo "Error executing the SQL query: " . $mysqli->error;
}
} else {
echo "Greška pri unosu podataka";
}
} else {
echo "Morate se ulogovati kako biste unosili podatke";
}
?>
</div>
<script type="text/javascript" src="custom_table_edit.js"></script>
</body>
</html>
There is javascript file I linked in head section:
<script type="text/javascript" src="jquery.tabledit.js"></script>
Other javascript file is , and there is the code:
$(document).ready(function () {
$("#data_table").Tabledit({
deleteButton: false,
editButton: false,
columns: {
identifier: [0, "userId"],
editable: [
[1, "sowNumber"],
[2, "cycleNumber"],
[3, "penNumber"],
[4, "sectionNumber"],
[5, "pigletBornNumber"],
[6, "livePigletBorn"],
[7, "farrowingDate"],
],
},
hideIdentifier: true,
url: "live_edit.php",
});
});
Here is the code for live_edit.php file:
<?php
session_start();
include_once("connection.php");
$input = filter_input_array(INPUT_POST);
if ($input['action'] == 'edit') {
$update_field = '';
if (isset($input['userId'])) {
$update_field .= "userId='" . $input['userId'] . "'";
} else if (isset($input['sowNumber'])) {
$update_field .= "sowNumber='" . $input['sowNumber'] . "'";
} else if (isset($input['cycleNumber'])) {
$update_field .= "cycleNumber='" . $input['cycleNumber'] . "'";
} else if (isset($input['penNumber'])) {
$update_field .= "penNumber='" . $input['penNumber'] . "'";
} else if (isset($input['sectionNumber'])) {
$update_field .= "sectionNumber='" . $input['sectionNumber'] . "'";
} else if (isset($input['pigletBornNumber'])) {
$update_field .= "pigletBornNumber='" . $input['pigletBornNumber'] . "'";
} else if (isset($input['livePigletBorn'])) {
$update_field .= "livePigletBorn='" . $input['livePigletBorn'] . "'";
} else if (isset($input['farrowingDate'])) {
$update_field .= "farrowingDate='" . $input['farrowingDate'] . "'";
}
if ($update_field && $input['id']) {
$sql_query = "UPDATE farrowing SET $update_field WHERE userId='" . $input['userId'] . "'";
$result = $mysqli->query($sql_query);
if (!$result) {
echo "Error executing the SQL query: " . $mysqli->error;
die("database error:" . $mysqli->error);
}
}
}
?>
It wont update the database
Filamentphp keyValue field not storing or fetching json correctly
I am trying to make use of filaments KeyValue field, but I must surely be missing something as the storing or fetching of the json data is not displaying in the field as expected. Please see the attached image.
My Migration
$table->json('fields')->nullable();
My Model
protected $cast = [
'fields' => 'json'
];
My Field in the Resource class
FormsComponentsSection::make('Dynamic Fields')
->schema([
FormsComponentsKeyValue::make('fields')
->keyLabel('Field name')
->valueLabel('Field value')
->reorderable(),
]),
What am I missing? Please help.
Displaying of data in KeyValue field
- I tried changing the field type to text and casting the field to array and to json and still had the same result.
ACF field groups is not loading in acf/include_fields hook with php code as ACF doc suggests
I am using ACF latest version 6.2.3 and trying to load the field group from the php code generated from another site. Both sites are using free version of ACF
The code is
add_action( 'acf/include_fields', function() {
if ( ! function_exists( 'acf_add_local_field_group' ) ) {
return;
}
acf_add_local_field_group( array(
'key' => 'group_65685566476a1',
'title' => 'Test group cybercraft',
'fields' => array(
array(
'key' => 'field_65685567f769f',
'label' => 'Test',
'name' => 'test',
'aria-label' => '',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'maxlength' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
'show_in_rest' => 0,
) );
} );
I placed it in the new site, but it is not working. Verifying that the code is run by the site but no field group inserted in acf field group list .
Is there anything that I have missed to do ?
Thanks.
Hide WooCommerce BACS payment if cart total exceed a specific amount
I’m trying to hide the Bank Account Transfer payment method when the order is less than $500 but the code is not working. Can you help me to find the error?
add_filter( 'woocommerce_available_payment_gateways', 'show_hide_payment_methods_on_checkout' , 1 );
function show_hide_payment_methods_on_checkout( $available_gateways ) {
// Set minimum cart total
$minimum_order_total = 500;
// Get the order total
$order_total = WC()->cart->get_total( 'edit' );
echo 'Final Price: ' . $order_total;
// Check if the order total is less than or equal to the minimum
if ( $order_total <= $minimum_order_total ) {
// Check if 'bacs' payment gateway is available and unset it
if ( isset( $available_gateways['bacs'] ) ) {
unset( $available_gateways['bacs'] );
}
}
return $available_gateways;
}
Woocommerce: Add text to price in cart but not to Related Products
I’ve added the text “kg*” after the price on the product page. However, it also adds the additional text to the price of the Related Products below. How do I exclude the price being added to the Related Products? I want to add the text only to the price of the product.
add_filter( 'woocommerce_get_price_html', 'hellblau_kg_nach_preis', 100, 2 );
function hellblau_kg_nach_preis($price){
if( is_single() ) {
global $product;
$weight = $product->get_weight();
return $price . ' / ' . $weight . ' kg*';
}
return $price;
}
I’ve tried several things like if( is_single() && ! RELATED-PRODUCTS ) without success.
Special characters are getting converted into html entities in source code for wordpress website, what to do?
In wordpress website all the special characters are converted into html entities if I open source code, so I am facing issue in SEO
Frontend:- Nykaa’s Inception
Backend (source code):- Nykaa’s Inception
Checked formatting.php as well
how to process data that are transmitted as a string, but in fact are an array?
there is a task to make a service that takes on the input string via POST, and process it. the problem is that the string is actually an array, and I can’t figure out how to process it correctly. I couldn’t split it with explode(), because neither the comma nor the arrow separators fit – everything spoils the second key-value pair, where the value is a JSON string. Is there any way to process it? Below is exact incoming string
'Number' => '0000-543392',
'In' => '
{
"RequestID": 8101,
"DateTime": "2023-10-26 16:47:49",
"CheckNumber": "0000-543392",
"DateTimeCheck": "2023-10-26 16:47:44",
"ChannelID": 2,
"SourceID": 1,
"CashDeskID": "c6445ae8-dce2-11e8-80cf-0050560132c4",
"Coupon": false,
"CouponCodes": null,
"CustomerIdentifier": [
{
"CardID": null,
"CustomerID": null,
"CustomerPhone": null,
"TelegramID": null,
"CustomerEmail": null
}
],
"StringAmount": 2,
"Strings": [
{
"ProductID": "56625578-a627-11ed-97b9-00155d05fc14",
"UUID": "56625578-a627-11ed-97b9-00155d05fc14",
"ProductPrice": 28,
"ProductAmount": 1,
"BasePriceID": null,
"Sum": 28,
"ExpirationDate": [
{
"Amount": null,
"ExpirationDate": null
}
],
"TypeLabel_ID": "",
"DataMatrix": []
},
{
"ProductID": "9b86934c-3f30-11ed-97b9-00155d05fc14",
"UUID": "9b86934c-3f30-11ed-97b9-00155d05fc14",
"ProductPrice": 45,
"ProductAmount": 1,
"BasePriceID": null,
"Sum": 45,
"ExpirationDate": [
{
"Amount": null,
"ExpirationDate": null
}
],
"TypeLabel_ID": "",
"DataMatrix": []
}
],
"CheckSum": 73,
"PaymentType": [
{
"PaymentTypeID": 1,
"CurrencyID": 3,
"CurrencyName": "Rub",
"Sum": 0
}
],
"WriteOffBonusType": 3
}
',
'success' => 'false',
'DateTime' => '26-10-23 16:47',
'RequestID' => '71457',
'reqlenght' => 'null',
'timestart' => 'null',
'timeend' => 'null'
explode didnt help…
Passing php’s $_POST to a python script
As mentioned in the title, i am trying to pass the php $_POST array to a python script
I have the following php line:
echo shell_exec('python script.py ' . json_encode($_POST));
And this python code:
import sys
import json
import os.path
encodedinfo = sys.argv[1]
info = json.loads(encodedinfo);
print(info['id']);
i have found that the problem is with the json.loads() function, as if it is not commented the script does not reach the print() command.
How do i solve this?
How to deploy PHP and React on vercel [closed]
I got error on vercel after deploy
Here is project directory and file structure
and my vercel.json file is
{
"functions": {
"server/controller/*.php": {
"runtime": "[email protected]"
},
"server/controller/authController.php": {
"runtime": "[email protected]"
},
"server/controller/employeeController.php": {
"runtime": "[email protected]"
}
}
}
Let me know how to resolve it and correct way to deploy on Vercel.
CSS file not being linked even though the route is correct
So I have a HTML,CSS and php project for uni.
While working, I have faced a problem where a <link> code in a file called headerHome.php,that includes the navbar which I include in each file, is not linking to the CSS file(called index.css).
here is the code for reference as well as my files layout :
HeaderHome.php:
.
.
.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Score'em</title>
<link rel="stylesheet" href="CSS/index.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" >
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" ></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT" crossorigin="anonymous"></script>
</body>
</head>
.
.
profile.php(the file in question) :
<?php include("includes/headerHome.php");
$user = FetchUserInfo($_SESSION['User']);
?>
<div class="ContainerProfile">
<a href="#" id="uploadImage">
<img id="CircleImage" height="128" width="128" src="images/logo.png" alt="Cloud Chen">
</a>
</div>
<?php include("includes/footer.php");?>
The CSS Code :
#uploadImage {
color: transparent;
font-weight: normal;
text-decoration: none;
}
#CircleImage{
border-radius: 50%;
}
.ContainerProfile{
background-color: #44b8f6;
}
Files Layout

Output

Can someone please explain to me what I did wrong ?
Custom Nav Walker warnings
I have custom nav walker class that just adds some classes and replaces the url of some menu items. Menu is displayed correctly. The problem is there are a lot of warnings:
PHP Warning: Attempt to read property "before" on null in /public_html/example.com/wp-includes/class-walker-nav-menu.php on line 273
PHP Warning: Attempt to read property "link_before" on null in /public_html/example.com/wp-includes/class-walker-nav-menu.php on line 275
PHP Warning: Attempt to read property "link_after" on null in /public_html/example.com/wp-includes/class-walker-nav-menu.php on line 275
PHP Warning: Attempt to read property "after" on null in /public_html/example.com/wp-includes/class-walker-nav-menu.php on line 277
PHP Warning: Attempt to read property "before" on null in /public_html/example.com/wp-includes/class-walker-nav-menu.php on line 273
PHP Warning: Attempt to read property "link_before" on null in /public_html/example.com/wp-includes/class-walker-nav-menu.php on line 275
PHP Warning: Attempt to read property "link_after" on null in /public_html/example.com/wp-includes/class-walker-nav-menu.php on line 275
PHP Warning: Attempt to read property "after" on null in /public_html/example.com/wp-includes/class-walker-nav-menu.php on line 277
class-walker-nav-menu.php
class Navigation extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "t", $depth );
$output .= "n$indent<ul class="menu submenu">n";
}
function start_el(&$output, $data_object, $depth = 0, $args = null, $current_object_id = 0)
{
$f_menu = get_field('menu_item', 'option');
$s_menu = get_field('menu_item_second', 'option');
if ($data_object->title == $f_menu) {
$url = get_field('outbreak_plan', 'option');
$data_object->url = $url['url'];
} else if ($data_object->title == $s_menu) {
$url = get_field('covid_updates', 'option');
$data_object->url = $url['url'];
}
parent::start_el($output, $data_object, $depth = 0, $args = null, $current_object_id = 0);
}
}
I have other sites on this server that use the same class-walker-nav-menu.php with no warnings. How can I fix the code or make the server not show warnings for this file?




