예제 #1
0
 *
 * @(#) $Id: test_dependent_validation.php,v 1.1 2007/06/02 08:37:21 mlemos Exp $
 *
 */
require 'forms.php';
$form = new form_class();
$form->NAME = 'dependent_validation_form';
$form->METHOD = 'POST';
$form->ACTION = '';
$form->InvalidCLASS = 'invalid';
$form->ShowAllErrors = 0;
$form->debug = 'trigger_error';
$form->AddInput(array('TYPE' => 'checkbox', 'ID' => 'condition', 'NAME' => 'condition', 'CHECKED' => 1, 'LABEL' => '<u>V</u>alidate', 'ACCESSKEY' => 'V'));
$form->AddInput(array('TYPE' => 'text', 'ID' => 'dependent', 'NAME' => 'dependent', 'LABEL' => '<u>D</u>ependent', 'ACCESSKEY' => 'D', 'ValidateAsNotEmpty' => 1, 'ValidationErrorMessage' => 'It was not entered a value in the dependent field.', 'DependentValidation' => 'condition'));
$form->AddInput(array('TYPE' => 'submit', 'VALUE' => 'Submit', 'NAME' => 'doit'));
$form->LoadInputValues($form->WasSubmitted('doit'));
$verify = array();
if ($form->WasSubmitted('doit')) {
    if (($error_message = $form->Validate($verify)) == '') {
        $doit = 1;
    } else {
        $doit = 0;
        $error_message = HtmlEntities($error_message);
    }
} else {
    $error_message = '';
    $doit = 0;
}
if (!$doit) {
    $form->ConnectFormToInput('dependent', 'ONLOAD', 'Focus', array());
}
예제 #2
0
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_secure_submit.php,v 1.2 2007/05/09 01:43:29 mlemos Exp $
 *
 */
require 'forms.php';
require 'form_secure_submit.php';
$key = "my secret key";
$form = new form_class();
$form->ID = 'secure_form';
$form->METHOD = 'POST';
$form->ACTION = '?';
$form->debug = 'trigger_error';
$error = $form->AddInput(array('TYPE' => 'custom', 'VALUE' => 'Secure submit', 'ID' => 'secure_submit', 'NAME' => 'secure_submit', 'CustomClass' => 'form_secure_submit_class', 'Key' => $key));
if (strlen($error)) {
    die("Error: " . $error);
}
$submitted = $form->WasSubmitted('secure_submit');
$form->LoadInputValues($submitted);
$verify = array();
if ($submitted) {
    if (strlen($error_message = $form->Validate($verify)) == 0) {
        $doit = 1;
    } else {
        $doit = 0;
        $error_message = HtmlEntities($error_message);
    }
} else {
    $error_message = '';
    $doit = 0;
}
if (!$doit) {
    $focus = 'secure_submit';
예제 #3
0
 * test_encoded_pasword.php
 *
 * @(#) $Header: /home/mlemos/cvsroot/forms/test_encoded_password.php,v 1.6 2006/12/20 06:21:16 mlemos Exp $
 *
 */
require "forms.php";
$form = new form_class();
$form->NAME = "login_form";
$form->METHOD = "GET";
$form->ACTION = "";
$form->debug = "trigger_error";
$form->AddInput(array("TYPE" => "text", "NAME" => "access_name", "MAXLENGTH" => 20, "Capitalization" => "uppercase", "ValidateRegularExpression" => "^[a-zA-Z0-9\\-_]+\$", "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid access name"));
$form->AddInput(array("TYPE" => "hidden", "NAME" => "user_login", "ID" => "user_login", "VALUE" => ""));
$form->AddInput(array("TYPE" => "password", "NAME" => "password", "ONCHANGE" => "if(value.toLowerCase) value=value.toLowerCase()", "Encoding" => "MD5", "EncodingFunctionVerification" => "loaded_MD5", "EncodedField" => "user_login", "ValidateAsNotEmpty" => 1, "ValidationErrorMessage" => "It was not specified a valid password"));
$form->AddInput(array("TYPE" => "submit", "VALUE" => "Login", "NAME" => "doit"));
$form->LoadInputValues($form->WasSubmitted("doit"));
$verify = array();
if ($form->WasSubmitted("doit")) {
    $user_login = $form->GetInputValue("user_login");
    if (strcmp($user_login, "")) {
        $password = $user_login;
        $user_login = "";
        $form->SetInputValue("user_login", $user_login);
    } else {
        $password = $form->GetInputValue("password");
        if (strcmp($password, "")) {
            $password = md5(strtolower($password));
        }
    }
    $form->SetInputValue("password", $password);
    if (($error_message = $form->Validate($verify)) == "") {
예제 #4
0
/*
 *  Handle events AJAX requests handling events.
 *  Do not output anything nor send any headers before this line.
 */
$form->HandleEvent($processed);
/*
 *  Exit your script if all AJAX events were processed.
 */
if ($processed) {
    exit;
}
/*
 *  Load input values so the scaffolding input can post event messages
 *  for handling by your application.
 */
$submitted = strlen($form->WasSubmitted('')) != 0;
$form->LoadInputValues($submitted);
/*
 *  Were any messages posted to handle scaffolding events?
 */
if ($form->GetNextMessage($message)) {
    /*
     *  If so process and reply to all messages until there are no more
     *  messages to process.
     */
    do {
        /*
         *  First lets check which input posted a message.
         */
        switch ($message['From']) {
            case 'posts':