PHP Send Email Via PHPMailer Example

How to send email using PHPMailer

PHP Send Email Via PHPMailerFor those of you who want to send email via PHPMailer instead of the mail() command, here is a simple script I wrote to facilitate sending email. Because there are so many different areas within a site that can send email messages automatically I have externalized the script and include it when needed.

The script includes logic to monitor for an error from PHPMailer and if found send the email using mail() and send an email to the administrator that PHPMailer failed.

This function accepts an optional file parameter. If the file parameter is passed it will be included in the email as an attachment.
Continue reading “PHP Send Email Via PHPMailer Example”

PHP Process Decision Logic iFrame

How to Process the Decision Logic iFrame with PHP

PHP Process Decision Logic iFrameI recently had the opportunity to program the iframe interface with Decision Logic for a client of mine. The process requires an account with Decision Logic. I also recommend you obtain the Starter Kit from Decision Logic. Decision Logic is a third party service used to verify a person based on their banking information. The approach is to present the Decision Logic iframe to the user which collects information from the user and performs a verification process.

You must white list and obtain a unique guid from Decision Logic for each URL that presents the Decision Logic iframe.

Once the user completes the Decision Logic iframe process you can have Decision Logic notify you with the results to a notification URL. This requires some setup within your Decision Logic account.
Continue reading “PHP Process Decision Logic iFrame”

PHP Semaphore Example

How to use semaphone with PHP

PHP Semaphore ExampleSemaphore is a protected variable that can be used to control access to a resource. I’ve used a semaphore to prevent a PHP script from running simultaneously. For example I have a PHP script that runs every Tuesday to process a weekly newsletter. This script first selects a list of recipients to send. The script then sends each recipient a copy of the newsletter. The list is more than 10,000 subscribers and each subscriber is processed individually in order to customize the newsletter content. As each subscriber is processed the script updates the database for that subscriber with a last sent date of today. If the script runs a second time the subscribers will not be selected since they were updated with a last sent date of today. However if the script is run a second time before the first instance completes the initial list is repopulated and the newsletter is sent twice. To prevent the script from running simultaneously I use a semaphore to “lock” the process.
Continue reading “PHP Semaphore Example”

JavaScript Simple Countdown Timer Example

How to create a simple JavaScript Countdown Timer

JavaScript Simple Countdown TimerThis is a simple JavaScript countdown timer I have used many times in the past. This script works great when you need to display the time remaining for a specific activity and have it count down until that time is reached.

First, we’ll go over the basic stand-alone script. This script will count down the days, hours, minutes, and seconds until our target date and time and display that countdown in a div with id=’timer’. For our example the target date and time is December 31, 2050 17:00:00. Once we pass the target date and time the timer will display the literal text “Ended”.

Continue reading “JavaScript Simple Countdown Timer Example”