$ex = array("ID", "firstname", "lastname", "email", "password", "gender"); //providing form language $lang = array("username" => "Username", "password" => "Password", "captcha" => "Enter captcha", "code" => "Captcha code"); $form->set_language($lang); /************************* * Generating form *************************/ echo "<fieldset>"; echo "<legend>Login</legend>"; //adding custom password field $html = "<input type='password' name='password'"; if (isset($_POST["password"])) { $html .= " value='" . $_POST["password"] . "'"; } $html .= "/>"; $form->add_custom_html($html, "password", true); //adding class predefined validation fo password $form->add_class_validation("password", "char", true); //displaying captcha code $form->add_custom_html($captcha, "code", false); $html = "<input type='text' name='captcha' style='text-transform: uppercase;' maxlength='5'"; if (isset($_POST["captcha"])) { $html .= " value='" . $_POST["captcha"] . "'"; } $html .= "/>"; //adding custom captcha input $form->add_custom_html($html, "captcha", false); //adding class predefined validation for captcha $form->add_class_validation("captcha", "char", true, 5); //generating form $form->select_form("test_users", $ex);
$ex = array("ID", "password"); //providing form language $lang = array("username" => "Username", "email" => "Email address", "firstname" => "Firstname", "lastname" => "Lastname", "password" => "Password", "repeat_pass" => "Reapeat password", "gender" => "Gender"); $form->set_language($lang); /************************* * Generating form *************************/ echo "<fieldset>"; echo "<legend>Register</legend>"; //adding custom password field $html = "<input type='password' name='password'"; if (isset($_POST["password"])) { $html .= " value='" . $_POST["password"] . "'"; } $html .= "/>"; $form->add_custom_html($html, "password", true); //adding custom repeated password field $html = "<input type='password' name='repeat_pass'"; if (isset($_POST["repeat_pass"])) { $html .= " value='" . $_POST["repeat_pass"] . "'"; } $html .= "/>"; $form->add_custom_html($html, "repeat_pass", false); //adding class predefined validation for password $form->add_class_validation("password", "char", true); //adding class predefined validation for repeated password $form->add_class_validation("repeat_pass", "char", true); //generating form $form->insert_form("test_users", $ex); echo "</fieldset>"; ob_end_flush();
$form = new auto_form($serverlink); //debug queries $form->debug(); //setting callback functions $form->set_onsuccess("rows_removed"); //setting callback functions $form->set_modification("hash_pass"); //excluding table columns $ex = array("ID", "username", "email", "lastname", "firstname", "gender", "password"); //providing form language $lang = array("password" => "Password"); $form->set_language($lang); /************************* * Generating form *************************/ echo "<fieldset>"; echo "<legend>Delete account</legend>"; //adding custom password field $html = "<input type='password' name='password'"; if (isset($_POST["password"])) { $html .= " value='" . $_POST["password"] . "'"; } $html .= "/>"; $form->add_custom_html($html, "password", true); //adding class predefined validation for password $form->add_class_validation("password", "char", true); $form->add_custom_html("<input type='hidden' name='ID' value='2'/>", "ID", true, true); //generating form $form->delete_form("test_users", $ex, "", "Delete your account"); echo "</fieldset>"; ob_end_flush();
{ $arr["password"] = md5($arr["password"]); return $arr; } //class instance $form = new auto_form($serverlink); //debug queries $form->debug(); //setting callback functions $form->set_modification("hash_pass"); //excluding table columns $ex = array("ID", "password"); //providing form language $lang = array("username" => "Username", "email" => "Email address", "firstname" => "Firstname", "lastname" => "Lastname", "password" => "Password", "gender" => "Gender"); $form->set_language($lang); /************************* * Generating form *************************/ echo "<fieldset>"; echo "<legend>Edit account</legend>"; //adding custom password field $html = "<input type='password' name='password'"; if (isset($_POST["password"])) { $html .= " value='" . $_POST["password"] . "'"; } $html .= "/>"; $form->add_custom_html($html, "password", true); //generating form $form->update_form("test_users", "WHERE ID = '1'", $ex); echo "</fieldset>"; ob_end_flush();