Owa_util.get_cgi_env('REMOTE_ADDR') null

Hello!
I try to get client ip using following function:
owa_util.get_cgi_env('REMOTE_ADDR')
I simply put into a New-Form-Instance trigger something like:
Ipaddr varchar2(20);
Ipaddr:=owa_util.get_cgi_env('REMOTE_ADDR');
Unfortunately, it returnes always NULL. Does anyone know why it is so ?
Thanks :)

I think that owa_util.get... it´s not correct in forms, try to use
SYS_CONTEXT('USERENV','IP_ADDRESS'),
bye

Similar Messages

  • Owa_util.get_cgi_env('REMOTE_ADDR');

    Hi guys,
    I am using the following code for returning IP address, however it's not working as it's suppose to when I am executing my package. My main intent is to return the IP address of the user who is executing the package. When I am printing the IP address, it returns blank as shown below. Is there any settings related to Apache? Here's the code:
    PROCEDURE ERROR_PROC (p_proc_name IN VARCHAR2,
    p_OPERATOR IN VARCHAR2,
         p_ORA_ERROR IN VARCHAR2,
    p_INS_VALUES IN VARCHAR2,
    p_USER_ID IN VARCHAR2 DEFAULT NULL)
    IS
    PRAGMA autonomous_transaction;
    V_USER_ID VARCHAR2(4000);
    V_IP_Address VARCHAR2(4000);
    BEGIN
    BEGIN
    V_IP_Address:=owa_util.get_cgi_env('REMOTE_ADDR');
    EXCEPTION WHEN OTHERS THEN
    V_IP_Address:=NULL;
    dbms_output.put_line('IP Address is:'||V_IP_Address);
    END;
    END;
    Also, what tags to use here to enter the formatted code please? Looks like the above code will be unformatted after I submit the same here on the forum. Thanks for all your help.

    OraBI wrote:
    I am actually executing this procedure from my local machine (for testing) and spooling the output in a text file for the same purpose - testing.You cannot (easily) test web enabled PL/SQL code interactively - as the call should come, via mod_plsql, from an Apache server.
    You need to create a test harness procedure that simulates a web call from Apache's mod_plsql in the following fashion:
    SQL> create or replace type TStrings is table of varchar2(4000);
      2  /                                                         
    Type created.
    SQL>
    SQL> create or replace procedure WebTest is
      2  -- a sample web enabled PL/SQL procedure, using a cookie and CGI environment
      3  -- and outputting HTML                                                     
      4          cookie  OWA_COOKIE.cookie;                                         
      5  begin                                                                      
      6          OWA_UTIL.mime_header('text/html', TRUE );                          
      7          cookie := OWA_COOKIE.get( 'SOME_CUSTOM_COOKIE' );                  
      8                                                                             
      9          HTP.prn( 'What do you want, universe? (Klingon for "hello world")' );
    10          HTP.prn( '<hr>' );                                                  
    11                                                                              
    12          if cookie.vals.First is NULL then                                   
    13                  HTP.prn( 'Cookie [SOME_CUSTOM_COOKIE] is not set' );        
    14          else                                                                
    15                  HTP.prn( 'Cookie [SOME_CUSTOM_COOKIE] is set to "'|| cookie.vals( cookie.vals.First )||'"' );
    16          end if;                                                                                             
    17                                                                                                              
    18          HTP.prn( '<hr>' );                                                                                  
    19                                                                                                              
    20          HTP.prn( 'You are connection from web browser: '|| OWA_UTIL.get_cgi_env( 'HTTP_USER_AGENT' ) );     
    21          HTP.prn( 'Your IP address is '||OWA_UTIL.get_cgi_env('REMOTE_ADDR') );                              
    22  end;                                                                                                        
    23  /                                                                                                           
    Procedure created.
    SQL>
    SQL> create or replace function WebCall( procName varchar2, queryString varchar2 default null ) return TStrings pipelined is
      2  -- smaple test harness that pretends to Apache, mod_plsql and a browser, all rolled into one - it sets up a CGI       
      3  -- environment, makes the call to the web enables PL/SQL procedure, and then outputs the HTML response of that        
      4  -- procedure                                                                                                          
      5          nameList        OWA.vc_arr;                                                                                   
      6          valueList       OWA.vc_arr;                                                                                   
      7          htpBuffer       HTP.htbuf_arr;                                                                                
      8          bufRows         integer         := 99999999;                                                                  
      9          rc              integer;                                                                                      
    10  begin                                                                                                                 
    11          -- name-value list (typical CGI variables of an Apache server)                                                                    
    12          nameList(1) := 'HTTP_COOKIE';                                                                                 
    13          nameList(2) := 'HTTP_HOST';                                                                                   
    14          nameList(3) := 'HTTP_USER_AGENT';                                                                             
    15          nameList(4) := 'QUERY_STRING';                                                                                
    16          nameList(5) := 'REMOTE_ADDR';                                                                                 
    17          nameList(6) := 'REQUEST_METHOD';                                                                              
    18          nameList(7) := 'QUEST_URI';                                                                                   
    19                                                                                                                        
    20          valueList(1) := 'SOME_CUSTOM_COOKIE=123; SOME_OTHER_COOKIE=foo';                                              
    21          valueList(2) := 'localhost';                                                                                  
    22          valueList(3) := 'Mozilla/5.0; PL/SQL Interface';                                                              
    23          valueList(4) := nvl( queryString, 'param1=value1&pama2=value3' );       -- we built a sample one if one is not specified
    24          valueList(5) := 'localhost';                                                                                           
    25          valueList(6) := 'GET';                                                                                                 
    26          valueList(7) := '/custom-web-service';                                                                                 
    27                                                                                                                                 
    28          -- initiliase OWA and configure a basic CGI environment                                                                
    29          DBMS_SESSION.reset_package;                                                                                            
    30          rc := OWA.Initialize;                                                                                                  
    31          OWA.init_cgi_env( 7, nameList, valueList );                                                                            
    32          htp.HTBUF_LEN := 255;                                                                                                  
    33                                                                                                                                 
    34          -- now call the web enabled PL/SQL procedure                                                                           
    35          execute immediate 'begin '||procName||'; end;';
    36
    37          -- return the output as rows
    38          OWA.get_page( htpBuffer, bufRows );
    39          for i in 1..htpBuffer.Count
    40          loop
    41                  PIPE ROW( htpBuffer(i) );
    42          end loop;
    43
    44          return;
    45  end;
    46  /
    Function created.
    SQL>
    SQL> -- output below is what would have been seen by the web browser
    SQL> select
      2          rownum          as LINE_NO,
      3          b.column_value  as HTML_LINE
      4  from       TABLE( WebCall('WebTest') ) b
      5  /
       LINE_NO HTML_LINE
             1 Content-type: text/html
             2 Content-length: 200
             3
             4 What do you want, universe? (Klingon for "hello world")
             5 <hr>
             6 Cookie [SOME_CUSTOM_COOKIE] is set to "123"
             7 <hr>
             8 You are connection from web browser: Mozilla/5.0; PL/SQL Interface
             9 Your IP address is localhost
    9 rows selected.
    SQL>

  • Owa_util.get_cgi_env( 'REMOTE_ADDR' ) fails with PLSQL numeric error

    APEX Listener 2.0.1
    APEX 4.2.2
    Oracle 11gR2
    Linux RHEL 6.3
    Glassfish 3.1.2
    =============
    After upgrading from APEX Listener 1.1.4 -> 2.0.1 the procedure owa_util.get_cgi_env( 'REMOTE_ADDR' ) fails to return the remote IP Address and instead I get the error
    ORA-06502: PL/SQL: numeric or value error
    Has something changed with the new APEX Listener 2.0.1?  Is there a configuration element in the config or web.xml file that has to be changed before deploying the APEX Listener to GlassFish?
    Thanks.

    Hi I cannot reproduce this issue, here's the test case I used, can you try this and report the output generated:
    create or replace procedure test_cgi as
    begin
    owa_util.print_cgi_env;
    htp.prn(owa_util.get_cgi_env( 'REMOTE_ADDR' ));
    end;
    grant execute on test_cgi to apex_public_user
    Then I invoke the above procedure as follows:
    http://localhost:8080/apex/<workspace-schema-name>.test_cgi
    where <workspace-schema-name> is the database schema that the APEX workspace is using.
    Which produces output like the following:
    host = localhost:8080
    user-agent = Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/17.0 Firefox/17.0
    accept = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    accept-language = en-US,en;q=0.5
    accept-encoding = gzip, deflate
    dnt = 1
    connection = keep-alive
    cookie = ORA_WWV_REMEMBER_UN=RESTEASY_ADMIN:resteasy; ORA_WWV_USER_61813546913094=461E06966F3D10A956FC84806D0CFF22
    APEX_LISTENER_VERSION = 2.0.3.199.09.35
    DAD_NAME =
    DOC_ACCESS_PATH =
    DOCUMENT_TABLE =
    GATEWAY_IVERSION = 3
    GATEWAY_INTERFACE = CGI/1.1
    HTTP_ACCEPT = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    HTTP_ACCEPT_ENCODING = gzip, deflate
    HTTP_ACCEPT_LANGUAGE = en-US,en;q=0.5
    HTTP_ACCEPT_CHARSET =
    HTTP_IF_MODIFIED_SINCE =
    HTTP_IF_NONE_MATCH =
    HTTP_HOST = localhost:8080
    HTTP_ORACLE_ECID =
    HTTP_PORT = 8080
    HTTP_REFERER =
    HTTP_USER_AGENT = Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/17.0 Firefox/17.0
    PATH_ALIAS =
    PATH_INFO = /resteasy.test_cgi
    PLSQL_GATEWAY = WebDb
    QUERY_STRING =
    REMOTE_ADDR = 0:0:0:0:0:0:0:1
    REMOTE_USER = apex
    REQUEST_CHARSET = AL32UTF8
    REQUEST_IANA_CHARSET = UTF-8
    REQUEST_METHOD = GET
    REQUEST_PROTOCOL = http
    REQUEST_SCHEME = http
    SCRIPT_NAME = /apex
    SCRIPT_PREFIX =
    SERVER_NAME = localhost
    SERVER_PORT = 8080
    SERVER_PROTOCOL = HTTP/1.1
    SERVER_SOFTWARE = Mod-Apex
    WEB_AUTHENT_PREFIX =
    HTTP_COOKIE = ORA_WWV_REMEMBER_UN=RESTEASY_ADMIN:resteasy; ORA_WWV_USER_61813546913094=461E06966F3D10A956FC84806D0CFF22
    0:0:0:0:0:0:0:1

  • Using OWA_UTIL.GET_CGI_ENV

    Oracle 10G Enterprise edition
    Hi All,
    I tried to use owa_util.get_cgi_env('HTTP_REFERER') to get the current URL, but it returned the previous URL of my webpage. Is there any other parameters to pass to owa_util.get_cgi_env() to get the current URL.
    Thanks
    R

    Not sure if there's a single variable, but you can always use
    'http://' || owa_util.get_cgi_env('http_host')
                    || '/'
                    || owa_util.get_cgi_env('script_name')
                    || '/'
                    || owa_util.get_cgi_env('path_info')
                    || '/'
                    || owa_util.get_cgi_env('query_string')

  • 'owa_util.get_cgi_env does not return non-standard headers

    'owa_util.get_cgi_env does not return non-standard headers in embedded PL/SQL gateway even when the DAD attribute "cgi-environment-list" is set to pass
    such headers.
    Is this information correct?

    Hi,
    I came across the same problem today, my current understanding of the problem confirms your suspects, but I am still investigating the matter.
    If you made some progress on this, please share your thoughts.
    Flavio
    http://oraclequirks.blogspot.com
    http://www.yocoya.com

  • Using owa_util.get_cgi_env to get a cgi variable

    Using Forms 10g, on a UNIX server, I am trying to call this function: get_cgi_env('HTTP_CAMS_HTTP_USER') and assign the value for use in processing. I am trying to do this in my on-logon trigger of the form.
    Forms run-time is giving me :
    numeric or value error ORA 06512 at SYS.OWA_UTIL, line 356 ORA-06512 at SYS.OWA_UTIL line 375..
    Is it possible to use this function in Forms 10g running the 10g OAS, which is supposed to be based upon APACHE?
    Thank you,
    Tony Miller
    Webster, TX

    The value that the SSO package we use stores. It is the user's user id. We also have the actual session id in the SSO application available. AT this time, when we fire up a forms session, we have an .shtml file that calls the form url with a parameter, the session ID (from a cgi variable available to the .shtml file). I am trying to access that cgi variable so we DON'T need a parameter being passed on the url line for our main Form into the application..
    Thank you,
    Tony Miller
    Webster, TX

  • IP adress from REMOTE_ADDR

    Hi,
    I'm having a problem , when I try to get the real IP client, not proxy.
    I´m using owa_util.get_cgi_env('REMOTE_ADDR')), but this always return me
    127.0.0.1.
    How, I could get the real client IP adress.
    Many thanks
    Karl

    Hi,
    I used this function : owa_util.print_cgi_env;
    And I get : SERVER_SOFTWARE = Oracle-Application-Server-10g/10.1.3.1.0 Oracle-HTTP-Server
    Does it means that I am using OHS?
    But all of our settings are done within a different instance of Apache HTTP Server as we are on DEV environment. Our TEST uses a complete Application Server Environment.
    If it is the case I am still getting :
    HTTP_REFERER:
    REMOTE_ADDR: 127.0.0.1
    HTTP_X_ORACLE_CACHE_USER:
    X-FORWARDED-SERVER:
    Many thanks
    Karl

  • Error when installing the supporting objects of OLL Packaged Application

    Hello,
    I am trying to install OLL Packaged Application|http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r41/inst_pkgapp/inst_pkgapp.htm#top
    but when installing the supporting objects, I got error when executing the code of "create_package_body"
    Error at line 274: PLS-00201: identifier 'UTL_TCP' must be declared
    create or replace package body eba_oll_log
    as
    g_start_time    number;
    procedure log_init
    is
    begin
        g_start_time := dbms_utility.get_time;
    end log_init;
    procedure log_page_view
    is
    begin
       insert into eba_oll_page_views
          ( APEX_USER,
            PAGE_ID,
            PAGE_NAME,
            VIEW_DATE,
            TS,
            ELAPSED_TIME,
            IP_ADDRESS,
            AGENT,
            APEX_SESSION_ID,
            CONTENT_ID,
            CONTENT_TITLE )
       values
          ( v('APP_USER'),
            v('APP_PAGE_ID'),
            wwv_flow.g_step_title,
            trunc(sysdate,'DD'),
            systimestamp,
            (dbms_utility.get_time-g_start_time)*(.01),
            owa_util.get_cgi_env('REMOTE_ADDR'),
            owa_util.get_cgi_env('HTTP_USER_AGENT'),
            v('APP_SESSION'),
            case when v('APP_PAGE_ID') = 24
                 then v('P24_CONTENT_ID')
                 else null
                 end,
            case when v('APP_PAGE_ID') = 24
                 then v('P24_CONTENT_TITLE')
                 else null
                 end );
       if v('APP_PAGE_ID') = 24 then
          insert into eba_oll_content_views
             ( APEX_USER,
               VIEW_DATE,
               TS,
               IP_ADDRESS,
               AGENT,
               APEX_SESSION_ID,
               CONTENT_ID,
               CONTENT_TITLE,
               NOTE )
          values
             ( v('APP_USER'),
               trunc(sysdate,'DD'),
               systimestamp,
               owa_util.get_cgi_env('REMOTE_ADDR'),
               owa_util.get_cgi_env('HTTP_USER_AGENT'),
               v('APP_SESSION'),
               v('P24_CONTENT_ID'),
               v('P24_CONTENT_TITLE'),
               'Viewed' );
       end if;
       commit;
    end log_page_view;
    procedure log_content_click
    is
    begin
       insert into eba_oll_content_views
          ( APEX_USER,
            VIEW_DATE,
            TS,
            IP_ADDRESS,
            AGENT,
            APEX_SESSION_ID,
            CONTENT_ID,
            CONTENT_TITLE,
            NOTE )
       values
          ( v('APP_USER'),
            trunc(sysdate,'DD'),
            systimestamp,
            owa_util.get_cgi_env('REMOTE_ADDR'),
            owa_util.get_cgi_env('HTTP_USER_AGENT'),
            v('APP_SESSION'),
            v('P24_CONTENT_ID'),
            v('P24_CONTENT_TITLE'),
            'Launched' );
       commit;
    end log_content_click;
    end eba_oll_log;
    create or replace package body eba_oll_api
    as
    function gen_id
       return number
    is
       l_id  number;
    begin
       select to_number(sys_guid(), 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
         into l_id
         from dual;
       return l_id;
    end gen_id;
    function eba_oll_tags_cleaner (
        p_tags  in varchar2,
        p_case  in varchar2 default 'U' ) return varchar2
    is
        type tags is table of varchar2(255) index by varchar2(255);
        l_tags_a        tags;
        l_tag           varchar2(255);
        l_tags          apex_application_global.vc_arr2;
        l_tags_string   varchar2(32767);
        i               integer;
    begin
        l_tags := apex_util.string_to_table(p_tags,',');
        for i in 1..l_tags.count loop
            --remove all whitespace, including tabs, spaces, line feeds and carraige returns with a single space
            l_tag := substr(trim(regexp_replace(l_tags(i),'[[:space:]]{1,}',' ')),1,255);
            if l_tag is not null and l_tag != ' ' then
                if p_case = 'U' then
                    l_tag := upper(l_tag);
                elsif p_case = 'L' then
                    l_tag := lower(l_tag);
                end if;
                --add it to the associative array, if it is a duplicate, it will just be replaced
                l_tags_a(l_tag) := l_tag;
            end if;
        end loop;
        l_tag := null;
        l_tag := l_tags_a.first;
        while l_tag is not null loop
            l_tags_string := l_tags_string||l_tag;
            if l_tag != l_tags_a.last then
                l_tags_string := l_tags_string||', ';
            end if;
            l_tag := l_tags_a.next(l_tag);
        end loop;
        return substr(l_tags_string,1,4000);
    end eba_oll_tags_cleaner;
    procedure eba_oll_tag_sync (
        p_new_tags          in varchar2,
        p_old_tags          in varchar2,
        p_content_type      in varchar2,
        p_content_id        in number )
    as
        type tags is table of varchar2(255) index by varchar2(255);
        l_new_tags_a    tags;
        l_old_tags_a    tags;
        l_new_tags      apex_application_global.vc_arr2;
        l_old_tags      apex_application_global.vc_arr2;
        l_merge_tags    apex_application_global.vc_arr2;
        l_dummy_tag     varchar2(255);
        i               integer;
    begin
        l_old_tags := apex_util.string_to_table(p_old_tags,', ');
        l_new_tags := apex_util.string_to_table(p_new_tags,', ');
        if l_old_tags.count > 0 then --do inserts and deletes
            --build the associative arrays
            for i in 1..l_old_tags.count loop
                l_old_tags_a(l_old_tags(i)) := l_old_tags(i);
            end loop;
            for i in 1..l_new_tags.count loop
                l_new_tags_a(l_new_tags(i)) := l_new_tags(i);
            end loop;
            --do the inserts
            for i in 1..l_new_tags.count loop
                begin
                    l_dummy_tag := l_old_tags_a(l_new_tags(i));
                exception when no_data_found then
                    insert into eba_oll_tags (tag, content_id, content_type )
                        values (l_new_tags(i), p_content_id, p_content_type );
                    l_merge_tags(l_merge_tags.count + 1) := l_new_tags(i);
                end;
            end loop;
            --do the deletes
            for i in 1..l_old_tags.count loop
                begin
                    l_dummy_tag := l_new_tags_a(l_old_tags(i));
                exception when no_data_found then
                    delete from eba_oll_tags where content_id = p_content_id and tag = l_old_tags(i);
                    l_merge_tags(l_merge_tags.count + 1) := l_old_tags(i);
                end;
            end loop;
        else --just do inserts
            for i in 1..l_new_tags.count loop
                insert into eba_oll_tags (tag, content_id, content_type )
                    values (l_new_tags(i), p_content_id, p_content_type );
                l_merge_tags(l_merge_tags.count + 1) := l_new_tags(i);
            end loop;
        end if;
        for i in 1..l_merge_tags.count loop
            merge into eba_oll_tags_type_sum s
            using (select count(*) tag_count
                     from eba_oll_tags
                    where tag = l_merge_tags(i) and content_type = p_content_type ) t
               on (s.tag = l_merge_tags(i) and s.content_type = p_content_type )
             when not matched then insert (tag, content_type, tag_count)
                                   values (l_merge_tags(i), p_content_type, t.tag_count)
             when matched then update set s.tag_count = t.tag_count;
            merge into eba_oll_tags_sum s
            using (select sum(tag_count) tag_count
                     from eba_oll_tags_type_sum
                    where tag = l_merge_tags(i) ) t
               on (s.tag = l_merge_tags(i) )
             when not matched then insert (tag, tag_count)
                                   values (l_merge_tags(i), t.tag_count)
             when matched then update set s.tag_count = t.tag_count;
        end loop;
    end eba_oll_tag_sync;
    procedure render_tag_cloud (
       p_selection          in varchar2 default null,
       p_app_id             in number,
       p_session_id         in number,
       p_min_nbr_tags       in number default 1,
       p_max                in number default 100,
       p_limit              in number default 10000,
       p_link_to_page       in varchar2 default '2',
       p_tag_item_filter    in varchar2 default 'P2_TAGS',
       p_clear_cache        in varchar2 default '2,CIR,RIR',
       p_more_page          in varchar2 default '62' )
    as
       l_printed_records    number := 0;
       l_available_records  number := 20;
       l_max                number;
       l_min                number;
       l_class_size         number;
       l_class              varchar2(30);
       type l_tagtype is table of varchar2(2000);
       l_tags l_tagtype;
       type l_numtype is table of number;
       l_cnts l_numtype;
       l_size number;
       l_total number :=0;
       l_buffer varchar2(32676);  
       CURSOR c_all_tags
       IS
           select tag, c from (
           select t.tag, count(*) c
             from eba_oll_content c,
                  eba_oll_tags t
            where c.content_id = t.content_id
              and c.display_yn = 'Y'
              and (p_selection is null or
                   (p_selection is not null and
                   (   (substr(p_selection,1,1) = 'R' and
                        substr(p_selection,2) in (select release_id
                                                    from eba_oll_content_products cp
                                                   where cp.content_id = c.content_id))
                    or (substr(p_selection,1,1) = 'C' and
                        substr(p_selection,2) in (select product_id
                                                    from eba_oll_content_products cp
                                                   where cp.content_id = c.content_id))
                    or (substr(p_selection,1,1) = 'P' and
                        (substr(p_selection,2) in (select product_id
                                                     from eba_oll_content_products cp
                                                    where cp.content_id = c.content_id) or
                         substr(p_selection,2) in (select p.parent_product_id
                                                     from eba_oll_content_products cp,
                                                          eba_oll_products p
                                                    where cp.content_id = c.content_id
                                                      and cp.product_id = p.product_id)))
                    or (substr(p_selection,1,1) = 'G' and
                        (substr(p_selection,2) in (select pg.group_id
                                                     from eba_oll_product_groupings pg,
                                                          eba_oll_content_products cp
                                                    where pg.product_id = cp.product_id
                                                      and cp.content_id = c.content_id) or
                         substr(p_selection,2) in (select pg.group_id
                                                     from eba_oll_product_groupings pg,
                                                          eba_oll_products p,
                                                          eba_oll_content_products cp
                                                    where pg.product_id = p.parent_product_id
                                                      and p.product_id = cp.product_id
                                                      and cp.content_id = c.content_id)))
            group by tag
           ) x where rownum < p_limit
                 and c >= p_min_nbr_tags
            order by upper(tag) ;
    begin
       -- Fetch tags into arrays
       open c_all_tags;
          loop
              fetch c_all_tags bulk collect into l_tags,l_cnts limit p_limit;
              exit;
          end loop;
       close c_all_tags;
       l_available_records := l_tags.count;
       -- Determine total count and maximum tag counts
       l_max := 0;
       l_min := 1000;
       FOR i in l_cnts.first..l_cnts.last loop
          l_total := l_total + l_cnts(i);
          if l_cnts(i) > l_max then
             l_max := l_cnts(i);
          end if;
          if l_cnts(i) < l_min then
             l_min := l_cnts(i);
          end if;
       end loop;
       if l_max = 0 then l_max := 1; end if;
       l_class_size := round((l_max-l_min)/6);
       -- Generate tag cloud --
       sys.htp.prn('<div class="tagCloud"><ul>');
       for i in l_tags.first..l_tags.last loop
           l_printed_records := l_printed_records + 1;
           if l_cnts(i) < l_min + l_class_size then
              l_class := 'size1';
           elsif l_cnts(i) < l_min + (l_class_size*2) then
              l_class := 'size2';
           elsif l_cnts(i) < l_min + (l_class_size*3) then
              l_class := 'size3';
           elsif l_cnts(i) < l_min + (l_class_size*4) then
              l_class := 'size4';
           elsif l_cnts(i) < l_min + (l_class_size*5) then
              l_class := 'size5';
           else l_class := 'size6';
           end if;     
           l_buffer := '<li><a class="'||l_class||'" href="'||
                  'f?p='||p_app_id||':'||p_link_to_page||':'||p_session_id||':::'||p_clear_cache||':'||
                  p_tag_item_filter||':'||htf.escape_sc(l_tags(i))||'">'||
                  htf.escape_sc(l_tags(i)) || '<span>' || l_cnts(i) || '</span></a></li>';
           sys.htp.prn(l_buffer);
           l_buffer := '';
           if  l_printed_records > p_max then
               exit;
           end if;
       end loop;
       sys.htp.prn('</ul></div>');
       -- print if there's more
       if l_tags.count - l_printed_records != 0 then
               htp.prn('<p><a href="f?p='||p_app_id||':'||htf.escape_sc(p_more_page)||
                     ':'||p_session_id||':::'||htf.escape_sc(p_more_page)||'">View all tags</a></p>');
       end if;
       exception when others then
          sys.htp.prn('<p>No tags found.</p>');
    end render_tag_cloud;
    procedure email_when_feedback (
       p_feedback_id  in  number,
       p_host_url     in  varchar2,
       p_app_id       in  number )
    is
       l_body       clob;
       l_body_html  clob;
    begin
    for c1 in (
       select f.feedback_comment, f.feedback_by,
              c.title, nvl(ct.feedback_contacts,'[email protected]') email
         from eba_oll_content_feedback f,
              eba_oll_content c,
              eba_oll_team ct
        where f.id = p_feedback_id
          and f.content_id = c.content_id
          and c.team_id = ct.team_id (+) )
    loop
       l_body := 'You have received feedback for a piece of content you own in the Oracle Learning Library (OLL) Application.
    Content: '|| c1.title || utl_tcp.crlf || '
    Feedback: '|| c1.feedback_comment || utl_tcp.crlf || '
    Left by: '|| lower(c1.feedback_by) ||'
    You can respond via the OLL Application, '||p_host_url||'f?p='||p_app_id||':47:::NO::P47_ID:' || p_feedback_id || '.';
       l_body_html := '<div style="border: 1px solid #DDD; background-color: #F8F8F8; width: 460px; margin: 0 auto; -moz-border-radius: 10px; -webkit-border-radius: 10px; padding: 20px;">
    <p style="font: bold 12px/16px Arial, sans-serif; margin: 0 0 10px 0; padding: 0;">
    You have received feedback for a piece of content you own in the Oracle Learning Library (OLL) Application.
    </p>
    <table style="width: 100%;" cellspacing="0" cellpadding="0" border="0">
    <tr>' || utl_tcp.crlf || '
    <td style="font: bold 12px/16px Arial, sans-serif; color: #666; padding: 0 10px 10px 0; vertical-align: top;">Content</td>
    <td style="font: normal 12px/16px Arial, sans-serif; padding: 0 10px 10px 0; vertical-align: top;"><a href="#" style="color: #000">'||c1.title||'</a></td>
    </tr>
    <tr>' || utl_tcp.crlf || '
    <td style="font: bold 12px/16px Arial, sans-serif; color: #666; padding: 0 10px 10px 0; vertical-align: top;">Feedback</td>
    <td style="font: normal 12px/16px Arial, sans-serif; padding: 0 10px 10px 0; vertical-align: top;">'||replace(c1.feedback_comment,CHR(10),'<br/>')||'</td>
    </tr>
    <tr>' || utl_tcp.crlf || '
    <td style="font: bold 12px/16px Arial, sans-serif; color: #666; padding: 0 10px 10px 0; vertical-align: top;">Left by</td>
    <td style="font: bold 12px/16px Arial, sans-serif; padding: 0 10px 10px 0; vertical-align: top;">'||lower(c1.feedback_by)||'</td>
    </tr>
    <tr>' || utl_tcp.crlf || '
    <td colspan="2" style="text-align: center; font: normal 12px/16px Arial, sans-serif; padding: 0 10px 10px 0; vertical-align: top;">
    <a href="'||p_host_url||'f?p='||p_app_id||':47:::NO::P47_ID:' || p_feedback_id ||'" style="display: block; padding: 10px; background-color: #EEE; font: bold 16px/16px Arial, sans-serif; color: #444">Respond to this Feedback</a>
    </td>
    </tr>
    </table>
    </div>';
       apex_mail.send (
          p_to        => c1.email,
          p_from      => '[email protected]',
          p_subj      => 'OLL - New Feedback for your team',
          p_body      => l_body,
          p_body_html => l_body_html );
    end loop;
    end email_when_feedback;
    procedure email_when_response (
       p_feedback_id  in  number,
       p_host_url     in  varchar2,
       p_app_id       in  number )
    is
       l_body       clob;
       l_body_html  clob;
    begin
    for c1 in (
       select f.feedback_comment, f.feedback_by, f.response, c.title
         from eba_oll_content_feedback f,
              eba_oll_content c
        where f.id = p_feedback_id
          and f.content_id = c.content_id )
    loop
       l_body := 'You have received a response to your feedback left in the Oracle Learning Library (OLL) Application.
    Content: '|| c1.title || '
    Feedback: '|| c1.feedback_comment || '
    Response: '|| c1.response || '
    You can also view this response via the OLL Application, '||p_host_url||'f?p='||p_app_id||':60:::NO::IR_ID:' || p_feedback_id || '.';
          l_body_html := '<div style="border: 1px solid #DDD; background-color: #F8F8F8; width: 460px; margin: 0 auto; -moz-border-radius: 10px; -webkit-border-radius: 10px; padding: 20px;">
    <p style="font: bold 12px/16px Arial, sans-serif; margin: 0 0 10px 0; padding: 0;">
    You have received a response to your feedback left in the Oracle Learning Library (OLL) Application.
    </p>
    <table style="width: 100%;" cellspacing="0" cellpadding="0" border="0">
    <tr>' || utl_tcp.crlf || '
    <td style="font: bold 12px/16px Arial, sans-serif; color: #666; padding: 0 10px 10px 0; vertical-align: top;">Content</td>
    <td style="font: normal 12px/16px Arial, sans-serif; padding: 0 10px 10px 0; vertical-align: top;"><a href="#" style="color: #000">'||c1.title||'</a></td>
    </tr>
    <tr>' || utl_tcp.crlf || '
    <td style="font: bold 12px/16px Arial, sans-serif; color: #666; padding: 0 10px 10px 0; vertical-align: top;">Feedback</td>
    <td style="font: normal 12px/16px Arial, sans-serif; padding: 0 10px 10px 0; vertical-align: top;">'||replace(c1.feedback_comment,CHR(10),'<br/>')||'</td>
    </tr>
    <tr>' || utl_tcp.crlf || '
    <td style="font: bold 12px/16px Arial, sans-serif; color: #666; padding: 0 10px 10px 0; vertical-align: top;">Response</td>
    <td style="font: bold 12px/16px Arial, sans-serif; padding: 0 10px 10px 0; vertical-align: top;">'||replace(c1.response,CHR(10),'<br/>')||'</td>
    </tr>
    <tr>' || utl_tcp.crlf || '
    <td colspan="2" style="text-align: center; font: normal 12px/16px Arial, sans-serif; padding: 0 10px 10px 0; vertical-align: top;">
    <a href="'||p_host_url||'f?p='||p_app_id||':60:::NO::IR_ID:' || p_feedback_id ||'" style="display: block; padding: 10px; background-color: #EEE; font: bold 16px/16px Arial, sans-serif; color: #444">View Response in OLL Application</a>
    </td>
    </tr>
    </table>
    </div>';
       apex_mail.send (
          p_to        => c1.feedback_by,
          p_from      => '[email protected]',
          p_subj      => 'Oracle Learning Library - Response to your Feedback',
          p_body      => l_body,
          p_body_html => l_body_html );
    end loop;
    end email_when_response;
    end eba_oll_api;
    /Error at line 274: PLS-00201: identifier 'UTL_TCP' must be declared
    Edited by: Fateh on Jan 13, 2012 7:32 AM

    Thanks & Sorry for not mentioning the full information about my environment.
    it was:
    Oracle 11g xe R2 on Windows 7 machine
    Apex listener deployed on Glass Fish server 3.1 on Windows 7 machine
    Apex 4.1
    Google Chrome
    So, to have OLL application worked locally . we need the following:
    grant execute on utl_tcp to [your_schema_name]And to
    Configure an Application Express Application as a Partner Application in Oracle AS Single Sign-On http://www.oracle.com/technetwork/testcontent/sso-partner-app-100552.html.
    I think I am going to install on my work space on apex.oracle.com.
    Regards,
    Fateh
    Edited by: Fateh on Jan 15, 2012 9:38 AM

  • Oracle 8i OAS ip address

    Hello
    I use a Oracle Application server4.0 with Oracle8.1.6 & Solaris 2.7/
    In my PL/SQL procedure(for web), I want to Know the client IP address.
    But, when I use "owa_sec.get_client_ip"(return owa_util.ip_address) I can't get a correct result.
    What shall I do?
    My code is
    Create Or Replace Procedure p_iptest
    IS
    ipaddr owa_util.ip_address;
    v_count number;
    Begin
    ipaddr := owa_sec.get_client_ip;
    htp.p('<html><head></head><body>');
    v_count := ipaddr.count;
    htp.p(v_count);
    IF ipaddr IS NULL THEN
    htp.p('yes');
    ELSE
    htp.p('no');
    htp.p(TO_CHAR(ipaddr(1)));
    htp.p(TO_CHAR(ipaddr(2)));
    htp.p(TO_CHAR(ipaddr(3)));
    htp.p(TO_CHAR(ipaddr(4)));
    END IF;
    htp.p('</body></html>');
    END p_iptest;
    I get a result
    0 no Content-type:text/html Content-length :31 0 no
    help me!!!!
    P.S : PL/SQL Toolkit was installed

    You can use owa_util.get_cgi_env('REMOTE_ADDR');
    I hope help you....

  • Possible to "Fork" Maintenance Notice?

    Using the built-in APEX functionality on the Availability of the Application properties, we can either make the application unavailable except for developers or we can redirect to a particular page.
    If we do the former, the user sees the sad, plain, uninformative "application currently unavailable" message. If we do the latter, the user can see the happier, "your site is down but, look at the cute puppy in the hard hat" page but, then, so do the developers.
    What we'd really* like is for developers to be able to run pages, e.g. to test and fix mission critical bugs, but, to have non-developers redirected to the "cute puppy" page.
    Is this possible? Any ideas, even general ones, would be most appreciated.
    Thanks,
    -Joe

    Hi Joe,
    in the book "Expert Oracle Application Express" ( http://www.apress.com/9781430235125 ) you can find an approach on page 421 detailing that.
    This is what I have used in my projects so far, I have the most control over who can access the application for acceptance testing before releasing it into the "wild" to all the end users.
    Sometimes you even want to have a few key customers validate the application before everybody else is allowed to access the new release, not just developers.
    Thus we register a list of IP addresses that may access the application once we run in a so called RESTRICTED_MODE.
    Here is an excerpt from the book:
    BEGIN
      IF XLIB_CONF.GET_VALUE ('RESTRICTED_MODE') = '1' THEN
        IF IS_RUN_IN_BUILDER = FALSE AND INSTR (NVL (XLIB_CONF.GET_VALUE ('RESTRICTED_USERS'), '#'), OWA_UTIL.GET_CGI_ENV (‘REMOTE_ADDR’)) = 0 THEN
          HTP.P (XLIB_CONF.GET_VALUE ('RESTRICTED_MESSAGE'));
          HTP.P ( '<br /><span style="color:white;>"' || OWA_UTIL.GET_CGI_ENV (REMOTE_ADDR) || '</span>');
          APEX_APPLICATION.G_UNRECOVERABLE_ERROR := TRUE;
        END IF;
      END IF;
    END;The function xlib_conf.get_value will return the current value of the configuration parameter (i.e..
    RESTRICTED_MODE) from the configuration table.
    Using the function is_run_in_builder (see Listing 9-13) you can determine whether the application
    is run from within the application builder having developer privileges in the current workspace.
    Listing 9-13. Function is_run_in_builder
    FUNCTION is_run_in_builder
      RETURN BOOLEAN
    IS
    BEGIN
      return apex_application.g_edit_cookie_session_id is not null;
    END;###
    Hope that helps,
    ~Dietmar.

  • Owa_sec package

    Can anybody please help on these:
    1. When I run owa_sec.get_client_ip in the sql developer, it returns me null. Any idea why?
    2. How is owa_sec.get_client_ip different from owa_util.get_cgi_env('REMOTE_ADDR')?
    3. I want to get the ipaddress of my machine(like ipaddress I get when I check ip configuraion on the command line) and owa_util.get_cgi_env('REMOTE_ADDR') doesn't give me the right one? It gives some other number of the same series as is mine.
    Thanks,

    Thanks everybody for the reply.
    This is what I know so far:
    I am using windows2007 and Oracle 11g.
    select owa_util.get_cgi_env('REMOTE_ADDR') from dual
    --111.200.14.46
    select sys_context('userenv','ip_address') from dual;
    --111.200.13.1
    --and when I run ipconfig on the command line
    --111.200.132.59(this is what I want to achieve)
    Purpose is to is get ipaddress of the person who runs an application in apex.
    and following javascript(run on http://javascript.internet.com/user-details/ip-address.html) also give ip address that I want: 111.200.132.59
    '<!--#echo var="REMOTE_ADDR"-->'
    but when I put in the html header of the apex application, it doesn't return any ip address
    I didn't put it in apex forum thinking that I can probably get sql query to get desired results.
    Thanks,

  • REMOTE PC NAME

    When I used owa_util.get_cgi_env('REMOTE_ADDR') I can get the PC IP ADDRESS.
    Is there any possibility to get PC NAME with using owa_util function?
    Thank you!

    More information there is my script:
    CREATE OR REPLACE
    PROCEDURE "PRC_IPADDR_PCNAME"
    IS
         error_code number;
         error_msg varchar2(300);
         ipaddress varchar2(30):=NULL;
         pcname           varchar2(30):=NULL;
         pcname_sub varchar2(4):=NULL;
    BEGIN
    ipaddress:=owa_util.get_cgi_env('REMOTE_ADDR');
    pcname:=OWA_SEC.GET_CLIENT_HOSTNAME ; -- PC (Client) NAME
    pcname:=LTRIM(upper(pcname));
    pcname_sub:=substr(pcname,1,4);
    IF ipaddress IN '150.11.25.1','510.18.3.122')
    THEN
    owa_util.redirect_url('http://www.web1......./');
    ELSE
    IF pcname_sub = 'KTL-'
    THEN
    owa_util.redirect_url('http://www.web2.........');
    ELSE
    owa_util.redirect_url('http://www.web3....../');
    END IF;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
         error_code           := SQLCODE;
         error_msg           := SQLERRM;
         htp.print('** ERROR: '||to_char(error_code)||' : '||error_msg);
    END;
    /

  • Problem in getting remote address?

    Hi,
    I have a procedure on my login page, which reads user's IP address and stores it in a log file. I am using the following statement to get the IP address of remote user:
    select owa_util.get_cgi_env('REMOTE_ADDR') from dual;
    It is running fine on my workspace at http://apex.oracle.com and returns the real IP address of the remote user. But when I use the same code at my hosted server I get 127.0.0.1 instead of real IP.
    Any ideas please?
    Thanks,
    Zahid

    Hello,
    >
    Can you please explain that how it can be misleading and how would you go for securing anything super confidential etc.?
    >
    Well, lots of reasons really. Firstly the IP address that you think identifies an end user might in fact be the IP address of a transparent proxy server that their ISP uses (a transparent proxy server can modify the request headers to change the IP address so that the request appears to come from them rather than the end user). The user might also have actively used a proxy server to 'appear' to be coming from somewhere else (a common technique to view content that should not be visible outside certain countries etc).
    The user might be inside a corporate LAN which presents a single (or multiple) NAT IP address to the world, so you only know the IP address of their main NAT routers/switches etc.
    The user might be using a tunneled SSH session so that the traffic appears to be coming from another bastion host rather than their own machine.
    The user might be using a network like TOR, so that their network traffic appears to be coming from elsewhere.
    Pretty much since TCP/IP became popular there have been ways and means to spoof your IP address (for various nefarious reasons), it's always been relatively easy to spoof a fake IP address at the packet level...obviously the difficult bit is to then receive the content if you're pretending to be elsewhere ;) How it has and continues to be done...
    Those are just a few examples off the top of my head, there are others...
    My point is, that using the IP address of the HTTP request can be useful, however just be aware that the address might not be the actual real address of the real end user (for the reasons described). I have actually seen people block a particular IP address from access a web site, only to find that it was actually the address of a proxy server used by hundreds (or more likely thousands) of other users who had also been inadvertently blocked from accessing the site.
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Server message displayed in Internet Explorer

    We use PL/SQL for this web application that makes use of following code:
    owa_util.get_cgi_env('remote_addr')
    In IE 6, this message comes up:
    "This document was found at the following location.
    HTTP/1.1 200 OK Date:Mon, 26 Jan 2004 18:52:02 GMT Allow:GET, HEAD Server. Oracle_Web_listener/4.0.8.1.0EnterpriseEdition Content-Type:text/html Content-length:4101 Connection:Keep-Alive Keep-Alive; timeout=10,max=999"
    Message does not appear in Netscape.
    Any ideas?
    Thanks.

    Hi Kiran,
    it's not possible to show the favicon into Internet Explorer.
    It may be viewed only in Mozilla (Firefox).
    This is due to the browser itself. (You can simply check that in the IE any favicon is showed)
    Regards,
    Gianluca Barile

  • Conditional button based on client's IP address

    i know this is not secured, but ....
    I have little app with no login. It is a documentation for our project, it uses a tree, .... bla bla bla
    nobody can change anything (it is really just a few pages of documentation). I want one, just one, user to be able to edit one form for next few weeks. My idea was to add "SAVE" button and make it conditional based on his IP address or computer name. Is there a way how to do this?
    thanks
    jiri

    Just make the button conditional upon the following PL/SQL expression
    owa_util.get_cgi_env('REMOTE_ADDR')='xx.xx.xx.xx'Best practices: You should create a named authorization scheme with that code (returns true/false to allow/deny access) and attach that scheme to the button and any After-Submit processes that actually does the save.
    Hope this helps.

Maybe you are looking for

  • My reminders and notes keep disappearing - where do they go and how can I get them to stay forever?

    Hi - I'm having challenges with the Notes and Reminders apps.  Data in both disappear - i.e. in Reminders I have the titles of the Reminder list but all the items in the list are no longer there.  Notes just flat out go into the ether.  This started

  • Monitor less resolution running OSX?

    Hello there! I wondered if anybody can explain to me the following oddity: Under 9.2 the maximum resolution of my monitor is 1280 x 1024 (85Hz) pixels -- I just found that under 10.4 it's just 1152 x 882 (95 Hz). Hm, how can that be? Best, Cora

  • How to enable HLog for B-ACD Hunt Group

    We are using B-ACD for imcoming calls, the hunt group for BACD has 5 members. I want people to be able to login/logoff from this hunt group. I have this working with the DND button, but then the phone doesn't ring when the extension is dailed directl

  • Package class files with bpel suitcase

    Hello, Is it possible to package java classes which are invoked through WSIF along with the BPEL Suitcase generated by bpelc? I've noticed that when generating and deploying the suitcase using JDeveloper (10.1.3.x) - the class files are compiled to t

  • Receiving and parsing a SOAP Message

    Hi All. I have just installed the JAXM package, cause I want to programm a network message broker using SOAP. The server code is written in C# and I tested it. All messages are send and processed via SOAP and it all works. So I now want to try to rec