SASLA – Simple Anti Spam Lite Approach

Beauty of style and harmony and grace and good rhythm depends on simplicity — Plato

For the n00bs, what is SPAM anyway?

SPAM Stupid, Pointless Annoying Message

What is SASLA?

SASLA is an abbreviation of Simple Anti Spam Lite Approach and it’s pronounced as saas-laa.

For the technologically sound personalities:

SASLA is the simplest plug-n-play open-source anti-spam solution that can be easily integrated to your HTML forms and the most viable alternative to CAPTCHAs .

For the layman:

SASLA will protect your web forms from spam-bots so that you don’t need to waste your time and resources on weeding out spam.

Why should I use SASLA?

There are number of reasons:

  • It’s 100% FREE(No strings attached)
  • Beauty is in simplicity (There is nothing to configure and dead simple to implement)
  • Size Zero (Less than 1 KB)
  • No need to feed any veg hamburgers (web resources) to any other web service(s) like Akismet (It’s blazingly fast)
  • Maintenance free(No API/URI updates will stand in your way ever)
  • MIT License(One of the most simple and permissive license in the planet)

Why it’s awesome?

Reason #1: It doesn’t need an action from the user’s part unlike other anti-spam solutions, SASLA works invisibly

Spam is a webmaster’s headache and not an user’s issue and as a great fan of usability and conversions, I’ve always hated the majority of anti-spam solutions in the market like CAPTCHAs and their derivatives or any other initiatives that requires an action from the user’s side.

Also the existing anti-spam solutions affect usability and conversions in a bigger way.

Reason #2: Simple to implement, small in size, low in resources and tested before public release

Did you know?

SASLA is having less than 50 lines of code.

I’ve tested SASLA in 10 of my client’s sites (having a monthly traffic of 20,000+ unique visitors) before releasing it to the public and SASLA’s success rate was 100% with-out any false positives. Also SASLA will never ever block any legitimate user!

Any downsides

  1. It doesn’t protect you against a human spammer who manually writes and submits spam.
  2. Will not work on browsers with JavaScript disabled

Where can I use SASLA?

You can use it in any web form that accepts public input.

Some examples are:

  • Forums
  • Feedback forms
  • Contact forms
  • Web application
  • Mail subscription forms
  • Etc…(left to your imagination)

Requirements

  1. PHP (PHP 5 or greater preferred)
  2. A JavaScript enabled browser 

How is it licensed?

It’s licensed under MIT license, which means:

You can:

  • re-use the code freely for your own use
  • re-use the code freely for non-commercial & commercial re-distribution

You can’t:

  • claim authorship of the software,
  • You cannot attack the original author for any damages caused by using this code.

Download / Fork

Olson Timezone Database Download


Image Credit

Hope you’ve came here because of the following reasons:

  1. In the lookout for the PHP Timezone Database in SQL format
  2. Your php timezone database is corrupt
  3. For php olson timezone/tz database
  4. pear timezone bug
  5. pear timezone install failures

Then here is the solution:

The following PHP Timezone Database in MySQL format contains all the available timezones in PHP(416 in total) based on http://php.net/manual/en/timezones.php

How to use:

  1. Download the zip file
  2. Import the downloaded file to any database using the MySQL command-line or using any of the MySQL database management tools like phpMyAdmin
  3. Roll on the floor and say thank you to Mithun John Jacob(that’s me!) 🙂

P.S: This MySQL data can be used for any programming language and not for PHP alone.

 

 

Download Remote File with PHP to Server and finally output to browser

Shown below is the code to download a remote file with PHP and save to the server and finally output to browser using cURL and readfile

 

Limitations:

  1. Since the file is downloaded to the server first before outputting to the browser, it consumes time, bandwidth & server space.
  2. When downloading large files, the script may exhaust the memory limit and is prone to timeout.

Disable jQuery UI Autocomplete

Here is a short & crisp tutorial on how to disable jQuery UI Autocomplete.

This article assumes that you already know how to implement jQuery UI Autocomplete.

So we are jumping to the coding part…

The HTML Code of Autocomplete Text Box may look like this:

And you will be invoking the jQuery UI Autocomplete (and passing options) like:

Now we will add a checkbox to enable/disable jQuery UI Autocomplete.

The enable/disable jQuery UI Autocomplete code:

That’s it. Happy coding !

Create a Cron Job in cPanel – Cron Job Tutorial for Dummies

Cron Job in cPanel

This guide is meant for anyone who wants to create a cron job and for all those who has never ever created a cron job in their life through cPanel.

First of all, what is a cron job ? This is Wikipedia‘s explanation:

Cron is the time-based job scheduler in Unix-like computer operating systems. Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration, though its general-purpose nature means that it can be used for other purposes, such as connecting to the Internet and downloading email.

Cron is available on Unix, Linux and Mac servers. Windows servers use a Scheduled Task to execute commands.

All the cron jobs tutorials just concentrates on the steps on scheduling a cron job, but most of the the users don’t know anything about Unix/Linux commands or even aabout command-line. So they make mistakes in adding the command to the Command textbox of the cPanel.

Cron Command Text Box of cPanel

PHP is one of the most popular server-side programming language, so I will concentrate on adding a PHP script as a cron job. In addition to that you will be provided with a working(and tested) PHP code to find the path to be mentioned in the cron command textbox.

Open your text editor and paste the following:

Now follow the steps mentioned below to get running…

  1. Save it as path.php
  2. Upload it to the directory where your php file meant for the cron job is located
  3. Now run the file in browser
  4. Copy the output to your text editor

The output will be like

/home/USERNAME/public_html/DIRNAME
or
/home2/USERNAME/public_html/DIRNAME

Now append the filename of the script that you want to run to the output. The final line will now look like /home/USERNAME/public_html/DIRNAME/FILENAME

where

USERNAME - Your cPanel Username

DIRNAME - the directory name where the file resides

FILENAME - the file name of the file that you want setup as a cron job

Now launch Cron Jobs section of your cPanel. It will look like this:

Add a new Cron Job

In the screenshot above I’ve selected daily as my interval and entered the following line of text into the Command textbox.

php /home/USERNAME/public_html/crons/my-cron.php

where

crons - the directory where my php file resides

my-cron.php - the php file to be setup as a cron job

Now click the Add New Cron Job and your are done !

Voila! You’ve scheduled a cron job !

Pragmatic Programmer Tips Sheet – Noteworthy ones that no Developer or Consultant can push aside

Larry Wall

As a tech consultant to some of the IT companies, I’ve always felt that the companies(and employees) could have minimized or eliminated many of their headaches if they had implemented some of the ideas given below…

Here are some straight lifts from The Pragmatic Programmer

Provide Options, Don’t Make Lame Excuses
Instead of excuses, provide options. Don’t say it can’t be done; explain what can be done.

Be a Catalyst for Change
You can’t force change on people. Instead, show them how the future might be and help them participate in creating it.

Make Quality a Requirements Issue
Involve your clients in determining the project’s real quality requirements.

Critically Analyze What You Read and Hear
Don’t be swayed by vendors, media hype, or dogma. Analyze information in terms of you and your project.

Program Close to the Problem Domain
Design and code in your client’s language.

Always Use Source Code Control
Source code control is a time machine for your work—you can go back.

Test Your Software, or Your Clients Will
Test ruthlessly. Don’t make your clients find bugs for you.

Gently Exceed Your Users’ Expectations
Come to understand your users’ expectations, then deliver just that little bit more.

Work with the Client to Think Like a Client
It’s the best way to gain insight into how the system will really be used.