Jump to content


Member Since 31 Mar 2005
Offline Last Active Today, 08:38 AM

#1490559 PHP Hashing - improve

Posted by trq on 10 September 2014 - 01:19 AM

How would you improve the hashing?

I would remove all of your code and use password_hash as it was intended.

#1489719 PHP code to trigger file download

Posted by trq on 03 September 2014 - 12:27 AM

This example should get you started:


#1489366 Functions Conflicting

Posted by trq on 30 August 2014 - 08:24 AM

Hi I found a very old outdated script for temporary banning people.

So why are you trying to use it? All of the above code needs to be thrown away.

#1486884 About 2:1 banner exchange sites and bots

Posted by trq on 05 August 2014 - 10:56 AM

Of course bots have ip addresses.

#1486288 arrays in C vs arrays in PHP

Posted by trq on 28 July 2014 - 12:16 AM

Who cares?

#1485972 How often do you use Interfaces?

Posted by trq on 23 July 2014 - 01:16 AM

It's pretty hard to write SOLID code without interfaces.

#1485550 Website Server was upgraded to PHP 5.4.30 and now doesn't work

Posted by trq on 17 July 2014 - 10:32 AM

That code is in some serious need of being thrown out.

The session_is_registered function is deprecated.
The mysql_* extension is deprecated
Short tags have long been disabled by default.

And in general it's just poor code. Moving forward, you might want the code maintained.

#1484623 Are 'registry' classes good practice?

Posted by trq on 10 July 2014 - 09:14 PM

As long as this registry is injected via __constructs I don't see it as such a bad thing. It is basically a IoC container in that case.

Just make sure that you are type hinting to a well defined interface for this Registry.

The registry pattern has the potential to cause issue when you make it a singleton that has a static getInstance() method or similar.

#1483771 Specific Criticism of CodeIgniter as a PHP Framework in 2014

Posted by trq on 04 July 2014 - 12:21 AM

I'm not sure how many valid opinions you're going to get around here. I for one have never and would have never even considered using CI. As far as I am concerned the project can't die soon enough.

I understand it was popular amongst a certain crowd of developers, and I understand that for a lot of instances it has filled a need. I also believe however that overall it has probably done more harm than good to the php landscape.

An "Abomination" is the latest term I've been using to describe it. The sooner it is gone, the better IMO.

#1483062 git with master branch only?

Posted by trq on 23 June 2014 - 07:34 AM

It is a "to each his own" type thing and no, I don't see any issue with leaving out the develop branch. I have worked at places and on projects using master & develop, master, staging and develop and master alone, it really is up to you. With fewer devs (I have found), it probably makes more sense not to worry about develop.

Make sure to always use feature branches however.

#1482763 Fatal error: Call to undefined function filter_var() on line 186 in ump .clas...

Posted by trq on 17 June 2014 - 01:20 AM

It doesn't yet exist. You'r using a terribly old version of php (nearly 8 years old, released 24-Aug-2006).

As stated in the manual, filter_var didn't exist until 5.2.

#1482677 Is it just me, or is composer / packagist.org super slow

Posted by trq on 14 June 2014 - 08:01 PM

Yes, composer often takes along time to complete dependency resolution and installation. It's quite normal.

On a side note:

Brain has it's own dependencies, which aren't all really dependencies, but I've added them all to its composer.json file so I get everything I want for a new project.

That's not how to do it. You should create a "standard-project" repo or similar and have it pull all the dependencies including this "brain" framework you speak of.

#1482427 What is a MySQL database patch?

Posted by trq on 10 June 2014 - 06:41 PM

Put simply a patch is just a file of changes that can be applied over the top of an existing file.

An example:

Given a file named foo.txt containing...

Hello World
And a patch file named foo.patch containing...

diff --git a/foo.txt b/foo.txt
index 557db03..3ef92e9 100644
--- a/foo.txt
+++ b/foo.txt
@@ -1 +1 @@
-Hello World
+Hello World, my name is trq.
Applying this patch using...

patch -p1 < foo.patch
Would result in foo.txt containing....

Hello World, my name is trq.
Patches are often used to apply changes to source code.

What I assume your host is talking about is that they will patch your database with the latest security fixes.

#1481605 What is your prefered: PDO and MySQLi?

Posted by trq on 02 June 2014 - 05:58 AM

PDO is great because it add an abstraction to the database, regardless of the database server type.
For instance, if you use mysqli functions throughout your program, and then somebody else deploys the program but they are using postgres database server, then they would have to change every single function that interacts with a database for it to work. But, with PDO, they can just change one variable, and ta daaa!

PDO is not a database abstraction. It provides you the same API across databases, but it does nothing to protected you against differences in syntax between those systems. For that you would need to use something like Doctrine's DBAL on top of PDO.

#1481515 Echo Multiple Variables as One

Posted by trq on 31 May 2014 - 06:50 PM

You do realise what you are doing is opening a huge security hole? Your basically allowing anyone to inject content directly into your page.

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime