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.

CPanel Theme URL's & Sessions

Discussion in 'User Experience' started by NodeKi, Feb 12, 2012.

  1. NodeKi

    NodeKi Registered

    Joined:
    Jan 8, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    We're working on a new CPanel theme for our customers and we seem to be having a little trouble when it comes to linking, specifically link structure and keeping the session in the URL. It seems when we're at the base, the links work fine, though when we navigation to a specific section (for instance, MySQL), the session drops.

    For instance, we tried using:

    Code:
    <a href="<cpanel printvar="dprefix">sql/index.php">MySQL</a>
    
    The above generates the correct URL when we're at the theme base, though when we browse to the MySQL section, it becomes:

    Code:
    http://server.exampleurl.com/sessionid/themename/[b]sql/sql[/b]/index.php
    

    Is there a better way to direct link files?
     
  2. 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
    Effectively what this is doing is using relative links rather than absolute links. Relative links maintain the random string implemented by CSRF protection. Absolute links (within the context of the cPanel, WHM or Webmail interfaces when CSRF protection is enabled) would create all sorts of trouble, including prompting for a password every time they are clicked on.

    I've been unable to reproduce this quirk, but as long as you use relative links, you may be able to safely omit the < cpanel ... > tag
     
  3. charsleysa

    charsleysa Active Member

    Joined:
    Jul 18, 2011
    Messages:
    41
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Palmerston North, New Zealand
    cPanel Access Level:
    Root Administrator
    I would suggest cutting off the end of the URL and only have the part that is constant used as a BASE constant where all your links will be prefixed with the BASE.

    E.G.
    if the URL is
    http://server . exampleurl . com/sessionid/themename/sql/sql/index.php

    the base would be
    http://server . exampleurl . com/sessionid/themename/

    because that part stays constant throughout your theme.

    If you can create your theme using a programming language like PHP, then use the $_SERVER array to put a link together then cut it off after "themename/"
     
  4. Portugal

    Portugal Registered

    Joined:
    Aug 9, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hi i have a similar issue but with a slight difference.
    The link i need is for a 3rd party plugin that is installed already in cpanel. Ill explain better;

    I have a plugin installed, that its auto integration with cpanel leaves an icon under the group "Software/Services" (x3 theme)
    But i want to give more focus to that plugin, i would like have an image just below the search box, linked to this plugin. This way the users will immediatly see it everytime they login to Cpanel.
    The image is already showing properly, but i am having difficulty constructing the link.
    When cliking on the plugin icon the link look like;

    http://server/user_session/3rdparty/plugin_name/index.php?/etc...

    Tried to use the solution provided i this topic but that adds to the link /frontend/templatename/ just after user_session and before 3rdparty, thus breaking the link.
     
Loading...

Share This Page