PHP: Fatal error: Maximum execution time of 30 seconds exceeded
This error happens when the execution time of the PHP script exceeds the time limit for program execution in Php.ini file.
By default the timer is set to 30 seconds in php.ini and you can track the time limit by tracing for ‘max_execution_time’ directive in php.ini.
Add comment May 28, 2009
Fahrner Image Replacement CSS
FIR stands for Fahrner Image Replacement named after Todd Fahrner.
It is a standard compliant technique in which <h1> and <span> tags are used to have nice heading and highlights.
Key fact in this technique is that the text will get displayed even if the CSS is disabled for some reason, hence presenting the text on browsers and in screen readers.
Read more
Add comment May 21, 2009
PHP Register Globals and Security Vulnerability
Register Globals directive is turned OFF from PHP version 4.2.
PHP Global Variables
Environment variables, GET, POST, Server, Cookie variables are knows as Global Variables.
When register_globals directive is turned ON (like what most ISP’s did), you can access/set the global variables like $username, $password instead of $_POST["username"], $_POST["password"].
Add comment May 20, 2009
PHP: escapeshellcmd, escapeshellarg
escapeshellcmd and escapeshellarg are two commands that are used to escape the defect causing characters that are present in the system command or the arguments that get passed to it respectively. Before passing the commands to the system or exec, the strings get escaped using these commands.
Sample program to demonstrate the usage:
<?php
// shell command
$mycmd = “ls -al”;
$returncmd = escapeshellcmd($mycmd);
system($returncmd);
// shell arguments
$myshellargs = “al”;
system(“ls -”.escapeshellargs($myshellargs);
?>
Add comment May 19, 2009
PHP Backtick operator `
PHP Backtick operator `
This is the equivalent of shell_exec() command in php. It needs to be present in pair for the commands within it to get executed at the system level.
When shell_exec is disabled or when safe_mode is enabled, this operator is disabled.
Add comment May 18, 2009
PHP XSS: htmlspecialchars vs. htmlentities
Cross site scripting XSS is a term used to refer attacks or loop holes present in the scripting used by websites favoring hackers to exploit this path towards identity theft or phishing.
In PHP, two functions are mainly used to circumvent XSS attacks.
i) htmlspecialchars
ii) htmlentities
Add comment May 17, 2009
MySQL – MyISAM, BSD, InnoDB Considerations
MySQL Table Types that are well known
- MyISAM
- InnoDB
- BSD
When making a choice amongst the different types of tables in MySQL, we need to consider the following points
- Size of database based on the activity
- Nature of database access / activity (whether it involves heavy reads / writes)
- Database backup (schema, data)
- Session handling
- If it involves a sync to another database
- What needs to be done if the application is to be scaled
Read more
Add comment May 15, 2009