$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;
        $error_message = HtmlEntities($error_message);
    }
} else {
    $error_message = "";
Beispiel #2
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 {
Beispiel #3
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 {
 /*
  *  When it is sent an event of an entry being updated, make
  *  sure the specified entry identifier really exists and
  *  can be updated.
  */
 $id = $message['Entry'];
 if (!$model->ReadEntry($id, $entry)) {
     /*
      *  If there was a problem checking the an entry, cancel
      *  the entry update and display an helpful error
      *  message.
      */
     $message['Cancel'] = 1;
     $form->SetInputProperty('posts', 'UpdateCanceledMessage', 'Error: ' . $model->error);
 } elseif (isset($entry)) {
     $form->SetInputValue('title', $entry['title']);
     $form->SetInputValue('body', $entry['body']);
     /*
      *  When the updated event is sent, applications should
      *  validate the form and update the entry if it is all
      *  OK.
      */
     if (!strcmp($message['Event'], 'updated')) {
         $form->LoadInputValues(1);
         $entry['title'] = $form->GetInputValue('title');
         $entry['body'] = $form->GetInputValue('body');
         if (strlen($form->Validate($verify, 'posts-submit')) == 0) {
             if (!$model->UpdateEntry($id, $entry)) {
                 /*
                  *  If there was a problem updating the entry, cancel the
                  *  entry updating and display an helpful error message.