Archive for the 'PHP' Category


2 Projects You Would Like To Use 0

ClickHeat
ClickHeat is a visual heatmap of clicks on a HTML page, showing hot and cold click zones.

MoreCSS
Javascript effects - CSS syntax (where it should be). No new syntax to learn. No programming skills needed.

Hide versions from port and services scan (NMAP) 0

I stumbled on some posts about scanning a site and detecting a server services versions. Someone pointed out a nmap tool, and I checked it against my own server. The result was not so good - Apache and ProFTPD reveled its versions. So, I was determined to change that - I want the least version information. The NMAP command is:

nmap -sS -sV -O www.yourserver.com

Secure and hide version information:

  • OpenSSH, tcp/22, not possible to change banner but yous should change the port, disable root login, etc.
  • Telnet, tcp/23, I prefer to disable Telnet. If not, use this (change file /etc/issue.net)
    mv /etc/issue.net /etc/issue.net-original
    echo "Windows Server 2008 (Microsoft)" > /etc/issue.net
  • PHP, disable expose_php for security reasons in /etc/php.ini
    expose_php = 'off'

That’s about it. I believe there is more, and if someone wants to add something, just comment on this post.

Right-trim the text at word boundaries 0

Very interesting post about the trimming the right part of a text at word boundaries, but without losing a text content completely - so called Accessible. This is very usefull in displaying article titles in any CMS system. The blog post is here: Breaking the text at word boundaries.

The effects of CSS minifying 0

I needed to implement some CSS compression, and minification, so I made some tests regarding the improvements. The content is delivered by Apache’s GZIP deflate, so the only thing to check was the effect of putting all CSS in one file, and packing it afterwards. For me, the results were surprising.

  1. Original file, after GZIP (19 CSS files) - 22Kb
  2. Just included into one big file - 17Kb
  3. In one file, removed comments and newlines -11kb
  4. One file, PHP cssTidy-ed - low compression - 10Kb
  5. One file, PHP cssTidy-ed - high compression - 10Kb
  6. One file, PHP cssTidy-ed - highest compression - 10Kb

The most interesting part was a difference between 1. and 2. I’m not sure why this happened. The other curious thing is that basically cssTidy compression does not improve much (besides it does changed some margin that I noticed, and did not wanted).

My conclusion: packing all CSS in one file and removing comments and  newlines is quite enough.

Return values from included files 0

Something I did not know, but when I found it on this post, then I just realized that is include somewhere in PHP manual, so I quote from original manual entry.

“If called from the global scope, then execution of the current script file is ended. If the current script file was include()-ed or require()-ed, then control is passed back to the calling file. Furthermore, if the current script file was include()-ed, then the value given to return() will be returned as the value of the include() call. If return() is called from within the main script file, then script execution ends.”