PHP How to request an A record from a DNS server in PHP 8.3 January 5, 2025 by Philip Newman | Leave a Comment In PHP 8.3, you can use the dns_get_record() function to query DNS records, including A records. Here’s an example of how to request an A record from a DNS server: Explanation: Example Output: If the domain has A records, the output will look like this: Read more » PHP PHP 8.3
PHP How do I reverse an IP address for use in DNS BL? January 5, 2025 / January 5, 2025 by Philip Newman | Leave a Comment Here’s a small function in PHP 8.3 that reverses an IPv4 address: Explanation: This ensures the function works safely and as expected. Read more » IP Address PHP 8.2 PHP 8.3
Linux Has Linux fixed the unix time bug yet? January 3, 2025 / January 3, 2025 by Philip Newman | Leave a Comment The “Year 2038 problem” (also known as the 32-bit Unix time overflow bug) has largely been addressed in modern Linux systems and related software. So yes it has been fixed. Background on the Problem The issue arises because Unix time (the number of seconds since January 1, 1970, 00:00:00 UTC) is traditionally stored as a […] Read more » Debian Linux Unix
Postfix How do I block a domain name in postfix? January 2, 2025 / January 2, 2025 by Philip Newman | Leave a Comment To block a domain name in Postfix, you can use the sender_access feature to reject emails from specific domains. Here’s a step-by-step guide: 1. Edit Postfix Configuration Open the main configuration file: Look for the smtpd_sender_restrictions line. If it doesn’t exist, add it, or modify it to include the check_sender_access directive: The permit ensures valid […] Read more » Postfix
PHP Temperature conversions between Celsius and Fahrenheit using PHP. December 31, 2024 / September 27, 2026 by Philip Newman | Leave a Comment Here’s an example of a PHP 8.2 class that handles temperature conversions between Celsius (C) and Fahrenheit (F): This class provides two static methods: The example usage demonstrates how to use the class to perform conversions. Let me know if you’d like to expand this functionality! Read more » PHP PHP 8.2 Weather Station
Wordpress How to add a Google Form into a WordPress page. December 23, 2024 / December 23, 2024 by Philip Newman | Leave a Comment To embed a Google Form into a WordPress page using HTML, follow these steps: 1. Get the Embed Code from Google Forms: 2. Edit Your WordPress Page: 3. Add the Embed Code: 4. Save and Publish: Example Embed Code. Here’s an example of what the embed code looks like: Customization. Additional Notes:. This method ensures […] Read more »
Dribble ESPs: Why IP and Domain Reputation Matter and How to Manage Them December 22, 2024 / December 22, 2024 by Philip Newman | Leave a Comment As an email service provider (ESP), your aim is to maintain a safe and trustworthy network for email senders (and their recipients) while ensuring they achieve high deliverability rates. A task that is no mean feat when you’re servicing a bank of customers with hundreds of thousands of IPs and domains – each with a […] Read more » Domain Reputation Email IP Address IP Reputation
PHP How to get country codes using the ODOO xmlrpc API and PHP. December 21, 2024 / December 21, 2024 by Philip Newman | Leave a Comment To fetch country codes from an Odoo instance using PHP 8.2, you’ll need to use the Odoo XML-RPC API. Below is an example of how to achieve this: Step 1: Set Up PHP Environment Ensure you have PHP 8.2 installed with the necessary extensions, including the cURL extension, which is used for making HTTP requests. […] Read more » PHP PHP 8.2
PHP Using PHP to turn an HTML table into an Array() December 21, 2024 / December 21, 2024 by Philip Newman | Leave a Comment To convert an HTML table into a PHP array in PHP 8.2, you can use the DOMDocument class, which provides a structured way to parse and extract data from HTML. Here’s an example of how to achieve this: Example Code: Output: Explanation: This approach is flexible and can handle more complex HTML tables with nested […] Read more » PHP 8.2
JavaScript Adding Zeros to the front of a number in JavaScript. September 7, 2024 / September 7, 2024 by Philip Newman | Leave a Comment To format a number to always have six characters, including leading zeros if necessary, you can use JavaScript’s padStart method. This method pads the current string with another string (repeated, if needed) until the resulting string reaches the desired length. Here’s a simple example of how to do this: Explanation: You can use this function […] Read more » HTML5 JavaScript
PHP How to add a BCC to PHP mail() command. September 5, 2024 / February 9, 2025 by Philip Newman | Leave a Comment To add BCC (Blind Carbon Copy) recipients when sending mail in PHP, you can modify the headers to include BCC recipients. Here’s how you can do it: Example using PHP mail() function: Explanation: This will send the email to the primary recipient and also BCC it to hidden1@example.com and hidden2@example.com. Considerations: Read more » PHP 8.3
PHP How to use Māori macrons in your PHP 8.3 code. September 5, 2024 / September 5, 2024 by Philip Newman | Leave a Comment To convert UTF-8 characters with macrons (e.g., Māori macrons like “ā”, “ē”, etc.) into their corresponding HTML entity codes in PHP, you can use the mb_encode_numericentity() function from the mbstring extension. Here’s an example of how to achieve this: Example Code: Explanation: Example Input/Output: Notes: This approach will correctly convert the UTF-8 macron characters to […] Read more » PHP 8.3
Linux What are Load Averages? August 22, 2024 / September 5, 2024 by Philip Newman | Leave a Comment Load averages represent the average number of processes that are either: They give a snapshot of how much work your system has been doing over time. Linux usually reports three numbers for load average, which represent the load over different periods: For example, when you run the uptime or top command, you might see something […] Read more » Debian Linux SysAdmin
Linux [SOLVED] The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key March 17, 2024 / March 17, 2024 by Philip Newman | Leave a Comment Here is the solution if you’ve got the following error message when updating package lists on Debian (apt-get update): The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key The sury.org Debian package repository has changed its package signing key. To fix the error, just download the new key: Finally, run package update again: […] Read more » apt-key Debian Linux
JavaScript Change the Text of a Div Element using JavaScript December 23, 2022 / December 23, 2022 by Philip Newman | Leave a Comment Use the textContent property to change the text of a div element, e.g. div.textContent = 'Replacement text'. The textContent property will set the text of the div to the provided string, replacing any of the existing content. Here is the HTML for the examples in this article. index.html And here is the related JavaScript code. index.js We used the textContent property on the div to change its text […] Read more » HTML5 JavaScript
PHP Validate Password Strength using PHP November 2, 2022 / January 2, 2025 by Philip Newman | 1 Comment on Validate Password Strength using PHP When the user provides their account password, it is always recommended to validate the input. Password strength validation is very useful to check whether the password is strong. A strong password makes the user’s account secure and helps to prevent account hacking. Using Regex (Regular Expression), you can easily validate the password strength in PHP. […] Read more » password PHP PHP 8.1 preg_match
Linux Backup a website using bash script. April 8, 2022 / September 30, 2026 by Philip Newman | 1 Comment on Backup a website using bash script. I needed to complete a routine backup of my development websites on my home server. This was pretty easily completed by daily by a bash script. Here is a simple script that backs up the database and all the files. For the example below I’m using Maria DB 10.5 and my project files are located […] Read more » Backups Bash
PHP An Introduction to Classes and Objects in PHP 8+ February 6, 2022 / February 6, 2022 by Philip Newman | Leave a Comment What is OOP? Object-oriented programming (OOP) is a computer programming model that organizes software design around objects rather than single functions. An object can be defined as a data field that has unique attributes and behavior. A class is a container for objects to be manipulated using methods (internal functions). OOP Let’s assume we have […] Read more » PHP PHP 8.1
WooCommerce Wordpress StoreFront – Add HTML to header January 6, 2022 / January 6, 2022 by Philip Newman | Leave a Comment Read more »
WooCommerce WooCommerce – Display “Out of Stock” on Loop Pages September 17, 2021 / September 17, 2021 by Philip Newman | Leave a Comment This fixes a problem for those who want to display a label when an item is out of stock. You can save this in your functions.php to make it work. You will also need to add this to your style sheet. Read more »