コード例 #1
0
ファイル: login_example.php プロジェクト: eyumay/srms.psco
    }
}
//modifying values - hashing password
function hash_pass($arr)
{
    $arr["password"] = md5($arr["password"]);
    return $arr;
}
//checking if user logged in
if (!isset($_SESSION["user"])) {
    echo "<p>Not logged in</p>";
} else {
    echo "<p>Logged in</p>";
}
//class instance
$form = new auto_form($serverlink);
//debug queries
$form->debug();
//setting callback functions
$form->add_custom_validation("valid_captcha", "Incorrect captcha entered");
$form->set_onsuccess("login");
$form->set_modification("hash_pass");
//excluding table columns
$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>";
コード例 #2
0
ファイル: delete_example.php プロジェクト: eyumay/srms.psco
session_start();
include "./connection.php";
include "./auto_form.php";
//on success callback - rows removed
function rows_removed($cnt)
{
    echo "<p>" . $cnt . " rows removed</p>";
}
//modifying values - hashing password
function hash_pass($arr)
{
    $arr["password"] = md5($arr["password"]);
    return $arr;
}
//class instance
$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>";
コード例 #3
0
ファイル: edit_example.php プロジェクト: eyumay/srms.psco
 *
 * For more information, examples and online documentation visit: 
 * http://webcodingeasy.com/PHP-classes/Generate-forms-programmatically
**************************************************************/
ob_start();
session_start();
include "./connection.php";
include "./auto_form.php";
//modifying values - hashing password
function hash_pass($arr)
{
    $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
コード例 #4
0
ファイル: register_example.php プロジェクト: eyumay/srms.psco
function check_email($arr)
{
    if (preg_match("/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+\$/", $arr["email"])) {
        return true;
    } else {
        return false;
    }
}
//modifying values - hashing password
function hash_pass($arr)
{
    $arr["password"] = md5($arr["password"]);
    return $arr;
}
//class instance
$form = new auto_form($serverlink);
//debug queries
$form->debug();
//setting callback functions
$form->add_custom_validation("pass_match", "Repeated password didn't match");
$form->add_custom_validation("check_email", "Incorrect email format");
$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", "repeat_pass" => "Reapeat password", "gender" => "Gender");
$form->set_language($lang);
/*************************
 * Generating form
 *************************/
echo "<fieldset>";
コード例 #5
0
ファイル: simple_example.php プロジェクト: eyumay/srms.psco
//form class
include "./auto_form.php";
//on success
function success($result)
{
    if ($result === false) {
        echo "<p>No connection</p>";
    } else {
        if ($result === 0) {
            echo "<p>No id generated</p>";
        } else {
            echo "<p>New id is " . $result . "</p>";
        }
    }
}
$form = new auto_form($serverlink);
$form->debug();
//exclude table columns
$ex = array("ID");
//language array
$lang = array("int" => "Integer", "decimal" => "Decimal", "double" => "Float", "text" => "Text", "bool" => "Checkbox", "enum" => "Select", "set" => "Multiple select", "varchar" => "Default");
$form->set_language($lang);
//set on success function
$form->set_onsuccess("success");
//insert form
echo "<fieldset>";
echo "<legend>Insert form</legend>";
$form->insert_form("test_table", $ex);
echo "</fieldset>";
//update form
echo "<fieldset>";