Exemple #1
0
<?php

include 'functions.php';
if (isset($_POST['mybutton2'])) {
    updUser();
} else {
    $getone = getUserData();
}
include 'header.php';
?>
<div class="page-header pool">
        <h1>Muuda</h1>
</div>
<a href="index.php" class="btn btn-info">View List</a>

<form class="form-horizontal pool" role="form" method="post" enctype="multipart/form-data">
<input type="hidden" name="hidden" value="<?php 
echo $getone["id"];
?>
">
<div class="form-group">
    <label class="control-label col-sm-2" for="name">Nimi:</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" name="name" value="<?php 
echo $getone["name"];
?>
">
    </div>
  </div>
  <div class="form-group">
    <label class="control-label col-sm-2" for="username">Kasutaja:</label>
<?php

error_reporting(E_ALL);
ini_set('display_errors', true);
include 'Config/functions.php';
include 'Config/static_config.php';
$user_id = $_GET['id'];
$user_id = (int) $user_id;
if (isset($_POST['save'])) {
    updUser($user_id);
} else {
    $userData = getuserData($user_id);
    $regdate = date($format, strtotime($userData["regdate"]));
    $lastupdate = date($format, strtotime($userData["lastupdate"]));
    $fchecked = "";
    $mchecked = "";
    if ($userData["gender"] == "female") {
        $fchecked = "checked";
    } else {
        $mchecked = "checked";
    }
    $replacement_array = array('Edit ' . $userData["username"] . 's - Profile', '<div class="pageheading">
            <h3>' . $userData["name"] . '</h3>
    </div>
    <div class="content-box">
        <form method="post" action="" enctype="multipart/form-data">
            <div class="row">
            <div class="col-1-2 content-box-lr">
            <input type="text" name="name" value="' . $userData["name"] . '" maxlength="30"><br>
            <input type="text" name="username" value="' . $userData["username"] . '" maxlength="10"><br>
            <input type="email" name="email" value="' . $userData["email"] . '" maxlength="50"><br>
Exemple #3
0
            \Sop\Api::exitWithError(array($msg007));
        }
    } else {
        // --- TBL: user
        $rslt = addUser($db, $user_id, $password, $user_name, $role, $email, $note, $admin_flag);
        if (!$rslt) {
            \Sop\Log::error(__FILE__, __LINE__, 'Failed to add user.');
            $msg008 = "The registration failed.: user";
            // 登録に失敗しました: user
            \Sop\Api::exitWithError(array($msg008));
        }
    }
}
if ($div == 'upd') {
    // --- TBL: user
    $rslt = updUser($db, $user_id, $user_name, $role, $email, $note, $admin_flag);
    if (!$rslt) {
        \Sop\Log::error(__FILE__, __LINE__, 'Failed to update user.');
        $msg009 = "The update failed.: user";
        // 更新に失敗しました: user
        \Sop\Api::exitWithError(array($msg009));
    }
    // --- TBL: user_grp
    $rslt = delUserGrp($db, $user_id);
    if (!$rslt) {
        \Sop\Log::error(__FILE__, __LINE__, 'Failed to delete user_grp.');
        $msg010 = "The delete failed.: user_grp";
        // 削除に失敗しました: user_grp
        \Sop\Api::exitWithError(array($msg010));
    }
}