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.

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. 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
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page