示例#1
0
$formGen->setPasswordElement("psWord", "", 20, 20, "txtboxes", false, true, "Enter Password");
#Process Form
$disForm = $formGen->processForm("Login", "buttons");
#Get HTML of the elements
$disElementHTML = $formGen->getDisElementHTML();
#Get Error Messages
$errMsg = $formGen->getErrorMsg("The following errors occured", "style2");
#Get Posted Values
$postedVals = $formGen->getPostedElementValues();
if (count($postedVals)) {
    include "dbaccess.class.php";
    //Create Instance
    $mySqlObj = new dBAccess(_DBHOST, _DBUSERNAME, _DBPASSWORD);
    //MySQL Database Instance
    $mySqlObj->selectDB(_DBNAME);
    $resLogin = $mySqlObj->authenticateLogin($postedVals["usName"], $postedVals["psWord"], true);
    if (count($resLogin)) {
        loginUser(_APPNAME, $resLogin[0]["userId"], $resLogin[0]["lastLogin"]);
        redirectPage("index.php");
    } else {
        $errMsg = $_appLang["errorLogin"];
    }
}
$contVal[0][0] = array("value" => "Username");
$contVal[0][1] = array("value" => $disElementHTML["usName"]);
$contVal[1][0] = array("value" => "Password");
$contVal[1][1] = array("value" => $disElementHTML["psWord"]);
$contVal[2][1] = array("value" => $disForm["submit"]);
$contTable = genHTMLTable(3, 2, $contVal, "100%", "", 4);
$contVal2[0][0] = array("value" => "Login", "style" => "titletext");
$contVal2[1][0] = array("value" => $errMsg, "style" => "tinyredtext");