MySQL Default DATETIME Value – A Quick Rant

20
Nov
0

I was reviewing a year old code which I am adding a feature to. It so happened I came to a familiar issue about having two timestamp/datetime columns, one which should have the CURRENT_DATE / NOW() as default value and the other with an 'ON UPDATE CURENT_TIMESTAMP'. Examine the simple structure below:

CREATE TABLE `stories` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`title` VARCHAR( 255 ) NOT NULL ,
`text` TEXT NOT NULL ,
`creationdate` DATETIME NOT NULL ,
`lastupdate` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE = MYISAM

When you want to store stories, you would also want to record when it was originally created as well track the last time it was updated. The problem here is that adding a `DEFAULT NOW()` clause will not work for the `CREATE TABLE` query above as it is not supported. So when your insert a new story you will have to explicitly add a `NOW()` function for the `creationdate` row so it will reflect the current date as creation date. This should've been a simple schema functionality, turns out after more than a year MySQL seems to ignore for some reason.

Go on have yourself a read here http://bugs.mysql.com/bug.php?id=27645

How about you, how many times have you have to work around this from your application code?

Do you favor a “LAMP (Linux, Apache, PHP, MySQL) Integrator”?

2
Aug
0

I have been reading on a number of project management articles lately and trends on open source projects. There seems to be a lot of fellow PHP developers who are as well Linux administrators for many server functions inluding HTTP servers like Apache and database administrators like for MySQL. Many of them are certified for one or more while many are jumping between careers that emphasizes one to the other thus gaining essential experiences for each.

Looking at job posts from all over the internet, you should've noticed at one time a PHP gig that requires MySQL administration skills and/or knows their way around Linux. PHP does not come by itself anymore, at least commonly, thus I've thought the term "LAMP Integrator".  A quick Google search does not seem to turn much on how to define such, thus I have a simple one.

LAMP Integrator - is a PHP developer primarily using MySQL as data backend with strong Linux administration and Apache tuning skills.

It may sound primitive, I am writing as I am thinking so comments and revisions are welcome.

Gumblar .cn – Infiltrating Hosting Accounts

20
May
0

Hosting accounts being compromised has been a common incident, however a sudden surge of this variant is quite alarming. This trojan does not target any particular software or script and is commonly exploited from a users computer where he usually FTP files to hosting accounts. The trojan scans for FTP usernames and passwords and use them to inject PHP scripts to the FTP server.

So far I have seen two variations, one being a slave for XSS attack and another as proxy or zombie perhaps for a DoS attack.

What to do or how do you know if you are infected? There is no simple prevention measure I can offer aside from asking you to scan and thoroughly clean your computer first. Download all your files from the ftp server, you can do PHP files only, however there is a probability a JS based file may exist as well. After downloading, scan all your files and reupload. Not too neat but it's the only method that works for me.