Bananas Development Blog: share your thoughts

Pivot Tabellen mit PHP

Gonzalo Ayuso hat sich mal die Mühe gemacht eine PHP Klasse zu erstellen mit der sich Pivot Tabellen leichter erstellen lassen.

Damit kann man dann bei seinem nächsten Projekt seinen BWL'er beeindrucken.

Pivot tables in PHP

Kleine PHP Dinge die man nicht machen sollte

Es sind nicht wirklich neue und wichtige Dinge, aber solche die man auf jedenfall nicht mehr machen sollte. Manche lassen sich allgemein auf jeden Art von Programmier/Scrip Sprachen anwenden und nicht nur auf PHP.

PHP mistakes, misconceptions, bad practices and blatant no nos.

PHP Error Reporting

Argh.

Bitte, bitte immer so machen:

/**
** set the error reporting
** DEBUG has to be false in live enviroment !!
**/
if(DEBUG === true) {
ini_set('error_reporting',8191); // E_ALL & E_STRICT
ini_set('display_errors',true);
}
else {
ini_set('error_reporting',8191); // E_ALL & E_STRICT
ini_set('display_errors',false);
ini_set('log_errors',true);
ini_set('log_errors_max_len',"10M");
ini_set('error_log','path/to/error/error.file');
}

Danke.

Das erspart SEHR viel Ärger !!

Argh, not again. dot-to-underscore conversion

Eigentlich müsste ich es wissen.

Aber nein der Herr hat ja mal wieder nicht aufgepasst.
Denn ansonsten würde es ja funktionieren...grr...

Also diese Sache mit der dot-to-underscrore conversion:
Note: Dots and spaces in variable names are converted to underscores. For example <input name="a.b" /> becomes $_REQUEST["a_b"].

- http://us2.php.net/variables.external
greift leider euch bei session_name().

Wenn man da einen Namen vergiebt der einen Punkt beinhaltet, fällt man auf die Nase.
Denn man greift ja mit $_SESSION oder $_COOKIE wieder auf die Daten zu und durch den Punkt findet man die Daten nicht mehr.

Da ich ein bestehendes System kopiert habe und aber nur den Sessionname geändert, kam ich da nicht so schnell drauf.

Junge, Junge.

Also schreibt euch das hinter die Ohren.

PHP und Datenbanken. Beispiele

Hier sind Beispiele wie man sich mit den verschiedesten Datenbanktype in Verbindung setzten kann:

We can use mysql_connect and mysql_select_db functions to create our connections. For closing the connections there is mysql_close function. These are basic functions of managing connections in PHP. There are also a lot of classes made by developers for free.


Database Connections in PHP

Parse und HTML mit PHP bearbeiten

PHP Simple HTML DOM Parser

• A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way!
• Require PHP 5+.
• Supports invalid HTML.
• Find tags on an HTML page with selectors just like jQuery.
• Extract contents from HTML in a single line.


PHP Simple HTML DOM Parser

Banana
out.

Die Suche dem rechten Framework

Ich hatte ja mal schon was über die PHP Frameworks geschrieben.

Nun hat sich jemand mal die Arbeit gemacht noch mehr Frameworks zu vergleichen und auch noch in unterschiedlichen Programmiersparchen.
Das alles noch dazu graphisch schöne aufbereitet:

best web frameworks

Zu jedem Framework gibt es auch noch eine ausfürliche Erklärung.

banana
out.

modx: PHP/MySQL CMS

Bin gerade über ein OpenSource CMS gestolpert und fande den erstern Eindruckt schon mal ganz gut.

MODx helps you take control of your online content. An Open Source Content Management Framework, it frees you to build sites exactly how you want and make them 100% yours. Zero restrictions and fast to build. Super-simple templates in HTML/CSS/JS (any lib you want). Registered user systems and a killer community. Welcome to web-building nirvana.


modxcms

Not all CMSes are created equal—though from the list of features, you'd sure think they are. While having a checkbox in every column isn't a true test of the value of a CMS, it can provide a general overview of what can be accomplished in a particular system.

modx features

Mehr zu diesem Thema gibt es hier:
Die Suche nach dem richtigen CMS

Banana
out.

PHP Frameworks - Übersicht

Es gibt viele PHP Framworks.
Aber irgendwie weis man nie so recht welches man denn nehmen sollte.
Das eine kann X besser als das andere. Wiederum ist das andere bekannter als das jenige.

Dann kann man schon mal verzweifeln.

Daher gibt es hier einen interessanten Beitrag der das Ganze ein wenig anschaulicher macht und es einem dann leichter fällt eine Entscheidung zu treffen.

Discussing PHP Frameworks: What, When, Why and Which? (Mirror)

Viel spass bei der Suche und Auswahl.

Ich persönlich verwende das ZendFramework

Banana
out.

Hashing und PHP

Jeder der eine Benutzerdatenbank verwaltet, sollte die Passwörter nicht im Klartext abspeichern.
Sollte ja bekanntlich nun jeder machen.

Es gibt dazu viele verschiedene Methoden und die verschiedensten Herangehensweisen.
Hier ist nun ein Artikel der mehr darüber erklärt und auch sagt was sinnvol ist und was nicht.

Every developer should know that storing any type of password in plain text is the worst possible decision anyone can make in a secure environment. Between security and confidentiality which one will you choose? Nowadays hacking are perform through social engineering or an inside job, by an employee or trusted person. How exactly confident are you towards securing your stuff and confidentiality of your user? Most of us will know that the Reddit suffer from such problem when all their username and password were compromised as their password wasn’t hashed and stored as plain text. And twitter was attacked through social engineering recently. We won’t want this to happen to us right? Therefore, in this article you will get to know some ways to better hash your password in PHP and some ways to improve your security.

Better Hashing Password in PHP

Banana
out.

Benutzeriengaben filtern mit PHP

Ich zitiere hier einfach mal:

Data security is important and often undervalued by designers, developers, and clients alike. Since PHP 5.2.0, data sanitization and validation has been made significantly easier with the introduction of data filtering. Today, we're going to take a closer look at these filters, how to use them, and build a few custom functions.


Der Artikel ist lang und interesant. Und als PHP dev sollte man so was wissen.

I have always felt that it's easy to write code in PHP, and even easier to write bad code in PHP. The proliferation of PHP on the web has really been helped out by its use in popular open-source software packages like WordPress, Drupal, and Magento as well as major web applications like Facebook; with PHP being used in so many varied instances (dynamic websites, in-depth web applications, blogging platforms, content management systems, and e-commerce being only a subset of the many applications of PHP) the opportunities for dirty data and insecure systems are numerous. This tutorial will explain some methods of Getting Clean With PHP: Data Sanitization and Validation by focusing on several different forms of data inputs and how to use PHP filters and custom functions.


Getting Clean With PHP

banana
out.

Fehler finden in PHP

Wie macht ein Projekt Fehlerfrei und wie kommt man an die Fehler ran ?

Hier mal ein Beitrag der weiter hilft.

Nobody enjoys the process of debugging their code. If you want to build killer web apps though, it’s vital that you understand the process thoroughly.

This article breaks down the fundamentals of debugging in PHP, helps you understand PHP’s error messages and introduces you to some useful tools to help make the process a little less painful.


How to Debug in PHP

Dies ist nun kein Profi Artikel, aber die Basics sollte man ja auch können und für den Anfang sollte es reichen. Bzw. jeder Profi sollte das wissen !!

Banana
out.

Wie lerne ich PHP

Nun wenn, am Besten via "learning by doing" und einem guten Beispiel.

Dazu braucht man auch eine gute Anleitung. Die Manual von PHP ist ja schon sehr gut aber als Anfänger eher nicht zu gebrauchen.
Also hier mal ein tolles Tutorial:

This channel is basically a helping channel for people with PHP problems, but we (the staff) enjoy to discuss various topics as well ;-). You have to be aware of the fact that there is absolutly no right for help, help is a privilege. To get an answer depends much on the way how you ask your question, so take a minute or two and read the link to the left "How to ask". OP or voice does not compulsorily mean, that this person is good in PHP, and of course flags are not reward for idleing on the channel.


quakenet:#php[.de]

banana,
out

Reguläre Ausdrücke (regular expressions)

Regular expressions sind was tolles, aber auch nicht einfach.

Hier mal ein Beitrag der auch beispiele aufzeigt und die Funktionsweise erklärt.

For many beginners, regular expressions seems to be hard to learn and use. In fact, they're far less hard than you may think. Before we dive deep inside regexp with useful and reusable codes, let's quickly see the basics:


Darin sind enthalten:
+ Validate domain name
+ Enlight a word from a text
+ Enlight search results in your WordPress blog
+ Get all images from a HTML document
+ Remove repeated punctuation
+ Find page title
+ (...)

Getting started with regular expressions

Banana
out.

Wechsel von ZendStudio nach Komodo

Ich habe mal den Wechsel versucht und die Erfahrung damit niedergeschrieben.

Darin ist auch erklärt wie man Komodo und XDebug schon miteinander verbindet und auch von Browser aus debugger kann:

Wechsel von ZendStudio 5.5 zu Komodo 5.1

Banana
out.