Code:// all variables that are passed in from any screen should be listed here
$fields = array( array ( 'name' => 'what',
'type' => 'hidden',
'filter' => 'oneof',
'maxl' => 24),
array ( 'name' => 'choice',
'type' => 'radio',
'filter' => 'oneof',
'maxl' => 14),
array ( 'name' => 'lastname',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 50),
array ( 'name' => 'firstname',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 50),
array ( 'name' => 'address1',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 50),
array ( 'name' => 'address2',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 50),
array ( 'name' => 'city',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 50),
array ( 'name' => 'state',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 2),
array ( 'name' => 'zipcode',
'type' => 'text',
'filter' => 'integer',
'maxl' => 5),
array ( 'name' => 'uid',
'type' => 'text',
'filter' => 'integer',
'maxl' => 6),
array ( 'name' => 'rec_id',
'type' => 'text',
'filter' => 'integer',
'maxl' => 6),
array ( 'name' => 'addentries',
'type' => 'text',
'filter' => 'integer',
'maxl' => 6),
array ( 'name' => 'country',
'type' => 'text',
'filter' => 'text',
'maxl' => 35),
array ( 'name' => 'phone',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 12),
array ( 'name' => 'email',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 50),
array ( 'name' => 'pay',
'type' => 'radio',
'filter' => 'oneof',
'maxl' => 12),
array ( 'name' => 'paymentstatus',
'type' => 'radio',
'filter' => 'oneof',
'maxl' => 12),
array ( 'name' => 'mtype',
'type' => 'radio',
'filter' => 'oneof',
'maxl' => 25),
array ( 'name' => 'expiration',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 10),
array ( 'name' => 'username',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 25),
array ( 'name' => 'employerm',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'donation',
'type' => 'text',
'filter' => 'integer',
'maxl' => 5),
array ( 'name' => 'artist',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'artist',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'poet',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'performer',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'other',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'otherdesc',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 30),
array ( 'name' => 'exhibition',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'gift',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'office',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'auction',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'accounting',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'fundraising',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'expertise',
'type' => 'radio',
'filter' => 'oneof',
'maxl' => 3),
array ( 'name' => 'howoften',
'type' => 'radio',
'filter' => 'oneof',
'maxl' => 8),
array ( 'name' => 'fsgmember',
'type' => 'radio',
'filter' => 'oneof',
'maxl' => 3),
array ( 'name' => 'artist',
'type' => 'checkbox',
'filter' => 'oneof',
'maxl' => 2),
array ( 'name' => 'offer',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 35).
array ( 'name' => 'contact',
'type' => 'text',
'filter' => 'nohtml',
'maxl' => 35)
);
/*foreach($_POST as $key => $value) {
$a = $key;
$aa = htmlentities($value);
echo $a . ' ' . a . '<br />';
}
*/
$arrsize = count($fields);
for ($row = 0; $row < $arrsize; $row++) {
$type = $fields[$row]['type'];
$namef = $fields[$row]['name'];
$filter = $fields[$row]['filter'];
$maxl = $fields[$row]['maxl'];
if (isset($_POST[$namef])) {
if ($type == 'checkbox' || $type == 'radio') {
$$namef = $_POST[$namef]; }
if ($type != 'checkbox' && $type != 'radio') {
$$namef = trim($_POST[$namef]);
}
if ($filter == 'nohtml') {
if (strlen($$namef) > $fields[$row]['maxl']) {
die('system error: max length of field exceeded'); }
$$namef = htmlentities($$namef);
}
if ($filter == 'integer') {
$$namef = intval($$namef);
}
if ($type == 'checkbox') {
if ($$namef != 'on') {
die ('inappropriate value in checkbox field for ' . $namef);
}
}
if ($fields[$row]['filter'] = 'oneof') {
if ($namef == 'what') {
if ($$namef != 'membership' AND $$namef != 'superhero' AND $$namef != 'fiber' AND $$namef != 'reart' AND $$namef != 'explore' AND $$namef != 'memexh' AND $$namef != 'animals' AND $$namef != 'time' AND $$namef != 'arriva' AND $$namef != 'home' AND $$namef != 'mad' AND $$namef != 'fun' AND $$namef != 'whodone' AND $$namef != 'seasons' AND $$namef != 'pets' AND $$namef != 'nursery' AND $$namef != 'ticking' AND $$namef != 'musical') {
die ('inappropriate value in choice of what your are purchasing');
}
}
if ($namef == 'choice') {
if ($$namef != 'admin_update' AND $$namef != 'admin_delete' AND $$namef != 'admin_add') {
die ('inappropriate value in administrative update');
}
}
if ($namef == 'pay') {
if ($$namef != 'paypal' AND $$namef != 'mail check' AND $$namef != 'update') {
die ('inappropriate value in choice of payment type');
}
}
if ($namef == 'paymentstatus') {
if ($$namef != 'pending' AND $$namef != 'paid') {
die ('inappropriate value in choice of payment status');
}
}
if ($namef == 'expertise') {
if ($$namef != 'no' AND $$namef != 'yes') {
$expertise = 'no';
}
}
if ($namef == 'howoften') {
if ($$namef != 'weekly' AND $$namef != 'monthly' AND $$namef != 'one-time' AND $$namef != 'none') {
$howoften = 'none';
}
}
if ($namef == 'fsgmember') {
if ($$namef != 'yes' AND $$namef != 'no') {
$fsgmember= 'no';
}
}
if ($namef == 'mtype') {
$ch = array('Active Artist', 'Supporting Artist', 'Family', 'Student / Senior', 'Business', 'Donor', 'Patron', 'Benefactor', 'Visionary', 'Sustaining Visionary');
if (!in_array($$namef, $ch)) {
die ('inappropriate value in choice of member type');
}
else {
if ($$namef == 'Active Artist') {
$amount = '35';
}
if ($$namef == 'Supporting Artist') {
$amount = '50';
}
if ($$namef == 'Family') {
$amount = '75';
}
if ($$namef == 'Student / Senior') {
$amount = '25';
}
if ($$namef == 'Business') {
$amount = '100';
}
if ($$namef == 'Donor') {
$amount = '135';
}
if ($$namef == 'Patron') {
$amount = '250';
}
if ($$namef == 'Benefactor') {
$amount = '500';
}
if ($$namef == 'Visionary') {
$amount = '1000';
}
if ($$namef == 'Sustaining Visionary') {
$amount = '2500';
}
}
}
}
}
else {
$$namef = ''; // this will assure that any non posted "variables" are at least initialized
}
}
// radio buttons not selected
if (empty($expertise)) {
$expertise = 'no';
}
if (!empty($howoften)) {
$howoften = 'none';
}
|