Fork me on GitHub

How to include user variables in menu link to postwrap  Bottom

  • I'm using postwrap to show an asp site that requires login in the form

    Code

    http://www.othersite.com/login.asp?uid=username&pwd=password


    How can I write the menu link to include the currently logged in user's username (uname) and password (pass)? The user will also exist with the same credentials on the other site.
  • You can get the username via

    Code

    pnUserGetVar('uname');

    However, I don't know of a way to retreive the password (not from that function, anyway) - it's a one-way encryption hash into the database, so there's no way to retreive & "unencrypt" it...

    And you couldn't put the above in a menu link - you would have to put it in a PHP block or hard code it into the menu block...

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Keep in mind, when using special characters (i.e. & %) in the page variable in the address bar and sometimes in the URL Security settings, you must translate the characters to their ASCII hex value preceded by a %. The ? is %3F and & is %26.

    Example:
    page=http://somedomain.com/page.php?somevar=50&othervar=login

    Becomes:
    page=http://somedomain.com/page.php%3Fsomevar=50%26othervar=login

    -Shawn

    --
    Get the Revolutionary AutoTheme HTML Theme System! Currently for Zikula, PHP-Nuke, CRE Loaded, osCommerce and Wordpress!
  • So, if I create a new block with content type core/php, how would I write the code to create the link and insert the username :?:.
  • Code

    $username = pnUserGetVar('uname');

    echo '<a href="http://www.yourpnsite.com/modules.php?op=modload&name=PostWrap&file=index&page=http://www.othersite.com/login.asp%3Fuid='.$username.'">Click here</a>';


    -Shawn

    --
    Get the Revolutionary AutoTheme HTML Theme System! Currently for Zikula, PHP-Nuke, CRE Loaded, osCommerce and Wordpress!
  • Thanks Shawn! That worked great. Storing the password as clear text would not be a very good idea anyway.
  • 0 users

This list is based on users active over the last 60 minutes.