Archive for the ‘PHP’ Category

Logitech Revolution Mouse models and Firefox

Tuesday, September 23rd, 2008

Type in address bar: about:config .

Then, after the warning screen, start typing in “Filter” field: mousewheel.withcontrolkey.action

The value of this field was, by default 3 (look at the explanation ), and you should set it to -1 to disable any functionality. This “Disable” value was not so obvious at first look. SO, to summarize:

Oh. I just found out that someone is having the same problem . Their solution is not really exact, but it will do the job.

array(&$this, 'SetVariables');
array(&$this, 'SetVariables');

Hide versions from port and services scan (NMAP)

Thursday, September 11th, 2008

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.

The effects of CSS minifying

Saturday, December 22nd, 2007

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

Saturday, December 22nd, 2007

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.”