PHP Developer – Loops in General

There are 3 types of loop in PHP: while (condition) { code_goes_here; } do { code_goes_here; } while (condition); for(expr1, expr2, expr3) { code_goes_here; } In terms of the ‘for’ loop above, ‘expr1’ being the starting expression, i.e. $i=0. expr2 being the condition that must be satisfied to keep the loop running, i.e. $i < 100. expr3 being the expression evaluated each time the loop runs, i.e. $i++. Each loop type has it’s uses. […]

By | November 15th, 2009|Development, PHP, PHP, PHP Articles|0 Comments

Freelance PHP Programmer – Managing Estimates

Dealing on larger projects and mediating between my PHP development team and the Client is often a far simpler task than acting as a sole freelancer. Having a very good and reliable team of 12 long term offshore PHP programmers, means that I now have sufficient confidence that I could theoretically just pass their overall estimates straight on to the Client without issue. Even still, I add at least 10% to the PHP developer’s estimates as well as subtracting at least 10% from the Client’s final delivery date. If we’re all happy and can agree on those deadlines, great. This allows for a comfort period for us, as well as the ability to iron out bugs and perform good QA on anything delivered. […]

By | November 10th, 2009|PHP, PHP, PHP Articles|0 Comments

PHP Programmer – Modulo Operator

All major programming languages have it, it’s the modulo operator, and it has multiple uses. First I’m going to explain what it is, then I’m going to demonstrate one very simple, very powerful use. Programatically, the modulo operator is most commonly denoted with a percentage ‘%’ symbol. Given two numbers as input, the modulo operator returns the remainder after division. p = a%b; will return the remainder after a is divided by b. Here are some examples: 2%2 = 0 (2 divided by 2 = 1 remainder 0) 6%2 = 0 (6 divided by 2 = 3 remainder 0) 7%2 = 1 (7 divided by 2 = 3 remainder 1) 18%4 = 2 (18 divided by 4 = 4 remainder 2) The modulo operator is used extensively in cryptography, Diffie-Hellman (DH) Key Exchange is just one example. As a PHP Programmer, what can this be useful for? […]

By | October 5th, 2009|Development, PHP, PHP, PHP Articles|0 Comments

Security Consultant – PHP Developer – SQL Injection Attacks

One of the most common form of attacks against web applications is SQL Injection. In the most part, the language that the web application is written in is irrelevant, be that PHP, ASP, Python, Perl, C, etc. As long as the back end database uses something SQL based, be that MySQL, MSSQL, etc, again, we’re in business. This probably covers over 99% of web applications out there. Both the security consultant and the php developer or web application developer in general has to be aware of the implications of SQL Injection. Here’s how it works: […]

By | September 6th, 2009|Development, MySQL, PHP, PHP, PHP Articles, Security Consultant, Technology|1 Comment

Security Consultant – PHP Developer – Exploiting Common PHP Code Flaws

There are a number of PHP and in fact programming errors in general that PHP Programmers and Security Consultants need to be aware of. Specifically, how can a malicious user use the code to gain access above what he is supposed to. Cross Site Scripting (XSS), Shell Execution and SQL Injection are all issues that programmers need to be aware of. Luckily, buffer overflows in their traditional sense are not something that PHP developers need to concern themselves with. Here in it’s most basic sense is an example of how we can read arbitrary files on the filesystem that we should not have access to. […]

By | September 4th, 2009|Development, PHP, PHP, PHP Articles, Security Consultant|0 Comments

PHP Developer – PHP Sessions

Sessions are a useful web technology that are used on just about every interactive site out there. Sessions are an important part of all PHP development. A session is a useful method of keeping track of a user’s browser throughout different page requests. The session is dealt with via a cookie sent to the user’s browser, with an expiry time of 0, that is to say, as soon as the browser window is closed, the cookie is destroyed and the session is over. Examples when you might use a session: A user logs in to your site, on successful login, a session is created, and the ID stored in the database along with the user’s username and password. The user does not need to pass his username and password to subsequent pages as he’s recognised by his session ID. A user is not required to log in, however as he selects options and browses through subsequent pages, we store his information entered in a session. It is important that a PHP developer also know what not to do in a session: Do not store sensitive information in a session. It’s just a plaintext cookie sent each time the browser requests a page from your site. Do not initialize a session on the site’s landing page unless you have good reason to. Some browsers do not accept cookies and besides, it’s not polite to trigger a cookie on the user’s machine without him performing an action that warrants it. […]

By | August 10th, 2009|Development, PHP, PHP, PHP Articles, Technology|0 Comments

A Beginner’s Guide to Object Oriented Programming (OOP) in PHP5 – Classes, Objects and Methods

***Guest Blogger*** The Personal Home Page (PHP) programming language provides a lightweight framework and foundation for Web application development. It runs on Apache (HTTP) Web server software amonst others, embedded into Hypertext Markup Language (HTML), passed through a Hypertext Preprocessor. As free, open source software – it has low implementation, maintenance and debugging costs. Its latest iteration called PHP5, has incorporated even more powerful object-oriented programming functionalities. While PHP3 has rendered server-side scripts and PHP4 has established backward compatibility, PHP5 has improved object-oriented programming (OOP) as a cross-platform language. OOP bundles data and code into “objects”. PHP5 works better with object handles; passing or assigning by reference is not required. […]

By | January 27th, 2009|Development, PHP, PHP, PHP Articles, Projects, Technology|0 Comments

PHP – fsockopen, TCP and UDP

PHP comes preloaded with a good socket handling function set. Using fsockopen to make HTTP connections however is in most cases obsoleted as the php-curl and set of curl functions covers more HTTP related stuff than you could ever need! fsockopen is available in both PHP4 and PHP5 Regardless, to cover the most basic usage of fsockopen, to establish a TCP connection to “mailserver” on port 110 (POP3): […]

By | January 15th, 2009|Development, PHP, PHP, PHP Articles|0 Comments