How to Deny Access To Your Server From a Certain IP Using iptables

I you’re running a web server, you should have noticed that some IP addresses can be found trying to crack your passwords or issuing different queries trying to find a vulnerability in your scripts. If your main Linux firewall is iptables, there are lots of opportunities to enable/disable access using different conditions. We will close incoming connections for… Read More »

Regular Expression to Extract all E-mail Addresses from a File With PHP

Sometimes you need to extract some data from text files. E-mails, passwords, just some simple tags… no matter what it is, your best choice to do this is to use regular expressions. I will show you a PHP script that will extract all valid e-mails from a text file. <? $fs=fopen(“best.txt”, “r”); $f3=fopen(“clean.txt”, “a”); while(!feof($fs)) { $gan=fgets($fs); preg_match(“/[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))/”,… Read More »

Starting dovecot: Fatal: listen(993) failed: Address already in use

On some servers Dovecot doesn’t start automatically after reboot. That is a fault of the system administrator, but if you need to bring it back working there is a solution, that seems to be effective with all instances of listen() failed. Let’s take we’re trying to start dovecot and getting the following error: Fatal: listen(993) failed: Address already… Read More »

How to Create a WordPress Theme in 5 Minutes Without Any Skills

Just sharing a free service that allows you to cteate your own Worpress theme in just minutes without any specific skills. Even more: you’re getting a WYSIWYG editor and you can preview your changes instantly. Absolutely no skills are required: HTML, CSS and WordPress widgets may also be kept away. Here is it: WordPress Theme Generator. I consider… Read More »

How to Convert HTML Link Code into BBCode With PHP

Another short function appears on my blog. If you need to convert your HTML code, containing links only, into BBcode, you need this function: function make_bbcode($normal) { $samurl=str_replace(“<a href=”, “[url=”, $normal); $samurl=str_replace(“</a>”, “[/url]”, $samurl); $samurl=str_replace(“>”, “]”, $samurl); return($samurl); } That’s a very simple solution that doesn’t cover all the instances of HTML code. If you need a good… Read More »

How to Use Double Variables in PHP Scripts

I’m coming with a small piece of code that contains a sample of double variable usage. Let’s take we have a script that transmits lots of parameters, named activ1, activ2, activ3… activn. How should we work with them? A simple solution is pasted below. for ($i=0; $i<10; $i++) { $varname=”aktiv”.$i; if (isset($$varname)) { // Do anything you want… Read More »