RSS feed - Using POG with Flex
- Optimizing your web application
- Regenerating large objects
- PHP4 or PHP5
- New and Improved
- Evolution of a cube
- POG Museum
- POG 3.0 alpha
- Initial Performance results Part 2
- Initial performance results
- Proposal: POG 3.0 object model
- Suggest a feature
- A new year, A new POG release
- Many-Many relations
- POG 2.5 Released
- POG 2.5 beta
- Automatic table alignment
- New version: 2.1.2 released
- RSS should work well now
- RSS feed glitches
- What's new in 2.1.0
- PHP Objects 2.1.0 (preview)
- PHP Object relations FAQ
- PHP Object Relations
- Searching base64 encoded text
- How to debug POG-generated objects
- POG UI Tips
- Featuring Of Interest links
- PHP CRUD
- POG 2.0.1: A better code generator
- A look at the POG SOAP API
- POG 2.0.0 released
- Coming soon: Generate parent-child objects
- Generated abstraction v/s dynamic abstraction
- Zend Framework preview
- Coming soon: Generate Objects through SOAP
- Easily save images and files to a database
- PHP, Paypal & POG
- Five advanced Code Generator tips
- PHP Pagination using generated objects
- PHP Code Generator benchmarks
- Representing database objects using an AJAX Tree interface
- Using SETUP in a production environment
- Description of the generated object package
- Introducing PHP Object Generator version 1.6
- Using AJAX and PHP Object Generator
- When to use Object->SaveNew()
- Generating PHP objects in 2006
- Happy Holidays
- A short video of the POG Setup process
- A sneak peek at POG 1.6
- POG Tip: Field limits
- Previous versions.
- Searching the blog and tutorials sections
- Generating code with "Other" SQL data types
- Five general POG tips
- POG source code locations
- Microsoft SQL 2005 Express Edition
- Impatiently awaiting PHP 5.1 and PDO
- Php Object Generator goes open source
- POG generates PDO compatible code
- Oracle to offer free database
- POG Google group
- Database Wrappers and POG
- Revisions
- The generator blog
- An explanation of the 'Escape' function.
- Mirror, mirror
- Using POG to solve real world problems
- A php object-relational database tool
- A simple and flexible Object Oriented approach to PHP
Back to the Code Generator
The POG Google group
The POG tutorials/code samples
The POG mirror site
An explanation of the 'Escape' function.
written 1629 days agoAfter using POG for the first time, you’ll notice that some parts of your information stored in the database have been converted to Base64 before being saved. Upon retrieval of the information, the object converts the data back into its original form. So, in effect this escaping and unescaping of information is transparent to the programmer, unless you look at the database directly.
For example, let’s assume I create an object to store user login information. My object attributes are as follows:
object name = User
attribute1 = username
type1 = varchar(255)
attribute2 = password
type2 = varchar(255)
attribute3 = age
type3 = int(4)
After my `user` object has been created by POG, I use it in my code as follows:
$user = new $User();
$user->username = “joel”;
$user->password = “password”;
$user->age = 24;
$user->Save();
The `Save` command maps the user object into a user table and stores the information as follow:
-------- ----------- ---------- ----- userid username password age -------- ----------- ---------- ------ 1 am9lbA== cGFzc3dvcmQ= 17
You’ll notice that the username and password variables have been escaped before they were saved whereas the age variable wasn’t. This happened because POG only escapes mixed data and leaves numeric data unescaped. By escaping mixed data for you, POG makes your web application more secure. This prevents injection type attacks on your web app.
We chose base64 because in our opinion, it’s the most convenient. It allows us to store and retrieve entire html pages to and from our database without breaking any sql statements. If we ever need to check what’s in the database, we use an online base64 decoder/encoder.
The beauty in all this I suppose is that you don’t have to use base64 to escape your information. There’s 2 function in the database class provided by POG: Escape($text) and Unescape($text) that you can modify to change how POG saves your information.
For example, if you want POG to save everything supplied to it as-is, simply comment out the contents of the functions. Or you can also make POG encrypt your information by using the PHP Crypt() function. The choice is yours.

— Joel Nov 22, 05:10 PM #
— Gabor Tóth Jan 5, 06:57 AM #
Moreover, as from POG 1.6, there’s an interface to the database which automatically decodes the information, allowing you to peruse your data at your own leisure. Check out this video for more information.
Also, as mentioned in the article above, you can always change the way the Escape/Unescape functions work, and choose your own encoding/decoding mechanism, whether it be mysql_real_escape_string or even encrypting/decrypting methods provided by PHP.
— Joel Jan 5, 09:37 AM #
This is a weblog about the Php Object Generator (POG) project, OO PHP, databases and Php code generators in general.
Php Object Generator, (POG) is an open source PHP code generator which automatically generates clean & tested Object Oriented code for your PHP4/PHP5 application.
Subscribe to our RSS feed
Feedback, Feature Requests, Bugs to:
The POG Google group
Send us a Hello through email