Retrieving user id and display it on php file from wrapper? - Joomla! Forum - community, help and support


hello all,

i have php file access via joomla installation, via wrapped link. want know how can have php file, retrieve user's joomla id number , display it? how code in php?

in other words, how can pass variable wrapped php file?

regards,

eruiz

you pass in url page

this require little hack of wrapper component, when user logged in, appends id variable in url of wrapped page.

the wrapped page can access , output etc.

in /components/com_wrapper/wrapper.html.php

you find function display wrapper, starts with

code: select all

class html_wrapper {

   function displaywrap( &$row, &$params, &$menu ) {
      ?>
      <script language="javascript" type="text/javascript">
      function iframeheight() {


after:

code: select all

function displaywrap( &$row, &$params, &$menu ) {


you can add:

code: select all

        global $my;
        if ( $my->id ) {
            $row->url = $row->url . "?jid=" . $my->id;
            }

which if logged in adds user's id wrapped page's url

e.g. if page was

domain/somepage.php

it become

domain/somepage.php?jid=78

this may need modified suit url e.g. may need add

&jid=78
instead

in wrapped page can access user's id e.g.

code: select all

<?php echo $_request['jid']; ?>


although security, should ensure variable take expecting, should check like:

code: select all

<?php $good_values = range( 0, 500 );
        if (in_array ($_request['jid'], $good_values)) { // value jid must number between 0 , 500
        echo $_request['jid'];
}
?>


if need use wrapper other pages, not want id appended url, need little more work added in appropriate situations. not elaborate on now, keep things simple.





Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support