Esempio n. 1
0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test for Manuel Lemos' PHP form class
using the linked select plug-in input</title>
</head>
<body onload="<?php 
echo $onload;
?>
" bgcolor="#cccccc">
<center><h1>Test for Manuel Lemos' PHP form class
using the linked select plug-in input</h1></center>
<hr />
<?php 
if ($doit) {
    $continent = $form->GetInputValue("continent");
    $country = $form->GetInputValue("country");
    $location = $form->GetInputValue("location");
    ?>
<center><h2>The chosen location is <?php 
    echo HtmlEntities($locations[$country][$location]), " (", HtmlEntities($countries[$continent][$country]), ", ", HtmlEntities($continents[$continent]), ")";
    ?>
</h2></center>
<?php 
} else {
    $form->StartLayoutCapture();
    $title = "Linked select plug-in test";
    $body_template = "form_linked_select_body.html.php";
    include "templates/form_frame.html.php";
    $form->EndLayoutCapture();
    $form->DisplayOutput();
Esempio n. 2
0
 *
 */
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)) == "") {
        $doit = 1;
    } else {
        $doit = 0;
Esempio n. 3
0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test for Manuel Lemos' PHP form class using the CAPTCHA plug-in input</title>
</head>
<body onload="<?php 
echo $onload;
?>
" bgcolor="#cccccc">
<center><h1>Test for Manuel Lemos' PHP form class using the CAPTCHA plug-in input</h1></center>
<hr />
<?php 
if ($doit) {
    ?>
<center><h2>The entered text <?php 
    echo $form->GetInputValue("captcha");
    ?>
 is correct.</h2></center>
<?php 
} else {
    $form->StartLayoutCapture();
    $title = "Form CAPTCHA plug-in test";
    $body_template = "form_captcha_body.html.php";
    include "templates/form_frame.html.php";
    $form->EndLayoutCapture();
    $form->DisplayOutput();
}
?>
<hr />
</body>
</html>
Esempio n. 4
0
    if (isset($__test_options["start_date"])) {
        $start_date = $__test_options["start_date"];
    }
    if (isset($__test_options["end_date"])) {
        $end_date = $__test_options["end_date"];
    }
}
$form->AddInput(array("TYPE" => "custom", "ID" => "date", "LABEL" => "<u>D</u>ate", "ACCESSKEY" => "D", "CustomClass" => "form_date_class", "VALUE" => $today, "Format" => "{day}/{month}/{year}", "Months" => array("01" => "January", "02" => "February", "03" => "March", "04" => "April", "05" => "May", "06" => "June", "07" => "July", "08" => "August", "09" => "September", "10" => "October", "11" => "November", "12" => "December"), "Optional" => 1, "ValidationStartDate" => $start_date, "ValidationStartDateErrorMessage" => "It was specified a schedule date before the start date.", "ValidationEndDate" => $end_date, "ValidationEndDateErrorMessage" => "It was specified a schedule date after the end date."));
/*
 * The following lines are for testing purposes.
 * Remove these lines when adapting this example to real applications.
 */
if (defined("__TEST")) {
    if (isset($__test_options["set_date"])) {
        $form->SetInputValue('date', $__test_options["set_date"]);
        echo $form->GetInputValue('date');
        return;
    }
}
$form->AddInput(array("TYPE" => "submit", "VALUE" => "Schedule", "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 = "";
Esempio n. 5
0
    if (isset($__test_options["start_date"])) {
        $start_date = $__test_options["start_date"];
    }
    if (isset($__test_options["end_date"])) {
        $end_date = $__test_options["end_date"];
    }
}
$form->AddInput(array("TYPE" => "custom", "ID" => "experience", "LABEL" => "Your PHP <u>E</u>xperience", "ACCESSKEY" => "E", "CustomClass" => "form_date_class", "VALUE" => '', "AskAge" => 1, "HideDay" => 1, "FixedDay" => 1, "Format" => "{year} years and {month} months", "ValidationStartDate" => $start_date, "ValidationStartDateErrorMessage" => "You cannot have that long PHP experience as PHP was only released in 1995.", "ValidationEndDate" => $end_date, "ValidationEndDateErrorMessage" => "You have not specified a valid experience period."));
/*
 * The following lines are for testing purposes.
 * Remove these lines when adapting this example to real applications.
 */
if (defined("__TEST")) {
    if (isset($__test_options["set_date"])) {
        $form->SetInputValue('experience', $__test_options["set_date"]);
        echo $form->GetInputValue('experience');
        return;
    }
}
$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 = "";
Esempio n. 6
0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test for Manuel Lemos' PHP form class
using the list select plug-in input</title>
</head>
<body onload="<?php 
echo $onload;
?>
" bgcolor="#cccccc">
<center><h1>Test for Manuel Lemos' PHP form class
using the list select plug-in input</h1></center>
<hr />
<?php 
if ($doit) {
    $currency = $form->GetInputValue("currency");
    ?>
<center><h2>The chosen currency is <tt><?php 
    echo $currencies[$currency];
    ?>
</tt>.</h2></center>
<?php 
} else {
    $form->StartLayoutCapture();
    $title = "List select plug-in test";
    $body_template = "form_list_select_body.html.php";
    include "templates/form_frame.html.php";
    $form->EndLayoutCapture();
    $form->DisplayOutput();
}
?>
Esempio n. 7
0
     $form->SetInputProperty('posts', 'IDColumn', $id_column);
     $form->SetInputProperty('posts', 'Columns', $columns);
     $form->SetInputProperty('posts', 'TotalEntries', $total_posts);
     $form->SetInputProperty('posts', 'PageEntries', $page_entries);
     $form->SetInputProperty('posts', 'Page', $page);
     $form->SetInputProperty('posts', 'Rows', $posts);
     break;
 case "created":
     /*
      *  When the created event is sent, applications should
      *  validate the form and create a new entry if it is all
      *  OK.
      */
     if (strlen($error_message = $form->Validate($verify, 'posts-submit')) == 0) {
         $form->LoadInputValues(1);
         $entry = array('title' => $form->GetInputValue('title'), 'body' => $form->GetInputValue('body'));
         if (!$model->CreateEntry($entry)) {
             /*
              *  If there was a problem creating an entry, cancel the
              *  entry creation and display an helpful error message.
              */
             $message['Cancel'] = 1;
             $form->SetInputProperty('posts', 'CreateCanceledMessage', 'Error: ' . $model->error);
         } else {
             /*
              *  If the entry was created successfully, set the Entry
              *  entry of the message array to pass back the
              *  identifier of the newly created entry.
              */
             $message['Entry'] = $entry['id'];
         }