Archive for the 'php-symfony' Category

Tips of the Day: phpinfo(), Code That Shouldn’t Show To Public

I notice that most of the programmer love to do phpinfo() on info.php, info.html page. But they do not know that such information may vulnerable to attacker. Some even have it as apache’s default DocumentRoot.

If you want like to use phpinfo(), it’s advice to use a random name for php filename. For example infoxxxxx.php, noinfo123123aa.php, testinfo123213.php. Beside that, you can remove the code immediately after you got what you want.

symfony / propel with RAND()

previously mentioned, symfony framework is really cool. Lately I am working on a simple online test system which doesn’t take up much of my to write the code from scratch. One of my favorite is using propel to generate the admin panel, it’s so easy, quick and code management is clean and neat.

i have a set of questions, for example 100 security related questions but some of the engineer may only need to answer 20 out of 100. And each engineer shouldn’t get the same question and using RAND() is easier for me in order to write - less code.

here is an example how you select random questions from database using propel;

$c = new Criteria();
$c->addAscendingOrderByColumn(’rand()’);
$c->setLimit(20);

start having fun coding with symfony framework.

Get Latest symfony docs with SVN

A quick one,

mkdir symfony
cd symfony
svn co http://svn.symfony-project.com/doc/tags/RELEASE_1_0_5/ .

Continuously, to get latest symfony docs, just svn up. To get full html version symfony’s documentation, here.

symfony in a freebsd box

Fast and easy symfony framework installation in your FreeBSD would be through pear. Pear doesn’t bundle with FreeBSD apache + php installation from port installation. To roll pear in FreeBSD box,

cd /usr/ports/devel/pear
make install clean distclean

p/s: if you having problem with core dump 6, try doing this

After pear is installed, do this

pear channel-discover pear.symfony-project.com
pear install symfony/symfony

Check your symfony version

symfony -V
> symfony version 1.0.5