OpenLampTech issue #20
Sanitizing input in PHP; MySQL SQL_MODE; Handy MySQL information queries; Strings to dates in PHP; PHP access modifiers; Finding a WordPress backdoor
Hey glad to have you here! 👍
If someone shared this newsletter with you and you are not yet subscribed, please use the Subscribe button below and join:
Receive a free copy of my eBook, “10 MySQL Tips For Everyone” when you subscribe to the weekly OpenLampTech newsletter!
Recently from the Digital Owl’s Prose Blog and OpenLampTech Publication
This week on the Digital Owl's Prose developer blog I covered a handy way to use the
ALTER TABLE command and add multiple columns to an existing table in one command. Read, MySQL ALTER TABLE - Add Multiple Columns, for more information.
In the OpenLampTech publication this week I published an article covering the MySQL
SUBSTRING() character function.
I have curated some fantastic reads for you this week. Let’s get to them!
This Week’s Picks
✔️ Sanitize Input using PHP
Anytime we are storing user-provided information in the database, we should definitely sanitize it and protect the data store as much as possible.
In this post, we see a great example function that filters input data using the built-in PHP htmlentities() function.
✔️ Handy MySQL Information Queries
By: SHAFI SHAIK
Here are 4 short articles covering queries against various tables in the MySQL
INFORMATION_SCHEMA database that you can use and retrieve super-useful information from.
I've really started to learn more about - and use - the
INFORMATION_SCHEMA database as I focus on building MySQL skills.
🔒 I've published a paywalled article over on my Kofi page. I really appreciate anyone's support for unlocking and reading this article. In this post, I'm sharing my thoughts and experiences I've not written much about before.
Other self-taught developers will surely relate to some of the points I wrote about. Thank you!
✔️ Setting SQL_MODE
By: Michael McLaughlin
MySQL has several SQL modes and one of them is the
ONLY_FULL_GROUP_BY mode. In this short post, we learn how to create a stored procedure we can use to set the
@@sql_mode for this variable.
ONLY_FULL_GROUP_BY is a very important SQL mode. Visiting the verbiage from the official documentation, we can see just why it is so important in regards to grouping type queries.
From the docs:
"Reject queries for which the select list, HAVING condition, or ORDER BY list refer to nonaggregated columns that are neither named in the GROUP BY clause nor are functionally dependent on (uniquely determined by) GROUP BY columns."
✔️ Convert String to Date and Date-Time in PHP
By: DeftStack Blog
I swear there are like a million different ways to create a date in PHP. Although there likely aren't that many, there do seem to be quite a few.
In this post, we learn 2 different ways you can create a date from a string value using built-in PHP functions.
A combination of
Date values are important and are everywhere in an application so it makes sense to know how to create them with PHP.
✔️ How to Find a Backdoor in a Hacked WordPress Site and Fix It
Here is one detailed guide that I think anyone working with WordPress should get their hands on.
There are several ways someone can hack your WordPress site and while it would be impossible to cover them all in one article, I say this post is as good a start as any.
There is a ton of information in this article by the WPBeginner blog.
Just a few of the points I picked up from this post are:
What is a backdoor?
How do backdoors work?
Where do hackers place backdoors?
Examples of files that look perfectly fine, but are not a part of a WordPress site install.
I'll definitely spend more time studying this article.
✔️ PHP Access Modifiers Example
PHP has 3 access modifiers:
This post provides an example code block for each access modifier detailing creation and use.
Understanding the role of each level of access modifiers is very important in PHP programming because they dictate where properties and methods can be accessed.
✔️ Ten Tips on How to Achieve MySQL and MariaDB Security
By: Krzysztof Ksiazek
We should all know the importance of the security of the database as it is the heartbeat of the application. Without the data, we don't have much of anything.
The Severalnines team always publishes great content and their security-focused posts are top-notch.
While this article is a bit older (written in 2018) it nevertheless has solid information on tightening down a MySQL 5.7 or the equivalent MariaDB server.
A couple of points of interest that I learned good measures are:
Remove the test database
Obfuscate server access
LOAD DATA LOCAL INFILE
Do you need to learn MySQL? Just starting out and confused about how to query a table and get the data you need? I am creating premium MySQL Beginners content for this specific reason. To help those who want to learn the basics of MySQL but don't know where to start. Learn more about my premium MySQL blog posts and content as I develop and release them, along with an actionable MySQL tip each week.
⭐⭐⭐ Many of the posts I curate and share in this newsletter, I read and enjoyed on Medium. If you are not yet and member and wish to join the platform, I would be more than grateful if you would use my sign-up link. At no extra cost to you, I will receive a small portion of your membership fee when you sign up. Thank you! 🙏
Did you enjoy this issue of OpenLampTech? Please share it with others so that they can enjoy the content as well. Thank you!!!
Thank you for reading. I hope you have a great rest of your week.
Want to support this newsletter and my work? Drop some spare change in my Tip Jar.💰
Disclosure: Some of the services and products links in this email are affiliate links. At no additional cost to you, should you make a purchase by clicking through one of them, I will receive a commission.