The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Setting "authuser" as php variable

Discussion in 'cPanel Developers' started by sirbrent, Aug 10, 2009.

  1. sirbrent

    sirbrent Well-Known Member

    Joined:
    Sep 30, 2008
    Messages:
    98
    Likes Received:
    1
    Trophy Points:
    8
    Hello,

    I am trying to use the currently logged in user as a constant in my php script.

    Using the API <cpanel print="$authuser"> accomplishes the result I am looking for but does not work within PHP.

    What 'voodoo' do I need to use the cPanel API properly in this case?

    PHP:
    <?php

    define
    ("loggeduser","AUTHUSER NEEDS TO BE HERE");

    ?>
    I have checked out the XMPAPI but it seems like more than I need at the moment, and also doesnt seem to be able to fetch the currently logged in user (perhaps I am wrong).

    Thank you!
     
  2. bvierra

    bvierra Well-Known Member

    Joined:
    Jul 28, 2006
    Messages:
    55
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Southern California
    name the page cpphp instead of php. This runs the php file through the cPanel wrapper which replaces the code with the variable you want
     
  3. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
  4. sirbrent

    sirbrent Well-Known Member

    Joined:
    Sep 30, 2008
    Messages:
    98
    Likes Received:
    1
    Trophy Points:
    8
    Hi David,

    Thank you for your response.
    I read that API presentation a few days ago, and am very excited that it will finally allow me the kind of flexibility and functionality that I have been wanting and expecting when writing cPanel content with PHP.

    However, I am experiencing a few hurdles with livephp - I actually posted about one of them yesterday in this forum:

    http://forums.cpanel.net/f42/using-cpanel-branding-includes-within-livephp-127713.html

    Any feedback would be appreciated.
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I've discussed that post at length with a member of our Quality Assurance team. We are working on attempting to find a solution to these issues.
     
  6. sirbrent

    sirbrent Well-Known Member

    Joined:
    Sep 30, 2008
    Messages:
    98
    Likes Received:
    1
    Trophy Points:
    8
    David,

    Thank you. I eagerly await information concerning the solutions to these issues.

    Many Thanks.
     
  7. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page