コード例 #1
0
/** 
 * Adds a new costumer
 */
function addCostumer($storeId, $name, $email, $password)
{
    $sql = "INSERT INTO users(name,email,password,registration_date,privilege_id) " . "VALUES (?,?,?,CURRENT_TIMESTAMP,(SELECT id FROM privileges WHERE name='costumer')) " . "RETURNING id";
    $id = query($sql, array($name, $email, $password));
    $id = $id[0]["id"];
    $sql = "INSERT INTO stores_users(user_id,store_id) VALUES(?,?)";
    // Activate user
    activateUserById($id);
    return query($sql, array($id, $storeId));
}
コード例 #2
0
/**
 * Activate user based on $user_id.
 * @param int $user_id the id of the user to activate.
 * @return boolean
 */
function activateUser($user_id)
{
    // This block automatically checks this action against the permissions database before running.
    if (!checkActionPermissionSelf(__FUNCTION__, func_get_args())) {
        addAlert("danger", "Sorry, you do not have permission to access this resource.");
        return false;
    }
    return activateUserById($user_id);
}