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.

Send cPanel Login Credentials via POST instead of GET

Discussion in 'cPanel Developers' started by Joel Winterton, Jun 8, 2016.

  1. Joel Winterton

    Joel Winterton Registered

    Joined:
    Jun 8, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Stoke-on-Trent
    cPanel Access Level:
    Reseller Owner
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  3. Joel Winterton

    Joel Winterton Registered

    Joined:
    Jun 8, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Stoke-on-Trent
    cPanel Access Level:
    Reseller Owner
    Well for anyone else who has this issue here is how I hid the credentials when sending them to the server:
    First I assigned the credentials in PHP:

    Code:
    <?php
    $user="username";
    $pass="password";
    ?>
    
    Then I made a form with two hidden values which where the variables:
    Code:
    <form action="https://cpanel:2083/login" method="POST"
    <input type="hidden" name="user" value="<?php echo($user); ?>">
    <input type="hidden" name="pass" value="<?php echo($pass); ?>">
      <input type="submit" value="Go to cPanel">
      </form>
    
    This then sends the variables via POST to the website in the correct format and the user cannot see the credentials as PHP is server side and cannot be read by the client.
    The top variables can be altered to contain login details from a form.
     
    #3 Joel Winterton, Jun 17, 2016
    Last edited by a moderator: Jun 17, 2016
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    I'm happy to see you were able to develop a suitable script for this purpose. Thank you for updating this thread with an example for others to view.
     
  5. edlemmers

    edlemmers Member

    Joined:
    Jan 30, 2013
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I have done POSTs thru PHP cURL. That way the credentials need not be with the client at all.
     
Loading...

Share This Page