<?php #create form object $staff = new Formitable($db, 'sionapros_users'); #set primary key field $staff->setPrimaryKey('identifier'); #set encryption key $staff->setEncryptionKey("g00D_3nCr4p7"); #set identifier field $staff->setIdentifier('identifier'); #unique username $staff->uniqueField('username', "This Username already exists"); $staff->forceTypes(array('identifier', 'password', 'reg_date'), array('hidden', 'password', 'hidden')); $staff->forceTypes(array('change_password', 'account_status'), array('hidden', 'hidden')); #custom labels $staff->labelFields(array('firstname', 'lastname'), array('First Name *', 'Last Name *')); $staff->labelFields(array('username', 'password'), array('User Name *', 'Password *')); //set up regular expressions for field validation $staff->registerValidation("required", ".+", "Field MUST be filled in please."); #$staff->setDateField('account_expiry_date'); $staff->setPasswordField('password'); //set up fields for validation using regexs above $staff->validateField("firstname", "required"); $staff->validateField("lastname", "required"); $staff->validateField("username", "required"); $staff->validateField("password", "required"); #set default values $staff->setDefaultValue('reg_date', date("Y-m-d H:i:s")); $staff->setDefaultValue('change_password', 'Yes'); $staff->setDefaultValue('account_status', 'Active'); //set all output to be returned instead of printed