- Introduction to POG
- Setting up PHP, MySQL etc.
- Designing your objects
- Generating your code
- Description of the generated code
- Edit configuration file
- The Setup Process
- Using the code: Save()
- Using the code: Get()
- Using the code: SaveNew()
- Using the code: GetList()
- Using the code: Delete()
- Using the code: DeleteList()
- Advanced: object relations
- Advanced: Set{Parent}()
- Advanced: Get{Parent}()
- Advanced: Add{Child}()
- Advanced: Get{Child}List()
- Advanced: Save(deep)
- Advanced: Delete(deep)
- Advanced: Add{Sibling}()
- Advanced: Set{Child}List()
- Advanced: Set{Sibling}List()
- Advanced: Get{Sibling}List()
- Advanced: DeleteList(deep)
- Customizing POG-generated code
- Customizing: Extending POG Objects
- Customizing: Plugins
- Examples
- Examples: User registration system
- Examples: User authentication
- Examples: Survey form
- Examples: Using POG with AJAX
- PDO: Introduction
- PDO: SQLite example
- PDO: Firebird example
- PDO: PostgreSQL example
- PDO: MySQL example
- PDO: ODBC example
- Troubleshooting
- Troubleshooting: Data appears encoded
- Troubleshooting: Can't regenerate object
- Troubleshooting: Can't seem to Save()
- Troubleshooting: Can't get object / object attributes from database
- Troubleshooting: Can't open zip file on Mac
- Troubleshooting: Setup screen is blank
- Videos
- Appendix: Creating table(s) manually
- Appendix: Regenerating objects
- Appendix: Generating objects using SOAP
- Case Study: Gravity GTD
- Case Study: Web Form Factory
Back to the Code Generator
The POG Weblog and RSS feed.
The POG Google group
Examples: User authentication
Assuming you’ve followed the previous tutorial and successfully created a User registration system, we’ll now build up from there and create the code to allow users to log into their account.
We need to create a simple login page (login.php) which will have a username field, a password field and a submit button. Information entered on this page by the user will them be used to verify whether or not the username/password combination is valid. If the information is valid, then we’ll simply set a status flag to “true” to indicate that the user is logged in.
The code should look something like this:
PHP:
$user = new User();
$userList = $user->GetUserList("username", "=", $_POST['username']);
if (count($userList) > 0)
{
$user = $userList [ 0 ];
}
if ($user->password == $_POST['password'])
{
$_SESSION['userId'] = $user->userId;
$_SESSION['loggedIn'] = true;
echo "User is logged in!";
}
else
{
echo "User is not logged in";
}
$userList = $user->GetUserList("username", "=", $_POST['username']);
if (count($userList) > 0)
{
$user = $userList [ 0 ];
}
if ($user->password == $_POST['password'])
{
$_SESSION['userId'] = $user->userId;
$_SESSION['loggedIn'] = true;
echo "User is logged in!";
}
else
{
echo "User is not logged in";
}
DOWNLOAD SOURCE CODE FOR THIS TUTORIAL


