コード例 #1
0
<?php

if (isset($_POST["btnAddUser"])) {
    include_once "../../../controller/UserController.php";
    $name = $_POST["name"];
    $email = $_POST["email"];
    $pass = $_POST["pass"];
    $phone = $_POST["phone"];
    $role = $_POST["role"];
    $result = UserController::AddUser($name, $pass, $email, $phone, $role);
    if ($result) {
        header("Location:../user_index.php?id=" . $result);
    }
}
if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "showPopupEdit") {
    include_once "../../../controller/UserController.php";
    $id = $_REQUEST["userId"];
    $result = UserController::GetUserByID($id);
    if ($result) {
        require_once "../utils/user_util.php";
        echo UserUtil::createFormEdit($result);
    }
}
if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "update") {
    require_once "../../../controller/UserController.php";
    require_once "../utils/user_util.php";
    $email = $_REQUEST["email"];
    $pass = $_REQUEST["pass"];
    $phone = $_REQUEST["phone"];
    $role = $_REQUEST["role"];
    $id = $_REQUEST["id"];
コード例 #2
0
    $radio_gender = $_POST['gender'];
    echo "<br>radio=" . $radio_gender;
    $rsUpdate = UsersBUS::UpdateInfor($id, $username, $radio_gender, $address, $dt1, $dt2, $time);
    if ($rsUpdate == true) {
        Utils::redirect("../thongtinkhachhang.php?update=success");
    } else {
        Utils::redirect("../thongtinkhachhang.php?update=failed");
    }
}
if (isset($_POST["btRegister"])) {
    //echo "register";
    include_once "UserController.php";
    $password = $_POST["txtPassword"];
    $username = $_POST["txtUsername"];
    $phone = $_POST["txtPhone"];
    //$dt2 = $_POST["txtMobile"];
    $email = $_POST["txtEmail"];
    $role = "1";
    //$fRegister="false";
    $time = date('Y-m-d');
    $id = UserController::AddUser($username, $password, $email, $phone, $role);
    if (!empty($id)) {
        $fRegister = "true";
        //echo "suceess";
        //$_SESSION["register"] = "true";
        Utils::redirect("../view/user/product-list.php?type=1&do=login");
    } else {
        echo "failed";
        Utils::redirect("../view/user/register.php?do=failed");
    }
}