In managing an open-access website, many times you will be bothered by spamming or massive illegal attack. People are using script or application to burden your website by overloaded your database. At the end, it will slow your website down, even take it down.
Captcha is an alternative method to protect your web from spam. It is such a program that protects websites against bots by generating and grading tests that humans can pass but current computer programs cannot. For example, humans can read distorted text as the one shown below, but current computer programs can’t.
So, let’s protect your lovely open access journal (OJS) by activating the captcha. As I said “activating” means that OJS is equipped with this tool, yet it needs to be turned on.
1. Make sure you have access to the server (if you use web hosting you probably have access to CPanel).
2. In your installation folder, such as public_html or www, open config.inc.php by using “code editing”.
3. Search for the following code
[captcha] ; Whether or not to enable Captcha features captcha = On ; Whether or not to use Captcha on user registration captcha_on_register = On ; Whether or not to use Captcha on user comments captcha_on_comments = On ; Font location for font to use in Captcha images font_location = /usr/share/fonts/truetype/freefont/FreeSerif.ttf
4. Make sure you switch on the captcha. Just put all those three command “on”.
Well, it is not done yet, in the default installation, your server may not be provided by FreeSerif.ttf font. It may cause blank captcha because the tool is not able to access the font. As for a solution, you need to add the font manually, either directly to your server or through Cpanel. So, let’s say that you have no access to the server, the only possible for you is to upload the font to Cpanel. Here is the steps:
- Download FreeSerif font , extract the file and upload to your Cpanel, I put in the Public_HTML, or you may create a specific folder for fonts.
- Open your config.inc.php, search for:
font_location = /usr/share/fonts/truetype/freefont/FreeSerif.ttf
and switch to:
font_location = /home2/arbiter/public_html/FreeSerif.ttf
3. Save the file and now you can check the registration page.
There is another alternative to add captcha in OJS, instead of using default captcha, you can use Google reCaptcha. I’ll see you in the next tutorial. Have a nice day, my friend!