Linux ns1.utparral.edu.mx 6.8.0-79-generic #79~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 15 16:54:53 UTC 2 x86_64
Apache/2.4.58 (Unix) OpenSSL/1.1.1w PHP/8.2.12 mod_perl/2.0.12 Perl/v5.34.1
: 10.10.1.9 | : 10.10.1.254
Cant Read [ /etc/named.conf ]
daemon
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
README
+ Create Folder
+ Create File
/
opt /
lampp /
lib /
php /
doc /
HTML_QuickForm /
docs /
[ HOME SHELL ]
Name
Size
Permission
Action
renderers
[ DIR ]
drwxr-xr-x
elements.php
6.63
KB
-rw-r--r--
filters.php
2.06
KB
-rw-r--r--
formrule.php
4.34
KB
-rw-r--r--
groups.php
4.28
KB
-rw-r--r--
rules-builtin.php
4.96
KB
-rw-r--r--
rules-custom.php
3.92
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : formrule.php
<?php /** * Examples of usage for HTML_QuickForm: fancy validation with addFormRule() * * $Id: formrule.php 236645 2007-05-29 19:12:26Z avb $ * * @category HTML * @package HTML_QuickForm * @author Alexey Borzov <avb@php.net> * @version CVS: $Id: formrule.php 236645 2007-05-29 19:12:26Z avb $ * @ignore */ require_once 'HTML/QuickForm.php'; function _validate_shipping($values) { // In Real Life (tm) you will probably query your DB for these $profiles = array('foo', 'bar', 'baz'); $errors = array(); switch ($values['profile']) { case 'personal': if (empty($values['persProfileName'])) { $errors['persProfileName'] = 'Enter the profile name'; } elseif (in_array($values['persProfileName'], $profiles)) { $errors['persProfileName'] = 'The profile already exists'; } if (empty($values['persName']['first']) || empty($values['persName']['last'])) { $errors['persName'] = 'Name is required'; } if (empty($values['persAddress'])) { $errors['persAddress'] = 'Address is required'; } break; case 'company': if (empty($values['compProfileName'])) { $errors['compProfileName'] = 'Enter the profile name'; } elseif (in_array($values['compProfileName'], $profiles)) { $errors['compProfileName'] = 'The profile already exists'; } if (empty($values['compName'])) { $errors['compName'] = 'Company name is required'; } if (empty($values['compAddress'])) { $errors['compAddress'] = 'Address is required'; } break; case 'existing': default: if (empty($values['profileName'])) { $errors['profileName'] = 'Enter the profile name'; } elseif (!in_array($values['profileName'], $profiles)) { $errors['profileName'] = 'The profile does not exist'; } break; } // switch return empty($errors)? true: $errors; } $form =& new HTML_QuickForm('frmFancy'); $form->setDefaults(array( 'profile' => 'existing', 'stuffAmount' => '1' )); $renderer =& $form->defaultRenderer(); $renderer->setElementTemplate("\n\t<tr>\n\t\t<td style=\"white-space: nowrap; background-color: #F0F0F0;\" align=\"left\" valign=\"top\" colspan=\"2\"><b>{element}</b></td>\n\t</tr>", 'profile'); $form->addElement('header', null, 'Choose stuff'); $form->addElement('select', 'stuffName', 'Stuff to send:', array('' => '--select--', 'n' => 'Nuts', 'b' => 'Bolts', 'f' => 'Flotsam', 'j' => 'Jetsam')); $form->addElement('text', 'stuffAmount', 'Amount of stuff:', array('size' => 2, 'maxlength' => 2)); $form->addElement('header', null, 'Choose shipping profile'); $form->addElement('static', 'note', 'Note:', 'profiles \'foo\', \'bar\' and \'baz\' are considered existing'); $form->addElement('radio', 'profile', null, 'Use existing profile', 'existing'); $form->addElement('text', 'profileName', 'Profile name:', array('size' => 32, 'maxlength' => 32)); $form->addElement('radio', 'profile', null, 'New personal profile', 'personal'); $form->addElement('text', 'persProfileName', 'Profile name:', array('size' => 32, 'maxlength' => 32)); $name[] =& $form->createElement('text', 'first', null, array('size' => 14, 'maxlength' => 100)); $name[] =& $form->createElement('text', 'last', null, array('size' => 14, 'maxlength' => 100)); $form->addGroup($name, 'persName', 'Name (first, last):', ' '); $form->addElement('text', 'persAddress', 'Address:', array('size' => 32, 'maxlength' => 255)); $form->addElement('radio', 'profile', null, 'New company profile', 'company'); $form->addElement('text', 'compProfileName', 'Profile name:', array('size' => 32, 'maxlength' => 32)); $form->addElement('text', 'compName', 'Company name:', array('size' => 32, 'maxlength' => 100)); $form->addElement('text', 'compAddress', 'Address:', array('size' => 32, 'maxlength' => 255)); $form->addElement('submit', null, 'Send'); $form->addFormRule('_validate_shipping'); if ($form->validate()) { echo "<pre>\n"; var_dump($form->exportValues()); echo "</pre>\n"; } $form->display(); ?>
Close