PHP
  Home arrow PHP arrow Page 4 - User Authentication With patUser (part...
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

User Authentication With patUser (part 3)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    2003-05-07

    Table of Contents:
  • User Authentication With patUser (part 3)
  • Making Exceptions
  • The History Channel
  • Natural Selection
  • No Distinguishing Marks
  • Big Brother Is Watching
  • Endgame

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    User Authentication With patUser (part 3) - Natural Selection


    (Page 4 of 7 )

    You've already seen, in my examination of the getUsers() and getGroups() methods, that you can apply selection criteria (as the second argument to those methods) to return a result subset containing only the records you need. Here's an example:




    <?php $list = $u->getUsers( array("uid", "username"), array( array("field" => "sex", "value" => "F", "match" => "exact") ) ); ?>
    The code snippet above would return a list of only those users who were female.

    There are three components to the second argument in the snippet above: the field, the value, and the selection criteria. The first two are fairly obvious: the "field" key specifies the field against which to match, while the "value" specifies the value against which records are to be compared. The critical element, though, is the third key, "match", which defines how the comparison between the "field" and the "value" will actually be performed.

    patUser permits comparison using any of the following conditions:

    "match" => "exact" field value equals "value" when compared in a case-sensitive manner

    "match" => "greater" field value must be greater than "value"

    "match" => "lower" field value must be lower than "value"

    "match" => "greaterorequal" field value must be greater than or equal to "value"

    "match" => "lowerorequal" field value must be lower than or equal to "value"

    "match" => "contains" field value contains "value"

    "match" => "like" field value equals "value" when compared in a case-insensitive manner

    "match" => "startswith" field value starts with "value"

    "match" => "endswith" field value starts with "value"

    "match" => "between" field value is between the "value" array (x,y)

    The following snippet would return the IDs of all users whose username contains an "e",

    <?php $list = $u->getUsers( array("uid"), array( array("field" => "username", "value" => "e", "match" => "contains") ) ); ?>
    while this one would return usernames and email addresses of all those users who have logged in more than 11 times and are over 18 years old:

    <?php $list = $u->getUsers( array("username", "email"), array( array("field" => "count_logins", "value" => "11", "match" => "greater"), array("field" => "age", "value" => "18", "match" => "greater") ) ); ?>

    More PHP Articles
    More By icarus, (c) Melonfire


     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT