background preloader

PHP

Facebook Twitter

PHP Password Hashing Tutorial. Www.phpguru.org. Using Iterators in PHP. His article shows you how to use the most important iterator classes: ArrayIterator, DirectoryIterator, FilterIterator, and so forth, found in the Standard PHP Library (SPL), and how to integrate SPL with PHP Data Objects (PDO). The Standard PHP Library The SPL represents a collection of interfaces and classes for PHP 5 that help resolve some common problems and that let developers take full advantage of object-oriented programming. Some of the SPL's most used capabilities are: advanced array access, the ability to customize collection iteration with foreach or while, enhanced file and directory access, and advanced SimpleXML object handling. But the best new functionality that the SPL provides comes in the form of iterators. According to Wikipedia, an iterator is an object that allows a programmer to traverse through all the elements of a collection, regardless of its specific implementation.

There are several different types of iterators, each discussed in more detail below. <? BBCode-Parser mit [noparse]-Tag selbst gemacht. Dieses Tutorial zeigt die Programmierung eines eigenen BBCode-Parsers. Grundkenntnisse im Umgang mit Regular Expressions (kurz: RegEx) sind sehr vorteilhaft, um die Funktionsweise nachvollziehen zu können! Inhaltsverzeichnis 1) Einleitung und Bezug 2) Die Ausnahme "[noparse]" 3) Das Kernstück: Der Reguläre Ausdruck (RegEx) 4) Die Parameter-Zeichenkette nutzbar machen 5) Umstellen der Callback-Funktion 6) Ein paar einfache Beispiele 6.1) Beispiel: Fett, kursiv und unterstrichen 6.2) Beispiel: URLs 7) Die Verwendung optionaler Parameter 8) Nicht existierende BBCodes im Text belassen 9) BBCodes ohne Close-Tag 10) Zusammenfassung 11) Abschließende Worte 1) Einleitung und Bezug (Zurück zum Inhaltsverzeichnis) Als Basis für dieses Tutorial benutze ich das Beispiel von php.net: PHP-Code: return preg_replace_callback ('°\[indent]((?

Ich habe das Beispiel bereits ein bisschen angepasst, was die Benennung der Funktion und der Variablen belangt. 2) Die Ausnahme "[noparse]" (Zurück zum Inhaltsverzeichnis) Class that parses BBCodes for PHP. Project homepage This is the project homepage of the StringParser_BBCode class. With the help of this class it is possible to parse so-called BB-Codes. Often this undertaking is solved by the use of regular expressions. But regular expressions do not provide the means that are necessary to ensure correct nesting. The class was tested with PHP 4.1.2, 4.3.8, 4.3.9, 5.0.2 und PHP 5.1.2 successfully. This project is also listed at freshmeat where you can subscribe this project and get informed if new versions appear. Download The current version of the class is 0.3.3. Documentation An english documentation of this class is available, as is a PHPDOC dokumentation. If there are questions, suggestions or cirticism regarding this class I will answer them via electronic mail.

Developement If someone wants to help me with the further developement of this class he may contact me. Thanks I thank everybody who had helped me to improve the class but special thanks go to: Alternative projects Further Links. XML-RPC for PHP. PHP Login System with Admin Features. Search for photos using PHP and flickr. I have found one of the best places to find pictures to use on my websites is Flickr. They make it fairly easy to automatically embed Flickr photos onto your website using the Flickr photo search. This Flickr API tutorial will show you how to use the Flickr API to retrieve and display Flickr photos on your own website. Before using the Flickr photo search API and the PHP tutorial I am sharing with you here, make sure you consider the copyrights assigned to each image. Many of the photos and illustrations on Flickr remain under copyright and will require attribution and/or permission to use on your own projects.

How to use the Flickr API As you may know, the Flickr API provides web developers with a number of tools for accessing their image database. Flickr API authentication The API methods that we will use in this tutorial do not require authentication. Choose the required key type, provide some information about your application and submit the form. Flickr PHP Class Suggestions. SQL injection. A Classification of SQL injection attacking vector until 2010. In a 2012 study, security company Imperva observed that the average web application received 4 attack campaigns per month, and retailers received twice as many attacks as other industries.[2] History[edit] The first public discussions of SQL injection started appearing around 1998.[3] For example, a 1998 article in Phrack Magazine.[4] In 2013 Emperor Blackhat performed SQL injection attacks for educational purposes that had never been done before.

Forms[edit] SQL injection (SQLI) is considered one of the top 10 web application vulnerabilities of 2007 and 2010 by the Open Web Application Security Project.[5] In 2013, SQLI was rated the number one attack on the OWASP top ten.[6] There are five main sub-classes of SQL injection: Classic SQLIBlind or Inference SQL injectionDatabase management system-specific SQLICompounded SQLI The Storm Worm is one representation of Compounded SQLI.[11] Technical implementations[edit] ' or '1'='1. Prepared Statements in PHP and MySQLi – Notebook | MattBango.com. This article is intended for readers who have experience using PHP and MySQL. You should also have a general understanding of databases and programming (both procedural and object-oriented) as well as how to use PHP to execute a simple query to MySQL.

I will not cover how to install PHP or MySQL, however at the end of the article are some links to help you get started with the installation process and for some further reading on the subject. I will be covering the basics of prepared statements in PHP and MySQLi and why you should consider using them in your own code as well as some technical explanation as to why you should use them. Introduction If you are like me and most other people, you probably have not taken the time to learn about web security when you first started writing server-side code. Prepared statements are more secure.Prepared statements have better performance.Prepared statements are more convenient to write. The Well-Known Way What is the problem with this code? Summary. How to Break Web Software: Functional and Security Testing of We. Useful Classes And Libraries For PHP Developers « PHP Twitter. Numerous PHP Frameworks have evolved to enable rapid web development with PHP.

However even greater number of standalone PHP libraries and classes are available which provide similar benefits. W3Avenue has compiled a list of some really useful classes and libraries that every PHP developers should be familiar with. Whether you like to use a PHP Framework or prefer to work without one, your productivity can multiply with the help of these libraries and classes. Database ADOdb An object oriented library written in PHP that abstracts database operations for portability. Doctrine Doctrine is an object relational mapper (ORM) for PHP 5.2.3+ that sits on top of a powerful database abstraction layer (DBAL). A set of PHP classes mimicing C#3.0’s LINQ (Language Integrated Query) extension methods.PHPLinq currently features: LINQ operators (select, take, skip, orderBy / orderByDescending, thenBy / thenByDescending), Lambda expressions, and Anonymous types.

Mimesis Development PHP CodeSniffer Document. Blog Tool and Publishing Platform. How To Display Author Photo and Bio in Wordpress. How to Create WordPress Shortcodes | Nettuts+ PHPLinq - LINQ for PHP - Language Integrated Query. PHP OpenXML API. PHP NuSOAP Tutorial. Overview The purpose of this tutorial is to discuss in detail how to create a NuSOAP/PHP/SOAP web service using Adobe Dreamweaver CS4. This tutorial is ideal for beginners and experts alike. I wrote an article some time ago discussing how to develop SOAP/PHP web services using NuSOAP. This was a very general tutorial and didn’t go into much detail in relation to actually writing your first web service.

This tutorial uses some code from Scott Nichol’s website. Prerequisites This tutorial quotes text, code and ideas from the original Developing SOAP Web Services with PHP/C# tutorial. Introduction A web service provides us with a means of communication between a client/server configuration. NuSOAP is a third party plug-in that brings this functionality to PHP with all of the leg work done for us. Introduction to NuSOAP NuSOAP provides all the code pre-written that we need to create our web service. NuSOAP supports the following features: Runs independently. Hello, World! Hide Copy Code Consumption.

PHP 5.3

Type Hinting. People often ask about scalar/basic typehints. Here is a drop in class that I use in my MVC framework that will enable typehints through the use of a custom error handler. Note: You should include this code above all other code in your include headers and if you are the using set_error_handler() function you should be aware that this uses it as well. You may need to chain your set_error_handlers() Why? 1) Because people are sick of using the is_* functions to validate parameters. 2) Reduction of redundant coding for defensive coders. 3) Functions/Methods are self defining/documenting as to required input. Also.. <? Define('TYPEHINT_PCRE' ,'/^Argument (\d)+ passed to (? Class Typehint{ private static $Typehints = array( 'boolean' => 'is_bool', 'integer' => 'is_int', 'float' => 'is_float', 'string' => 'is_string', 'resrouce' => 'is_resource' ); private function __Constrct() {} public static function initializeHandler() { set_error_handler('Typehint::handleTypehint'); return TRUE; } return TRUE; } }

PHP.