Web Site Authoring Technical Guidelines
Please avoid using Front Page extensions. please contact me john@weider.cc for alternatives. The Front Page Web Publishing Wizard is ok to use, if you have a problem with your username and password let me know.
All documents with the extentions .htm, .html, and .php are passed through our PHP Hypertext Processor for real time server side processing. Some examples of how to exploit this feature are documented below.
Please see the php manual for information.
All documents have access to our custom program utilities which are described below.
Site Administration: To set up and maintain html,xml, ccs, templates for your site, View your access log, View active site connections, or Manage site users/authorizations go to www.YOUR_SITE_NAME/admin.html. If you don't know your userid and/or password contact me.
Hit Counter: To include a hit counter anywhere in your page insert the code <?=hitcounter()?>
This perticular page has been hit 193718 times.
Form Email: In your form include the fields EMAIL_TO, EMAIL_SUBJECT, and EMAIL_BODY. In your forms target include <? process_mail_form() ?> somewhere where it will get executed (note: the EMAIL_SUBJECT field is optional.) The email recipient will recieve the contents of EMAIL_BODY followed by a newline seperated list of all of your other form fields and their values.
Current Date and Time: For a timestamp use <?= timestamp() ?> Right now it is Wed, 16 Oct 2024 01:52:58 AM
Objects The Following php pear objects are persistant therefore you do not need to include() or require() them: Database.php, HTML/Table.php, HTML/Form.php.
see the PEAR Documentation for some of the other objects you may use.
Security Use the user manager through the admin interface (see above) to set up users and privleges. Then at the very beginning of the file containing the page(s)
you want secured include the code <? secure(); ?> this will require a userid and password for a user to access the page. You may also
use <? secure(array('required_privlege1','required_privlege2')); ?> to require not only a userid and password but the user must also hold all of the
specified privleges. Note that the array() function is not neccessary when specifying only one privlege.
External Database Please use DB for all external database access. The following external RDBMS connections are supported: mysql (MySQL), pgsql (PostgreSQL), ibase (InterBase), msql (Mini SQL), mssql (Microsoft SQL Server), oci8 (Oracle), sybase (SyBase), ifx (Informix), fbsql (FrontBase),
and for all others odbc (let me know the driver and connection details and I'll set it up.)
Database Use our Database Object Class for Database access. Each site has it's own database with the same name as the site, for example www.weider.cc's dataabse name is weider.cc
Each site automaticly has a global connection to it's own database through: $GLOBALS['dbx'].
Create a new connection to a different database with $db_connection = new Database("database name");
Following is a list of the Database objects meathods:
Database()
|
Instanciate a new Database object. Optionaly pass a postgres connection string to connect to a database other than your sites default database.
|
query($sql)
|
Execute the passed query and return the results in the form of a RecorSet object (see below)
|
val($sql)
|
Executes the query and returns a single value ( if the query results in more than one value and or record the first value from the first record is returned.
|
rec($table,$key)
|
Returns an associative array containing the field names and values of a record from the named table. if a key set is passed in the form $key['fieldname']=>$fieldvalue, the resultant record is returned otherwise a blank record is returned.
|
write($table,$rec)
|
write the record $rec to the table $table. (you can use rec(tablename) to get an associative representation of a record then set the attributes to the new values and use write to insert the record.
|
delete($table,$key)
|
delete records from a table, if no key is passed the table is cleared.
|
update($table,$record,$key)
|
updates the record(s) matching $key with the values in $record.
|
row($sql)
|
executes sql statement and returns the first resultant record.
|
col($sql)
|
executes sql statement and returns an array cotaining all the values of the first resultant field.
|
assoc($sql)
|
executes sql and returns an associative array of the form $ary['resultant_field_one']=>resultant_field_two
|
typ($table)
|
returns an associative array containing field names and field types of the specified relation. ie $x['field_name']=>field_type
|
sysctl($spec,$fld,$tbl,$fmt)
|
retrieves,updates, and/or returns system control data.
|
Recordset Recordset Object Meathods
next()
|
Retrieves next (or first the first time it is called) record from the recordset) returns NULL when there are no more records to read.
|
next('OBJECT')
|
like next() but returns record in the form of an object with properties so that fields may be accessed like: $record->fieldname
|
next('ENUM')
|
like next() but returns the record in the form of an enumerated array so that fields are accessed bu ordinal position number starting with zero, like: $record[0],..., $record[n].
|
fieldtypes()
|
returns an associative array of the form $x['field_name']=>field_type representing the datatypes of all fields in the recordset.
|
free()
|
free all storage associated with the recordset. Do this when you are finished using the recordset.
|
Database Query/Report Utility For report output in a table format use the dbtable utility.
Insert the code <?= dbtable($prm) ?>
where $prm is an associative list of parameters to pass to the dbtable engine,
Only assign the parameters you are using, Assign a single value to a parameter with: $prm['PARAMETER_NAME']='PARAMETER VALUE';
Assign an array or list to a prameter with: $prm['PARAMETER_NAME']=array('ELEMENT 1','ELEMENT 2','ELEMENT 3);
See below for available parameters, (you can contact me for help.)
Database Entry/Inquiry/Maintenence Utility For record inquiry, update, and entry utility use <?= dbform($prm) ?>.
where $prm is an associative list of parameters. Following is a list of parameter keys that both dbtable and dbform use. An R indicates a required parameter,
an O indicates an Optional parameter, and a blank indicates the parameter is not used. An astrisk means Required sometimes, see description for information.
key | Description of Value | dbtable | dbform |
sql | sql select statement to execute. (include the field "'edit' as edit" to allow record updates, include the field "'view' as edit" for inquiry. | R | R |
totals | Array of field names to track and print totals for. | O | O |
levelbreaks | Array of field names to print headings and totals for. | O | O |
database | URL of database to connect to, defaults to site database. | O | O |
edit_key | Array of field names that form a primary key for the record set. Required only if table is specified. | | O* |
table | Name of table for Add record operations and Update operations | | O |
id | An arbitrary identifier used to identify the forms in the case you have more than one dbform on a page. Required if using more than one dbform on a single page. | | O* |
title | Title to use on tables and forms. | O | O |
addnew | if true allow new records to be entered, otherwise don't | O | |
update | if true allow records to be updated (edited), otherwise don't | O | |
delete | if true allow records to be dsleted, otherwise don't | O | |
add_defaults | Assosiative List of field names and there default values used for add operations. (for example $prm['add_defaults']=array('fieldname'=>'defaultvalue',...); | O | |
User Registration System To require users to register to your site before allowing them to viw certain pages: first create a user registration table with at least username and password fields. Then wrap an if statement around the content you wish to protect with a call to require_registration($prm) (ie. if(require_registration($prm) { ...} The user will be able to continue after he or she has logged in or registered, nothing will be displayed if the user is already registered and processing will continue with whatever is within the if block. $prm is a collection of parameters with keys as follows:
key | Description of value | Required |
userdb | Name of user info table. | Y |
userfield | Name of Field containing username. | Y |
passwordfield | Name of field containing Passsword. | Y |
emailfield | Name of field containing email address. | N |
registration_panel | Name of file containing Registration Form. | Y |
login_prompt_panel | Name of fil,e containing login prompt form. | Y |
wrong_password_panel | Name of file containing Wrong Password message. | N |
form_validator | Parameters to pass to the form_validator function (see form_validator()) | N |
The Request Variable "o" controls the state of the user registration system:
?o= | | Example url |
updt | Validate registration form and update users registration record. | index.html?o=updt |
vrfy | Validate login prompt | index.html?o=vrfy |
rgst | Issue Registration Form | index.html?o=rgst |
pmpt | Issue Login Prompt | index.html?o=pmpt |
empw | Email password to users prieviously registered email address (userid must be set in the request also) | index.html?o=empw&user_field_name=< ?=urlencode($rec['user_field_name']) ? > |
Here is an example system control/dbdict table
spec |
tbl |
fld |
fmt |
OPR-ADD |
|
|
|
|
|
am |
return ($LEFT + $RIGHT); |
PRT-FMT |
|
|
|
|
|
am |
return sprintf("%01.2f",$VAL); |
|
|
br |
return sprintf("%01.3f",$VAL); |
|
|
fn |
return strftime("%r",$VAL); |
|
|
hrs |
return sprintf("%01.3f",$VAL); |
|
|
rb |
return (($VAL=='t') ? 'cash' : 'credit'); |
|
|
st |
return strftime("%r",$VAL); |
TBL-COL-ATR |
|
|
|
|
|
am |
ALIGN=RIGHT |
|
|
br |
ALIGN=RIGHT |
|
|
cs |
ALIGN=LEFT |
|
|
dt |
ALIGN=LEFT |
|
|
fn |
ALIGN=LEFT |
|
|
hrs |
ALIGN=RIGHT |
|
|
mm |
ALIGN=LEFT |
|
|
pr |
ALIGN=LEFT |
|
|
rb |
ALIGN=CENTER |
|
|
st |
ALIGN=LEFT |
|
|
ty |
ALIGN=LEFT |
TBL-COL-HDG |
|
|
|
|
|
am |
Amount |
|
|
br |
Break |
|
|
cs |
Customer |
|
|
dt |
Date |
|
|
fn |
Finish Time |
|
|
hrs |
Hours |
|
|
mm |
Notes |
|
|
pr |
Project |
|
|
rb |
Cash/Cr |
|
|
st |
Start Time |
|
|
ty |
Type |
|