Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

secure cPanel auto login with PHP

Discussion in 'cPanel Developers' started by irshad, Dec 18, 2014.

  1. irshad

    irshad Registered

    Joined:
    Dec 18, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    i am trying to built an php page where users can click on button and login to cPanel as many of websites already have this feature.

    i am searching for code on Internet from last 1 week and found one code mostly uses is

    using hidden variable with form and submit the form.

    PHP:
    <?php 
        $domain 
    ='dname'
        
    $user ='duser'
        
    $pass 'dpass'
        
    $port '2083'
        
        
    $port == "2083" || $port == "2096" $pre "https://" $pre "http://"
        
    $action $pre."".$domain.":".$port."/login/";
        
    ?> 
    <body onLoad="setTimeout('document.forms[0].submit();',10)"> 
    <form action="<?php echo $action;?>" method="post">
    <input type="hidden" name="user" value="<?php echo $user?>"> 
    <input type="hidden" name="pass" value="<?php echo $pass?>"> 
    </form> 
    </body> 
    </html>
    this works perfect but my concern is that these hidden fields can be viewed by source code or firebug.
    is there any other way to login to cPanel without having user name & passwords in page or at least not viewable to user.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,711
    Likes Received:
    1,794
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. irshad

    irshad Registered

    Joined:
    Dec 18, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Hello,

    Thanks for your reply but i am vary new to cpanel and all this stuff.

    where do i put this code ?

    can i put this code in any PHP file in any hosting account on any server ?

    or i need to put this code in special php file in special directory of that server i am trying to login users?

    Thanks
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,711
    Likes Received:
    1,794
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    You may find this thread helpful if you are looking for specific examples:

    PHP Code For LogMeIn

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice