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 »

PHP Function to Generate a Human Readable Word

Sometimes you need to generate some random strings, that should be readable. A good example is CAPTCHAs: they look much better if there is something like a word on them, not just some random symbols. I’ve created a function (don’t judge me for the code, I know it could be much simpler, but it was created some years… Read More »

How to Change Last Modified Date Of The File to a Time in The Past in Linux

Today we’ll talk about a simple trick that could be used to change last modified date of a file. Certaainly, you’re welcome to use touch command to do it under Linux, and it will be the most simple way. But… if you don’t know what does this command do, you can try to do it under MS Windows.… 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 Add Zip and Unzip to Directadmin File Manager

When you’re browsing your files using your Directadmin panel, it is useful to deal with ZIP archives too. This feature is still in beta, but you’re welcome to use it as it’s quite easy to enable it. First of all we need to update our Directadmin installation. To do this we need to log in as admin and… 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 »