Live data from Hacker News

Just open sourced my 10k LOC PHP & MySQL invoicing app

github.com

21–30 of 101 posts

Re: Just open sourced my 10k LOC PHP & MySQL invoicing app

#21
post #8

I can't believe you hardcoded this for MySQL instead of using PHP's excellent and versatile PDOs, and I can't believe the 10k line count. Gosh. Is "de-engineering" a suitable term here? Thumbs up for open sourcing your work, though.

This is the sort of comment that keeps a lot of people from publishing their source code.

Make a pull request, sir.

Re: Just open sourced my 10k LOC PHP & MySQL invoicing app

#22
post #16

What exactly did you dislike about CodeIgniter? For me CodeIgniter is probably what I'd use if I had to go back to making PHP applications so I'd like to hear any reasons you had against it.

CI was built in the PHP4 days, and for that reason it has a lot of cruft left over. For example, there is no autoloader. Also, classes are loaded as singletons, and are assigned to properties of the controller, which I put into the 'magic' category, and isn't compatible with IDE autocomplete features (I'm a VIM user, but it makes things easier for a lot of developers).

//CI Class Load Example:

$this->load->library('example'); $this->example->something();

//Raw PHP Class Load Example:

$this->example = new Example(); $this->example->something();

As you can see, the latter is a little more obvious about what is going on.

Re: Just open sourced my 10k LOC PHP & MySQL invoicing app

#24
post #19

Just as a quick look, this thing is riddled w/ potential sql injections..a number of unchecked/unescaped uri controlled variables. In some cases there's validation of numerics w/ +=0, but in many cases (e.g. $sort_col) there's none.

The routing script should be taking care of that stuff with regular expressions.

If I'm wrong, please do let me know!

Re: Just open sourced my 10k LOC PHP & MySQL invoicing app

#25
post #19

Just as a quick look, this thing is riddled w/ potential sql injections..a number of unchecked/unescaped uri controlled variables. In some cases there's validation of numerics w/ +=0, but in many cases (e.g. $sort_col) there's none.

you mean you shouldn't trust user input?

Re: Just open sourced my 10k LOC PHP & MySQL invoicing app

#27
post #25
post #19

Just as a quick look, this thing is riddled w/ potential sql injections..a number of unchecked/unescaped uri controlled variables. In some cases there's validation of numerics w/ +=0, but in many cases (e.g. $sort_col) there's none.

you mean you shouldn't trust user input?

The arguments to controller methods (in CI) are passed through some regular expressions. CI goes as far as to destroy all GET variables (which I highly disagree with).

Re: Just open sourced my 10k LOC PHP & MySQL invoicing app

#28
post #18

Earlier quoted context omitted.

No I'm serious here, renownedmedia. Don't disregard my rant with a silly downvote, but do instead indulge yourself in the PDO methods instead of painting yourself and your projects into corners: http://php.net/manual/en/book.pdo.php

What makes you think he was the one who downvoted you? You could easily have asked him about his technical decisions without being a jerk. Besides, this was a personal project, probably created without the intention of eventually open sourcing it. If he only ever intended to use MySQL, and portability across RDBMS systems wasn't a goal, then it's fine as it is.

You hit the nail on the head. I never knew I would open source this, I didn't even plan on it getting as feature-rich as it had become.

Re: Just open sourced my 10k LOC PHP & MySQL invoicing app

#29
post #25

Earlier quoted context omitted.

you mean you shouldn't trust user input?

The arguments to controller methods (in CI) are passed through some regular expressions. CI goes as far as to destroy all GET variables (which I highly disagree with).

GET's are all removed (by default), but for uri segments you'll just get some character filters, and some anti-xss attempts (assuming you have that on). Nothing anywhere near sufficient to prevent sql injection. Again, didn't dig too deep, but I don't see any validation that would prevent me from doing some level of at least blindsql..

Re: Just open sourced my 10k LOC PHP & MySQL invoicing app

#30
post #23

I remember writing invoicing systems like this. Then I realized I probably shouldn't reinvent the wheel or break GAAP. :/

Yeah, there is a ton of competition. I started building this without having done proper research.

See, the thing is: creating an invoice is an 'accounting' event that needs to be thought out a bit. Like a double entry general ledger, receiving payments, proper audit trails, the inability to modify an invoice after 'posting' it, batches, periods, and other goodness.

Otherwise, you get this ugly term: embezzlement.

But kudos for opensourcing it and standing up to criticism from hecklers like me.

Post reply on HN