Viewing file: Login.php (8.42 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php //Include Common Files @1-A0DBF308 define("RelativePath", "."); define("PathToCurrentPage", "/"); define("FileName", "Login.php"); include(RelativePath . "/Common.php"); include(RelativePath . "/Template.php"); include(RelativePath . "/Sorter.php"); include(RelativePath . "/Navigator.php"); //End Include Common Files
class clsRecordLogin { //Login Class @2-58926B8F
//Variables @2-9E315808
// Public variables public $ComponentType = "Record"; public $ComponentName; public $Parent; public $HTMLFormAction; public $PressedButton; public $Errors; public $ErrorBlock; public $FormSubmitted; public $FormEnctype; public $Visible; public $IsEmpty;
public $CCSEvents = ""; public $CCSEventResult;
public $RelativePath = "";
public $InsertAllowed = false; public $UpdateAllowed = false; public $DeleteAllowed = false; public $ReadAllowed = false; public $EditMode = false; public $ds; public $DataSource; public $ValidatingControls; public $Controls; public $Attributes;
// Class variables //End Variables
//Class_Initialize Event @2-F832F9A4 function clsRecordLogin($RelativePath, & $Parent) {
global $FileName; global $CCSLocales; global $DefaultDateFormat; $this->Visible = true; $this->Parent = & $Parent; $this->RelativePath = $RelativePath; $this->Errors = new clsErrors(); $this->ErrorBlock = "Record Login/Error"; $this->ReadAllowed = true; if($this->Visible) { $this->ComponentName = "Login"; $this->Attributes = new clsAttributes($this->ComponentName . ":"); $CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2); if(sizeof($CCSForm) == 1) $CCSForm[1] = ""; list($FormName, $FormMethod) = $CCSForm; $this->FormEnctype = "application/x-www-form-urlencoded"; $this->FormSubmitted = ($FormName == $this->ComponentName); $Method = $this->FormSubmitted ? ccsPost : ccsGet; $this->login = new clsControl(ccsTextBox, "login", "login", ccsText, "", CCGetRequestParam("login", $Method, NULL), $this); $this->login->Required = true; $this->password = new clsControl(ccsTextBox, "password", "password", ccsText, "", CCGetRequestParam("password", $Method, NULL), $this); $this->password->Required = true; $this->DoLogin = new clsButton("DoLogin", $Method, $this); } } //End Class_Initialize Event
//Validate Method @2-C9284A6A function Validate() { global $CCSLocales; $Validation = true; $Where = ""; $Validation = ($this->login->Validate() && $Validation); $Validation = ($this->password->Validate() && $Validation); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this); $Validation = $Validation && ($this->login->Errors->Count() == 0); $Validation = $Validation && ($this->password->Errors->Count() == 0); return (($this->Errors->Count() == 0) && $Validation); } //End Validate Method
//CheckErrors Method @2-CE95D583 function CheckErrors() { $errors = false; $errors = ($errors || $this->login->Errors->Count()); $errors = ($errors || $this->password->Errors->Count()); $errors = ($errors || $this->Errors->Count()); return $errors; } //End CheckErrors Method
//Operation Method @2-9A742E2A function Operation() { if(!$this->Visible) return;
global $Redirect; global $FileName;
if(!$this->FormSubmitted) { return; }
if($this->FormSubmitted) { $this->PressedButton = "DoLogin"; if($this->DoLogin->Pressed) { $this->PressedButton = "DoLogin"; } } $Redirect = $FileName; if($this->Validate()) { if($this->PressedButton == "DoLogin") { $Redirect = "statistika_list.php"; if(!CCGetEvent($this->DoLogin->CCSEvents, "OnClick", $this->DoLogin)) { $Redirect = ""; } } } else { $Redirect = ""; } } //End Operation Method
//Show Method @2-0908AC96 function Show() { global $Tpl; global $FileName; global $CCSLocales; $Error = "";
if(!$this->Visible) return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$RecordBlock = "Record " . $this->ComponentName; $ParentPath = $Tpl->block_path; $Tpl->block_path = $ParentPath . "/" . $RecordBlock; $this->EditMode = $this->EditMode && $this->ReadAllowed;
if($this->FormSubmitted || $this->CheckErrors()) { $Error = ""; $Error = ComposeStrings($Error, $this->login->Errors->ToString()); $Error = ComposeStrings($Error, $this->password->Errors->ToString()); $Error = ComposeStrings($Error, $this->Errors->ToString()); $Tpl->SetVar("Error", $Error); $Tpl->Parse("Error", false); } $CCSForm = $this->EditMode ? $this->ComponentName . ":" . "Edit" : $this->ComponentName; $this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $CCSForm); $Tpl->SetVar("Action", $this->HTMLFormAction); $Tpl->SetVar("HTMLFormName", $this->ComponentName); $Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this); $this->Attributes->Show(); if(!$this->Visible) { $Tpl->block_path = $ParentPath; return; }
$this->login->Show(); $this->password->Show(); $this->DoLogin->Show(); $Tpl->parse(); $Tpl->block_path = $ParentPath; } //End Show Method
} //End Login Class @2-FCB6E20C
//Include Page implementation @8-58DBA1E3 include_once(RelativePath . "/Footer.php"); //End Include Page implementation
//Initialize Page @1-07F48E1D // Variables $FileName = ""; $Redirect = ""; $Tpl = ""; $TemplateFileName = ""; $BlockToParse = ""; $ComponentName = ""; $Attributes = "";
// Events; $CCSEvents = ""; $CCSEventResult = "";
$FileName = FileName; $Redirect = ""; $TemplateFileName = "Login.html"; $BlockToParse = "main"; $TemplateEncoding = "CP1252"; $PathToRoot = "./"; //End Initialize Page
//Include events file @1-18E17219 include("./Login_events.php"); //End Include events file
//Before Initialize @1-E870CEBC $CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage); //End Before Initialize
//Initialize Objects @1-7A9CD815 $Attributes = new clsAttributes("page:"); $MainPage->Attributes = & $Attributes;
// Controls $Login = new clsRecordLogin("", $MainPage); $Footer = new clsFooter("", "Footer", $MainPage); $Footer->Initialize(); $MainPage->Login = & $Login; $MainPage->Footer = & $Footer;
BindEvents();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);
if ($Charset) header("Content-Type: text/html; charset=" . $Charset); //End Initialize Objects
//Initialize HTML Template @1-593C2978 $CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage); $Tpl = new clsTemplate($FileEncoding, $TemplateEncoding); $Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "CP1252"); $Tpl->block_path = "/$BlockToParse"; $CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage); $Attributes->Show(); //End Initialize HTML Template
//Execute Components @1-ABCE2C31 $Login->Operation(); $Footer->Operations(); //End Execute Components
//Go to destination page @1-E32F0A6E if($Redirect) { $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage); header("Location: " . $Redirect); unset($Login); $Footer->Class_Terminate(); unset($Footer); unset($Tpl); exit; } //End Go to destination page
//Show Page @1-0D93EF5C $Login->Show(); $Footer->Show(); $Tpl->block_path = ""; $Tpl->Parse($BlockToParse, false); $main_block = $Tpl->GetVar($BlockToParse); $CCSEventResult = CCGetEvent($CCSEvents, "BeforeOutput", $MainPage); if ($CCSEventResult) echo $main_block; //End Show Page
//Unload Page @1-C7E90BF2 $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage); unset($Login); $Footer->Class_Terminate(); unset($Footer); unset($Tpl); //End Unload Page
?>
|