Category Archives: Subscription
Harvest Time
Large File Support (LFS) for Git
Decision making with constraint programming
CONTENT SECURITY POLICY
Secure passwords with hash functions
Built-in backup in Linux with rsync
Buid-Management in JavaScript with Grunt
Validating credit card numbers for online payments
Anyone who offers credit card payment for their web service may want to validate the credit card number in advance. This way, the number of incorrect API calls can be reduced.
The validity of a credit card number can be determined using the Luhn algorithm. Hans Peter Luhn designed the algorithm and patented it in 1960 as US Patent 2950048A. The algorithm is now considered public domain and was specified under ISO/IEC 7812-1. The algorithm is very general and is generally suitable for validating identification numbers. This means that the process can also be used for the use of gift cards or voucher codes.
In order to protect credit card holders from fraud or misuse, several security factors come into play when paying online. The most important point here is the credit card number in combination with an expiration date and a verification code (CVC/CVV). The validity period and the check digit, which are also printed on the credit card, are assigned arbitrarily by the credit card companies and can therefore only be verified by the bank during the payment process.
Before we turn directly to the Luhn algorithm, a note on storing the check digits. These should not be stored in the database if possible, but should be requested anew each time. Payment is only possible through the combination of card numbers, check digit and expiration date. If a single parameter is missing, the payment process fails. Of course, one could argue that it is more convenient for users if the check digit is also stored. But security and convenience are unfortunately conflicting requirements. The higher the security, the more inconvenient it is to use. However, if, for example, the user account has been hacked or an SQL injection has been successfully carried out on the database, the attackers can immediately go on an even more devastating raid with their loot. Such an incident causes considerable damage to the reputation of your own online offering.
Abonnement / Subscription
Accelerate PHP Applications with Redis
The topic of NoSQL is a little older and has now also arrived in productive systems. One representative of the NoSQL family is Redis. It is a very easy-to-use key-value store in memory. Redis has been available since 2009 for all common operating systems and programming languages. The main area of application for Redis is caching to speed up applications. In this short workshop you will learn everything you need to know to be able to use Redis efficiently in your PHP applications.
As with so many other technologies, the most difficult step is installing the environment. Thanks to the Docker virtualization tool, the installation can be done in no time at all in less than 5 minutes. To get Redis running we need three steps. This assumes that Docker [1] is already installed on the system. First we install the Redis server [2] and then use Redis insight [3], a graphical administration interface, to connect to the Redis server. If these two steps are successful, the Redis extension must finally be activated in the PHP installation.
So let’s start by installing the Redis server under Docker. Listing 1 shows the complete command for the command line.