psf
login_form.php
1 <?php
2 
3 // Part of php simple framework (psf)
4 
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 
15 // Copyright (c) Petr Bena <petr@bena.rocks> 2015 - 2018
16 
17 if (!defined("PSF_ENTRY_POINT"))
18  die("Not a valid psf entry point");
19 
20 require_once (dirname(__FILE__) . "/button.php");
21 require_once (dirname(__FILE__) . "/form.php");
22 require_once (dirname(__FILE__) . "/checkbox.php");
23 require_once (dirname(__FILE__) . "/combobox.php");
24 require_once (dirname(__FILE__) . "/textbox.php");
25 require_once (dirname(__FILE__) . "/label.php");
26 
27 class LoginForm extends Form
28 {
29  public $Format = NULL;
30  public $DefaultUser = "";
31  private $UserInput = NULL;
32  private $PassInput = NULL;
33  private $bSubmit = NULL;
34 
35  public function __construct($_parent = NULL)
36  {
37  parent::__construct($_parent = NULL);
38  // Remember if we want to auto insert childs
39  $ic = $this->AutoInsertChilds;
40  $this->AutoInsertChilds = true;
41  $this->Action = "?login";
42  $this->Method = FormMethod::Post;
43  $this->UserInput = new TextBox("loginUsername", "", $this);
44  $this->UserInput->Placeholder = "Username";
45  $this->AppendLineBreak();
46  $this->PassInput = new TextBox("loginPassword", "", $this);
47  $this->PassInput->Placeholder = "Password";
48  $this->PassInput->Password = true;
49  $this->AppendLineBreak();
50  $this->bSubmit = new Button("login", "Login", $this);
51  // Restore back original
52  $this->AutoInsertChilds = $ic;
53  }
54 }
Definition: form.php:29