If you don’t want to explore the Odoo modules in the market and you are rather looking to customize your own script. You may use this, as one of our client devs asked for a fast way to do it.
Continue readingCategory: عام
[cPanel/WHM] Script to enable terminals for users
Within some shared-hosting policies, cPanel terminals may be disabled by default for all users. However there are different solutions to explicitly activate it for specific users based, for example, on their e-mails.
Continue reading[PHP/JSON] Getting an object key
{
"1": ...,
"2": ...,
"user-data": ...,
}When working with JSON data in PHP, you might encounter keys that are not valid PHP identifiers due to special characters, while PHP identifiers are supposed to start with an alpha and not contain a hyphon (e.g $object->1 or $object->user-data).
[JS] Extract text between two strings or regular expressions
This is a basic javascript function which can be used to extract a text between two regular expressions, strings, words, sentences, HTML tags, etc.
Continue reading[Softaculous] Installing Prestashop 1.7
Unable to generate new_cookie_key, hence can not install PrestaShop.To work around the following error message while auto-installing PS 1.7 using Softaculous. Use the root directory of your domain name or a sub-domain’s.
[Laravel Filament] Customize the ToggleColumn
By default, the ToggleColumn in Laravel Filament is designed to work with boolean-like fields. However, there may be cases where you need to customize it to work with different data like textual fields.
Test/debug IMAP connection with PHP
Following is a basic code to get the last received e-mail using IMAP protocol:
ini_set('display_errors', 1);
error_reporting(E_ALL);
// Debug flag
$mail = imap_open('{mail.example.com:143/debug}', 'test@example.com', 'password');
// or using SSL/TLS $mail = imap_open('{mail.example.com:993/ssl/debug}', 'text@example.com', 'password');
$last_mail = imap_num_msg($mail);
var_dump(imap_headerinfo($mail, $last_mail));
echo imap_body($mail, $last_mail);
imap_close($mail);Useful tip – max user connections on Shared Hosting
One of the funniest and useful things some users tend to do when having a max connection limitation on MySQL is to create several users cyclically or even randomly.
$db_users = array("db_user1","db_user2","db_user3","db_user4","db_user5","db_user7"...);
$db_user = $users [rand(0,5)];
$db_connection = new mysqli($db_host, $db_user, $db_password, $db_name);Reset perfexcrm password from phpMyAdmin
Tested on version 2.9
- Go to phpmyadmin
- Select the database you use for perfex crm
- Select table tblstaff
- Find your account (you can find it by the email field)
- Replace the hash, by pasting into the password column the following hash :
$2a$08$gzXZ8gbnRcKPQOIRi2GnVuy.xXibU1A3msw.wXk.pB6A2wPU29iO2
cPanel NodeJs | ERR_REQUIRE_ESM
If you are using cPanel > Setup Node.Js App and you have across of a similar error to:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: app.js