phpLens
 home  products examples manual  faq support forum  contact news  login store

More Examples:   Run: Registration Demo

Free Download

<?php
include_once('../admin.php');
include_once(
PHPLENS_DIR.'/phplens.inc.php');
session_start();
    
    
//----------------------------------------
    // The following lines are for formatting
    // the page and not needed by phplens
    
$gTitle = "Registration Demo";    
    include_once(
'./header.php');
    
session_register('gNewUser');
    
    if (isset(
$HTTP_POST_VARS['lens_FC_USERID'])) {
        
$gNewUser = $HTTP_POST_VARS['lens_FC_USERID'];
    } else
        
$gNewUser = '';
    
    
//----------------------------------------------------
    // setup lens and render it with persistent connection
    
$lens = PHPLensPConnect (
        
'ex305',    // id to uniquely identify this phplens setup
        
"select * from lensusers", // userid never found
        
'mysql',     // database server type, eg. pgsql, odbc, mssql, oci8
        
$gEX_server,    // eg. localhost or ODBC DSN
        
$gEX_userid,    
        
$gEX_password,    
        
$gEX_db2);    // optional, name of database to connect to
    
    
if ($lens) {
        
$lens->firstState = 'NEW';
        
$lens->validation = 'EMAIL^=email;USERID^Xxxxxxxxxxxxxxxxx^Must be A-Z or 0-9, no spaces';
        
$lens->redirectOnInsert = 'ex306.php';
        
$lens->redirectOnInsertCancel = 'ex305cancel.php';
        
        
$lens->password = 'secret';
        
$lens->canEdit = true;    // Show Edit Button
        
$lens->canNew = true;    // Show New Record Button
        
$lens->keyTable = 'lensusers';    // Save Data Table
        
$lens->keyCol = 'USERID';    // Primary Key of Save Data Table
        
$lens->pageSize = 10;    // rows per page
        
$lens->textInputMax = 32;
        
        
$lens->nameLens =
        
'COUNTRY^Country^^^;CREATED^CREATED^^^;LASTMOD^LASTMOD^^^;AGE^Age;'
        
.'PASSWORD^Password^^^;USERID^User ID^^^;FIRSTNAME^First Name^^^;'
        
.'LASTNAME^Last Name^^^;EMAIL^email^^^;ADDRESS1^Address Line 1^^^;'
        
.'ADDRESS2^Address Line 2^^^;POSTCODE^Postcode^^^;CITY^City^^^;STATE^State^^^';
        
$lens->newLens = 'USERID;PASSWORD;FIRSTNAME;LASTNAME;EMAIL;ADDRESS1;ADDRESS2;'
                
.'CITY;POSTCODE;STATE;COUNTRY;AGE';
        
$lens->readOnlyLens = 'CREATED;LASTMOD';
        
$lens->defaultLens = 'CREATED^=time();LASTMOD^=time()';
        
        
$lens->lookupLens =
            
'COUNTRY^=Other/Other/Australia/Australia/Canada/Canada/China/China/France/France'
            
.'/Germany/Germany/Hong Kong/Hong Kong/India/India/Italy/Italy/Israel/Israel'
            
.'/Japan/Japan/South Korea/South Korea/Malaysia/Malaysia/Mexico/Mexico/Russia/Russia'
            
.'/Singapore/Singapore/Spain/Spain/Taiwan/Taiwan/UK/UK/United States/United States';
        
$lens->mustFill = 'USERID;PASSWORD;LASTNAME;EMAIL;ADDRESS1;COUNTRY;CREATED;LASTMOD';
        
$lens->textareaLens = 'ADDRESS1;ADDRESS2';    // Treat as blob: show input as text area
        
        
$lens->Render();
        
$lens->Close();
    }
?>
<h4>Notes</h4>
Password is <i>secret</i>. Redirect on successful Insert to ex306.php. All fields that have a title beginning with Password
(configurable in language file) will be set to input type=password.


<?php        
include ('./footer.php');
?>


email: info#phplens.com (change # to @)     telephone (malaysia): 60-3 7806 1216     fax (malaysia): 60-3 7806 1210