Location: PHPKode > projects > Philosopher'Stone Personal > pssp/walndx.php
<?php

// Copyright (c) 2010 by Paul M. Foster <hide@address.com>
// Licensed under PostgreSQL License (see LICENSE file)

include('setup.php');

allowed(127, 5);


/* ***** FIELDS TO BE VALIDATED ***** */

$fields = array(
	'password' => array('label' => 'Password', 'type' => 'password', 'filter' => 'password', 'rules' => 'required|maxlength[20]')
);


/* ***** CLASS REGISTRATION ***** */

$sc->register('tmcrypt', array('class' => 'tmcrypt', 'shared' => true));
$sc->register('validation', array('class' => 'validation', 'shared' => true, 'arguments' => '%fields%'));
$sc->register('pwfile', array('class' => 'pwfile', 'shared' => true));


/* ***** INSTANTIATE CLASSES HERE ***** */

$v = $sc->validation;
$app_navs = $sc->appnavs;
$session = $sc->session;
$tmc = $sc->tmcrypt;
$pwf = $sc->pwfile;


/* ***** VALIDATE USER DATA ***** */

if (count($_POST) != 0) {

	$errors = 0;
	$_POST = $v->xss($_POST);
	$v->filter();
	$errors = $v->validate();

	if ($errors) 
		emsg('Your password was either too long (max 20 characters) or non-existent.');
	else {
		$password = $_POST['password'];
		$session->bfpasswd = $tmc->encrypt('crapadoodle', $password);
		if ($pwf->file_okay())
			redirect('walsel.php');
		else
			redirect('waladd.php');
	}
}

/* ***** END VALIDATION OF USER DATA ***** */


/* ***** PAGE SETUP ***** */

$meta['app_navs'] = $app_navs->get();
$meta['file_mtime'] = date("d F Y H:i:s", getlastmod());
$meta['mod_navs'] = array();
$meta['focus_field'] = 'password';
$meta['return_url'] = 'walndx.php';
$meta['app_title'] = 'Wallet';
$meta['page_title'] = 'Wallet Password';
$meta['view_file'] = fullpath('view', 'walndx');

include('generic.php');
Return current item: Philosopher'Stone Personal